clang
6.0.0
|
Replace the text of an AST node bound to FromId
with the result of evaluating the template in ToTemplate
.
More...
#include "clang/Tooling/RefactoringCallbacks.h"
Public Member Functions | |
void | run (const ast_matchers::MatchFinder::MatchResult &Result) override |
Called on every match by the MatchFinder . More... | |
![]() | |
RefactoringCallback () | |
Replacements & | getReplacements () |
![]() | |
virtual | ~MatchCallback () |
virtual void | onStartOfTranslationUnit () |
Called at the start of each translation unit. More... | |
virtual void | onEndOfTranslationUnit () |
Called at the end of each translation unit. More... | |
virtual StringRef | getID () const |
An id used to group the matchers. More... | |
Static Public Member Functions | |
static llvm::Expected< std::unique_ptr< ReplaceNodeWithTemplate > > | create (StringRef FromId, StringRef ToTemplate) |
Additional Inherited Members | |
![]() | |
Replacements | Replace |
Replace the text of an AST node bound to FromId
with the result of evaluating the template in ToTemplate
.
Expressions of the form ${NodeName} in ToTemplate
will be replaced by the text of the node bound to ${NodeName}. The string "$$" will be replaced by "$".
Definition at line 95 of file RefactoringCallbacks.h.
|
static |
Definition at line 160 of file RefactoringCallbacks.cpp.
|
overridevirtual |
Called on every match by the MatchFinder
.
Implements clang::ast_matchers::MatchFinder::MatchCallback.
Definition at line 199 of file RefactoringCallbacks.cpp.
References clang::tooling::Replacements::add(), clang::ast_matchers::MatchFinder::MatchResult::Context, clang::Error, clang::tooling::Replacement::getFilePath(), clang::ASTContext::getLangOpts(), clang::ast_matchers::BoundNodes::getMap(), clang::Lexer::getSourceText(), clang::CharSourceRange::getTokenRange(), clang::ast_matchers::MatchFinder::MatchResult::Nodes, clang::tooling::RefactoringCallback::Replace, Replacement, clang::ast_matchers::MatchFinder::MatchResult::SourceManager, and clang::threadSafety::sx::toString().