[PATCH] Filter the toplevel matchers by kind.
Samuel Benzaquen
sbenza at google.com
Mon Nov 24 13:04:31 PST 2014
================
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;
+}
----------------
klimek wrote:
> 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)?
Removing this doesn't affect the tests.
The callers should already be ignoring the contents Builder if matches() return false.
This is here as a protection in case some caller doesn't ignore it.
http://reviews.llvm.org/D6361
More information about the cfe-commits
mailing list