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

Samuel Benzaquen sbenza at google.com
Wed May 8 14:12:19 PDT 2013



================
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);
 }
----------------
Manuel Klimek wrote:
> Samuel Benzaquen wrote:
> > Manuel Klimek wrote:
> > > Namely here.
> > > 
> > > I think the right solution sounds more like putting match(*TypeNode) after line 642?
> > I made it an overload so that both TraverseType and TraverseTypeLoc get this. If we only want it for TraverseType(), I can move there.
> But TraverseTypeLoc already calls match(TypeLocNode.getType()). Wouldn't that lead to too many matches?
Actually, if I only put the match(*TypeNode) in TraverseType(), the tests still fail.
If I put it only in TraverseTypeLoc(), then they all pass.


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



More information about the cfe-commits mailing list