[cfe-commits] [PATCH] Add getASTContext to ASTMatchFinder

Edwin Vane edwin.vane at intel.com
Wed Nov 28 09:04:57 PST 2012


Hi klimek,

getASTContext provides access to ASTContex for user-written AST matchers.
    
Author: Edwin Vane <edwin.vane at intel.com>

http://llvm-reviews.chandlerc.com/D144

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

Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -537,6 +537,8 @@
                              Matcher, Builder, MatchMode);
   }
 
+  virtual ASTContext &getASTContext() const = 0;
+
 protected:
   virtual bool matchesChildOf(const ast_type_traits::DynTypedNode &Node,
                               const DynTypedMatcher &Matcher,
Index: lib/ASTMatchers/ASTMatchFinder.cpp
===================================================================
--- lib/ASTMatchers/ASTMatchFinder.cpp
+++ lib/ASTMatchers/ASTMatchFinder.cpp
@@ -475,6 +475,9 @@
     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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144.1.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121128/de8d97be/attachment.bin>


More information about the cfe-commits mailing list