]> granicus.if.org Git - clang/commitdiff
Allow matchers to access the ASTContext.
authorManuel Klimek <klimek@google.com>
Fri, 30 Nov 2012 13:45:19 +0000 (13:45 +0000)
committerManuel Klimek <klimek@google.com>
Fri, 30 Nov 2012 13:45:19 +0000 (13:45 +0000)
Patch by Edwin Vane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169000 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/ASTMatchers/ASTMatchersInternal.h
lib/ASTMatchers/ASTMatchFinder.cpp

index e5365ff89d7259bd0fe170631cb3c6995b88eae4..0d25810e0a24c624225844043c9a2a369d4be22c 100644 (file)
@@ -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,
index 04a2b353215c491bbe0dc665fa06424728e95d7f..c13cf4a277f3cfe096c3c188c55cf99c866fe588 100644 (file)
@@ -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