clang
9.0.0
|
Handles the matcher and callback registration for a single rewrite rule, as defined by the arguments of the constructor. More...
#include "clang/Tooling/Refactoring/Transformer.h"
Public Types | |
using | ChangeConsumer = std::function< void(Expected< clang::tooling::AtomicChange > Change)> |
Public Member Functions | |
Transformer (RewriteRule Rule, ChangeConsumer Consumer) | |
void | registerMatchers (ast_matchers::MatchFinder *MatchFinder) |
N.B. More... | |
void | run (const ast_matchers::MatchFinder::MatchResult &Result) override |
Not called directly by users – called by the framework, via base class pointer. More... | |
![]() | |
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... | |
Handles the matcher and callback registration for a single rewrite rule, as defined by the arguments of the constructor.
Definition at line 279 of file Transformer.h.
using clang::tooling::Transformer::ChangeConsumer = std::function<void(Expected<clang::tooling::AtomicChange> Change)> |
Definition at line 282 of file Transformer.h.
|
inline |
Consumer | Receives each rewrite or error. Will not necessarily be called for each match; for example, if the rewrite is not applicable because of macros, but doesn't fail. Note that clients are responsible for handling the case that independent AtomicChanges conflict with each other. |
Definition at line 289 of file Transformer.h.
void Transformer::registerMatchers | ( | ast_matchers::MatchFinder * | MatchFinder | ) |
N.B.
Passes this
pointer to MatchFinder
. So, this object should not be moved after this call.
Definition at line 210 of file Transformer.cpp.
References clang::ast_matchers::MatchFinder::addDynamicMatcher(), and clang::tooling::detail::buildMatcher().
|
overridevirtual |
Not called directly by users – called by the framework, via base class pointer.
Implements clang::ast_matchers::MatchFinder::MatchCallback.
Definition at line 214 of file Transformer.cpp.
References clang::tooling::AtomicChange::addHeader(), clang::tooling::Angled, clang::tooling::detail::findSelectedCase(), clang::tooling::Quoted, clang::tooling::AtomicChange::replace(), clang::tooling::RewriteRule::RootID, clang::SourceLocation::SourceManager, and clang::tooling::detail::translateEdits().