]> granicus.if.org Git - clang/commit
Implements hasAncestor.
authorManuel Klimek <klimek@google.com>
Fri, 7 Sep 2012 09:26:10 +0000 (09:26 +0000)
committerManuel Klimek <klimek@google.com>
Fri, 7 Sep 2012 09:26:10 +0000 (09:26 +0000)
commit579b120038ca817e0ce423303ebc1b4e0c6cbbe1
tree03a0e5bacb65a6873ccf12b6afa4943faebf02bb
parent971073b8e4eb82fa1bae9d2b0d354f35a54099ee
Implements hasAncestor.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163382 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/ASTMatchers/ASTMatchers.h
include/clang/ASTMatchers/ASTMatchersInternal.h
lib/ASTMatchers/ASTMatchFinder.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp