summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix partial-match-bind-behavior with forEachDescendant() matchers.Daniel Jasper2012-11-161-2/+5
| | | | | | | | | | | | | | | | The problem is that a partial match of an (explicit or implicit) allOf matcher binds results, i.e. recordDecl(decl().bind("x"), hasName("A")) can very well bind a record that is not named "A". With this fix, the common cases of stumbling over this bug are fixed by the BoundNodesMap overwriting the results of a partial match. An error can still be created with a weird combination of anyOf and allOf (see inactive test). We need to decide whether this is worth fixing, as the fix will have performance impact. Review: http://llvm-reviews.chandlerc.com/D124 llvm-svn: 168177
* Fix binding of nodes in case of forEach..() matchers.Daniel Jasper2012-11-111-5/+6
| | | | | | | | | | When recursively visiting the generated matches, the aggregated bindings need to be copied during the recursion. Otherwise, we they might not be properly overwritten (which is shown by the test), or there might be bound nodes present that were bound on a different matching branch. Review: http://llvm-reviews.chandlerc.com/D112 llvm-svn: 167695
* Fixes a bug for binding memoized match results.Manuel Klimek2012-08-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Intorduces an abstraction for DynTypedNode which makes is impossible to create in ways that introduced the bug; also hides the implementation details of the template magic away from the user and prepares the code for adding QualType and TypeLoc bindings, as well as using DynTypedNode instead of overloads for child and ancestor matching. getNodeAs<T> was changed towards a non-pointer type, as we'll want QualType and TypeLoc nodes to be returned by value (the alternative would be to create new storage which is prohibitively costly if we want to use it for child / ancestor matching). DynTypedNode is moved into a new header ASTTypeTraits.h, as it is completely independent of the rest of the matcher infrastructure - if the need comes up, we can move it to a more common place. The interface for users before the introduction of the common storage change remains the same, minus the introduced bug, for which a regression test was added. llvm-svn: 162936
* Modifes BoundNodes to store void* and allow casting themManuel Klimek2012-08-281-42/+24
| | | | | | | | | | | | | into the correct types when pulling them out in the result callback in a type safe way. This is also the base change for multiple things that will allow handling things more generally and thus supporting more of the AST, especially handling Type nodes. Patch contributed by Michael Diamond. llvm-svn: 162804
* Add more matchers and do cleanups.Daniel Jasper2012-07-101-13/+13
| | | | | | | | Reviewers: klimek Differential Revision: http://ec2-50-18-127-156.us-west-1.compute.amazonaws.com/D2 llvm-svn: 160013
* Adds the AST Matcher library, which provides a in-C++ DSL to expressManuel Klimek2012-07-061-0/+102
matches on interesting parts of the AST, and callback mechanisms to act on them. llvm-svn: 159805
OpenPOWER on IntegriCloud