Implements memoization for ancestor matching.
authorManuel Klimek <klimek@google.com>
Thu, 14 Mar 2013 16:33:21 +0000 (16:33 +0000)
committerManuel Klimek <klimek@google.com>
Thu, 14 Mar 2013 16:33:21 +0000 (16:33 +0000)
commitb64d6b7fee5168c69f83c6f1eb8ac445987c8c17
tree66dc1b7c8df2fa49b67ae553d9912c261cf51669
parentdd8ed854a0790af0abd12e0f4b0d61bb58b06eda
Implements memoization for ancestor matching.

This yields a log(#ast_nodes) worst-case improvement with matchers like
stmt(unless(hasAncestor(...))).

Also made the order of visitation for ancestor matches BFS, as the most
common use cases (for example finding the closest enclosing function
definition) rely on that.

llvm-svn: 177081
clang/lib/ASTMatchers/ASTMatchFinder.cpp
clang/unittests/ASTMatchers/ASTMatchersTest.cpp