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
Event Timeline
| include/clang/AST/ASTTypeTraits.h | ||
|---|---|---|
| 393–395 | Is all that whitespace intentional? | |
| include/clang/ASTMatchers/ASTMatchersInternal.h | ||
| 292–295 | Either \c both false and true, or none :) | |
| 309–311 | I'd spend the extra 6 characters and call it matchesWithoutKindCheck. | |
| lib/ASTMatchers/ASTMatchersInternal.cpp | ||
| 187–191 | Shouldn't every matcher already do that? | |
Minor fixes
| include/clang/AST/ASTTypeTraits.h | ||
|---|---|---|
| 393–395 | Not really. Fixed. | |
| include/clang/ASTMatchers/ASTMatchersInternal.h | ||
| 292–295 | \c ALL the keywords! | |
| 309–311 | What about SkipKindCheck ? | |
| lib/ASTMatchers/ASTMatchersInternal.cpp | ||
| 187–191 | 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 | 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 | Removing this doesn't affect the tests. | |
Is all that whitespace intentional?