summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchFinder.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Insert interception point onStartOfTranslationUnit.Manuel Klimek2012-11-021-0/+10
| | | | | | | | | Often users of the ASTMatchers want to add tasks that are done once per translation unit, for example, cleaning up caches. Combined with the interception point for the end of source file one can add to the factory creation, this covers the cases we've seen users need. llvm-svn: 167271
* Implement descendant matchers for NestedNamespecifiersDaniel Jasper2012-10-301-0/+23
| | | | | | | | | This implements has(), hasDescendant(), forEach() and forEachDescendant() for NestedNameSpecifier and NestedNameSpecifierLoc matchers. Review: http://llvm-reviews.chandlerc.com/D86 llvm-svn: 167017
* Implement has(), hasDescendant(), forEach() and forEachDescendant() forDaniel Jasper2012-10-291-28/+57
| | | | | | | Types, QualTypes and TypeLocs. Review: http://llvm-reviews.chandlerc.com/D83 llvm-svn: 166917
* Adds the possibility to run ASTMatchFinder over arbitrary AST nodes.Manuel Klimek2012-10-241-0/+12
| | | | llvm-svn: 166567
* Implement hasParent()-matcher.Daniel Jasper2012-10-221-3/+6
| | | | llvm-svn: 166421
* First version of matchers for Types and TypeLocs.Daniel Jasper2012-10-171-4/+15
| | | | | Review: http://llvm-reviews.chandlerc.com/D47 llvm-svn: 166094
* Fix isDerivedFrom matcher.Daniel Jasper2012-09-181-0/+1
| | | | | | | | | | | | | Without this patch, the isDerivedFrom matcher asserts in the "assert(ClassDecl != NULL);" in the new test, as a DependentTemplateSpecilizationType is not a sub-type of TemplateSpecializationType and also does not offer getAsCXXRecordDecl(). I am not sure why this did not cause problems before. It is now (after the changed implementation of isDerivedFrom) easier to write a matcher that actually gets into this branch of the code. llvm-svn: 164127
* Create initial support for matching and binding NestedNameSpecifier(Loc)s.Daniel Jasper2012-09-131-0/+29
| | | | | Review: http://llvm-reviews.chandlerc.com/D39 llvm-svn: 163794
* Change the behavior of the isDerivedFrom-matcher to not match on theDaniel Jasper2012-09-071-6/+6
| | | | | | | | | | | | class itself. This caused some confusion (intuitively, a class is not derived from itself) and makes it hard to write certain matchers, e.g. "match and bind any pair of base and subclass". The original behavior can be achieved with a new isA-matcher. Similar to all other matchers, this matcher has the same behavior and name as the corresponding AST-entity - in this case the isa<>() function. llvm-svn: 163385
* Implements hasAncestor.Manuel Klimek2012-09-071-0/+87
| | | | | | | | | | | | | | | | | | | | | | Implements the hasAncestor matcher. This builds on the previous patch that introduced DynTypedNode to build up a parent map for an additional degree of freedom in the AST traversal. The map is only built once we hit an hasAncestor matcher, in order to not slow down matching for cases where this is not needed. We could implement some speed-ups for special cases, like building up the parent map as we go and only building up the full map if we break out of the already visited part of the tree, but that is probably not going to be worth it, and would make the code significantly more complex. Major TODOs are: - implement hasParent - implement type traversal - implement memoization in hasAncestor llvm-svn: 163382
* Introduces DynTypedMatcher as a new concept that replaces the ↵Manuel Klimek2012-09-051-67/+65
| | | | | | | | | | | | | | | | | | | | | | | UntypedBaseMatcher and TypedMatcher. Due to DynTypedNode the basic dynamically typed matcher interface can now be simplified. Also switches the traversal interfaces to use DynTypedNode; this is in preperation for the hasAncestor implementation, and also allows us to need fewer changes when we want to add new nodes to traverse, thus making the code a little more decoupled. Main design concerns: I went back towards the original design of getNodeAs to return a pointer, and switched DynTypedNode::get to always return a pointer (in case of value types like QualType the pointer points into the storage of DynTypedNode, thus allowing us to treat all the nodes the same from the point of view of a user of the DynTypedNodes. Adding the QualType implementation for DynTypedNode was needed for the recursive traversal interface changes. llvm-svn: 163212
* Fix for ASTMatchFinder to visit a functions parameter declarations.Daniel Jasper2012-07-301-1/+2
| | | | llvm-svn: 160947
* Make the isDerivedFrom matcher more generic.Daniel Jasper2012-07-171-37/+27
| | | | | | | It now accepts an arbitrary inner matcher but is fully backwards compatible. llvm-svn: 160348
* Add more matchers and do cleanups.Daniel Jasper2012-07-101-60/+60
| | | | | | | | 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/+556
matches on interesting parts of the AST, and callback mechanisms to act on them. llvm-svn: 159805
OpenPOWER on IntegriCloud