From: Manuel Klimek Date: Fri, 30 Nov 2012 13:45:19 +0000 (+0000) Subject: Allow matchers to access the ASTContext. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f2d4804510799a1a19d72b2b089e48370ab8686;p=clang Allow matchers to access the ASTContext. Patch by Edwin Vane. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169000 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h index e5365ff89d..0d25810e0a 100644 --- a/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -537,6 +537,8 @@ public: Matcher, Builder, MatchMode); } + virtual ASTContext &getASTContext() const = 0; + protected: virtual bool matchesChildOf(const ast_type_traits::DynTypedNode &Node, const DynTypedMatcher &Matcher, diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index 04a2b35321..c13cf4a277 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -475,6 +475,9 @@ public: return false; } + // Implements ASTMatchFinder::getASTContext. + virtual ASTContext &getASTContext() const { return *ActiveASTContext; } + bool shouldVisitTemplateInstantiations() const { return true; } bool shouldVisitImplicitCode() const { return true; } // Disables data recursion. We intercept Traverse* methods in the RAV, which