clang
10.0.0git
|
Handles the matcher and callback registration for a single RewriteRule
, as defined by the arguments of the constructor.
More...
#include "clang/Tooling/Transformer/Transformer.h"
Public Types | |
using | ChangeConsumer = std::function< void(Expected< clang::tooling::AtomicChange > Change)> |
Public Member Functions | |
Transformer (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 RewriteRule
, as defined by the arguments of the constructor.
Definition at line 23 of file Transformer.h.
using clang::tooling::Transformer::ChangeConsumer = std::function<void(Expected<clang::tooling::AtomicChange> Change)> |
Definition at line 26 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 33 of file Transformer.h.
References registerMatchers(), and run().
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 23 of file Transformer.cpp.
Referenced by Transformer().
|
overridevirtual |
Not called directly by users – called by the framework, via base class pointer.
Implements clang::ast_matchers::MatchFinder::MatchCallback.
Definition at line 28 of file Transformer.cpp.
References clang::transformer::RewriteRule::Case::AddedIncludes, clang::transformer::Angled, clang::ast_matchers::MatchFinder::MatchResult::Context, clang::transformer::RewriteRule::Case::Edits, clang::transformer::detail::findSelectedCase(), clang::ASTContext::getDiagnostics(), clang::transformer::detail::getRuleMatchLoc(), clang::DiagnosticsEngine::hasErrorOccurred(), clang::SourceLocation::print(), clang::transformer::Quoted, clang::ast_matchers::MatchFinder::MatchResult::SourceManager, and clang::transformer::detail::translateEdits().
Referenced by Transformer().