[PATCH] Filter the toplevel matchers by kind.

Manuel Klimek klimek at google.com
Mon Nov 24 01:52:32 PST 2014


LG (as the only question I have is basically unrelated to this patch), but I'd still like to get to the bottom of the question...

================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:187-191
@@ +186,7 @@
+  }
+  // Delete all bindings when a matcher does not match.
+  // This prevents unexpected exposure of bound nodes in unmatches
+  // branches of the match tree.
+  Builder->removeBindings([](const BoundNodesMap &) { return true; });
+  return false;
+}
----------------
sbenza wrote:
> klimek wrote:
> > Shouldn't every matcher already do that?
> Do what? Delete the bindings?
> This is where it happens, right?
> The MatcherInterface implementations don't delete anything.
> 
> I pretty much copied matches() and modified it. That stayed the same.
Hm, curious - does that actually make a difference in any test if we remove it (both here and in matches)?

http://reviews.llvm.org/D6361






More information about the cfe-commits mailing list