|
clang 22.0.0git
|
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. | |
| Public Member Functions inherited from clang::tooling::RefactoringCallback | |
| RefactoringCallback () | |
| Replacements & | getReplacements () |
| Public Member Functions inherited from clang::ast_matchers::MatchFinder::MatchCallback | |
| virtual | ~MatchCallback () |
| virtual void | onStartOfTranslationUnit () |
| Called at the start of each translation unit. | |
| virtual void | onEndOfTranslationUnit () |
| Called at the end of each translation unit. | |
| virtual StringRef | getID () const |
| An id used to group the matchers. | |
| virtual std::optional< TraversalKind > | getCheckTraversalKind () const |
| TraversalKind to use while matching and processing the result nodes. | |
Static Public Member Functions | |
| static llvm::Expected< std::unique_ptr< ReplaceNodeWithTemplate > > | create (StringRef FromId, StringRef ToTemplate) |
Additional Inherited Members | |
| Protected Attributes inherited from clang::tooling::RefactoringCallback | |
| 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 94 of file RefactoringCallbacks.h.
|
static |
Definition at line 159 of file RefactoringCallbacks.cpp.
|
overridevirtual |
Called on every match by the MatchFinder.
Implements clang::ast_matchers::MatchFinder::MatchCallback.
Definition at line 198 of file RefactoringCallbacks.cpp.
References clang::tooling::Replacement::getFilePath(), clang::Lexer::getSourceText(), clang::CharSourceRange::getTokenRange(), clang::tooling::RefactoringCallback::Replace, and clang::Result.