[PATCH] Replace overloaded ASTMatchFinder::addMatcher() function with one that takes a DynTypedMatcher.

Manuel Klimek klimek at google.com
Wed May 8 13:45:17 PDT 2013



================
Comment at: lib/ASTMatchers/ASTMatchFinder.cpp:412
@@ -411,1 +411,3 @@
 
+  // The traversal will not visit Types directly, only QualTypes. We overload
+  // match(QualType) to run the matchers on the underlying type also.
----------------
The funny thing is that this contradicts the assumptions we have below...

================
Comment at: lib/ASTMatchers/ASTMatchFinder.cpp:647-654
@@ -639,10 +646,10 @@
 bool MatchASTVisitor::TraverseTypeLoc(TypeLoc TypeLocNode) {
   // The RecursiveASTVisitor only visits types if they're not within TypeLocs.
   // We still want to find those types via matchers, so we match them here. Note
   // that the TypeLocs are structurally a shadow-hierarchy to the expressed
   // type, so we visit all involved parts of a compound type when matching on
   // each TypeLoc.
   match(TypeLocNode);
   match(TypeLocNode.getType());
   return RecursiveASTVisitor<MatchASTVisitor>::TraverseTypeLoc(TypeLocNode);
 }
----------------
Namely here.

I think the right solution sounds more like putting match(*TypeNode) after line 642?


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



More information about the cfe-commits mailing list