forked from OSchip/llvm-project
Use memoization for has()-matcher.
In TUs with large classes, a matcher like methodDecl(ofClass(recordDecl(has(varDecl())))) (finding all member functions of classes with static variables) becomes unbearably slow otherwise. llvm-svn: 187115
This commit is contained in:
parent
5b463ceaf5
commit
abe2a36b7e
|
@ -419,8 +419,10 @@ public:
|
|||
BoundNodesTreeBuilder *Builder,
|
||||
TraversalKind Traversal,
|
||||
BindKind Bind) {
|
||||
return matchesRecursively(Node, Matcher, Builder, 1, Traversal,
|
||||
Bind);
|
||||
if (ResultCache.size() > MaxMemoizationEntries)
|
||||
ResultCache.clear();
|
||||
return memoizedMatchesRecursively(Node, Matcher, Builder, 1, Traversal,
|
||||
Bind);
|
||||
}
|
||||
// Implements ASTMatchFinder::matchesDescendantOf.
|
||||
virtual bool matchesDescendantOf(const ast_type_traits::DynTypedNode &Node,
|
||||
|
|
Loading…
Reference in New Issue