14 #include "llvm/Support/Error.h" 18 using namespace clang;
19 using namespace tooling;
35 if (!Transformations) {
36 Consumer(Transformations.takeError());
40 if (Transformations->empty()) {
43 llvm::errs() <<
"note: skipping match at loc ", *Result.
SourceManager);
51 (*Transformations)[0].Range.getBegin());
52 for (
const auto &T : *Transformations) {
53 if (
auto Err = AC.replace(*Result.
SourceManager, T.Range, T.Replacement)) {
54 Consumer(std::move(Err));
60 auto &Header = I.first;
66 AC.addHeader((llvm::Twine(
"<") + Header +
">").str());
71 Consumer(std::move(AC));
A class to allow finding matches over the Clang AST.
bool hasErrorOccurred() const
DiagnosticsEngine & getDiagnostics() const
void print(raw_ostream &OS, const SourceManager &SM) const
Contains all information for a given match.
clang::ASTContext *const Context
Utilities for interpreting the matched AST structures.
Dataflow Directional Tag Classes.
Defines the clang::SourceLocation class and associated facilities.
clang::SourceManager *const SourceManager
bool addDynamicMatcher(const internal::DynTypedMatcher &NodeMatch, MatchCallback *Action)
Adds a matcher to execute when running over the AST.