summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchFinder.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* First step towards adding a parent map to the ASTContext.Manuel Klimek2013-02-281-85/+6
| | | | | | | | | | | | This does not yet implement the LimitNode approach discussed. The impact of this is an O(n) in the number of nodes in the AST reduction of complexity for certain kinds of matchers (as otherwise the parent map gets recreated for every new MatchFinder). See FIXMEs in the comments for the direction of future work. llvm-svn: 176251
* Re-design the convenience interfaces on MatchFinder.Manuel Klimek2013-02-011-26/+23
| | | | | | | | | | | | First, this implements a match() method on MatchFinder; this allows us to get rid of the findAll implementation, as findAll is really a special case of recursive matchers on match. Instead of findAll, provide a convenience function match() that lets users iterate easily over the results instead of needing to implement callbacks. llvm-svn: 174172
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-4/+4
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Implements multiple parents in the parent map.Manuel Klimek2012-12-061-23/+48
| | | | | | | Previously we would match the last visited parent, which in the case of template instantiations was the last instantiated template. llvm-svn: 169508
* Fixes crash in isDerivedFrom for recursive templates.Manuel Klimek2012-12-041-1/+6
| | | | llvm-svn: 169262
* Allow matchers to access the ASTContext.Manuel Klimek2012-11-301-0/+3
| | | | | | Patch by Edwin Vane. llvm-svn: 169000
* Do not use data recursion in ASTMatchFinder.Daniel Jasper2012-11-151-0/+9
| | | | | | The matchers rely on the complete AST being traversed as shown by the new test cases. llvm-svn: 168022
* Fix AST-matcher descendant visiting for Types, TypeLocs and ↵Daniel Jasper2012-11-131-1/+7
| | | | | | | | NestedNamespecifierLocs. The RecursiveASTVisitor assumes that any given Traverse-method can be called with a NULL-node. So the subclass needs to handle these appropriately. llvm-svn: 167850
* 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