Filter the toplevel matchers by kind.
Decl and Stmt matchers are tied to a specific node kind and trying to
match incompatible nodes is a waste.
Precalculate a filtered list of matchers that have a chance of matching
the node and ignore the rest.
Speeds up our clang-tidy benchmark by ~10%
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
393–395 ↗ | (On Diff #16506) | Is all that whitespace intentional? |
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
292–295 ↗ | (On Diff #16506) | Either \c both false and true, or none :) |
309–311 ↗ | (On Diff #16506) | I'd spend the extra 6 characters and call it matchesWithoutKindCheck. |
lib/ASTMatchers/ASTMatchersInternal.cpp | ||
187–191 ↗ | (On Diff #16506) | Shouldn't every matcher already do that? |
Minor fixes
include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
393–395 ↗ | (On Diff #16506) | Not really. Fixed. |
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
292–295 ↗ | (On Diff #16506) | \c ALL the keywords! |
309–311 ↗ | (On Diff #16506) | What about SkipKindCheck ? |
lib/ASTMatchers/ASTMatchersInternal.cpp | ||
187–191 ↗ | (On Diff #16506) | Do what? Delete the bindings? I pretty much copied matches() and modified it. That stayed the same. |
LG (as the only question I have is basically unrelated to this patch), but I'd still like to get to the bottom of the question...
lib/ASTMatchers/ASTMatchersInternal.cpp | ||
---|---|---|
187–191 ↗ | (On Diff #16506) | Hm, curious - does that actually make a difference in any test if we remove it (both here and in matches)? |
lib/ASTMatchers/ASTMatchersInternal.cpp | ||
---|---|---|
187–191 ↗ | (On Diff #16506) | Removing this doesn't affect the tests. |