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.

llvm-svn: 169000

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

index e5365ff..0d25810 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 04a2b35..c13cf4a 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