[clang-tools-extra] r268430 - [clang-tidy] Speedup misc-static-assert.
Samuel Benzaquen via cfe-commits
cfe-commits at lists.llvm.org
Tue May 3 13:11:09 PDT 2016
Author: sbenza
Date: Tue May 3 15:11:09 2016
New Revision: 268430
URL: http://llvm.org/viewvc/llvm-project?rev=268430&view=rev
Log:
[clang-tidy] Speedup misc-static-assert.
Summary:
Speedup the misc-static-assert check by not use `stmt()` as the toplevel matcher.
The framework runs a filter on the matchers before trying them on each node and
uses the toplevel type for this.
Using `stmt()` as the toplevel causes the matcher to be run on every `Stmt` node,
even if the node doesn't match the desired types.
This change speeds up clang-tidy by ~5% in a benchmark.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19877
Modified:
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp?rev=268430&r1=268429&r2=268430&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp Tue May 3 15:11:09 2016
@@ -63,11 +63,15 @@ void StaticAssertCheck::registerMatchers
hasArgument(0, AssertCondition))),
AssertCondition);
- Finder->addMatcher(stmt(anyOf(conditionalOperator(hasCondition(Condition)),
- ifStmt(hasCondition(Condition))),
- unless(isInTemplateInstantiation()))
+ Finder->addMatcher(conditionalOperator(hasCondition(Condition),
+ unless(isInTemplateInstantiation()))
.bind("condStmt"),
this);
+
+ Finder->addMatcher(
+ ifStmt(hasCondition(Condition), unless(isInTemplateInstantiation()))
+ .bind("condStmt"),
+ this);
}
void StaticAssertCheck::check(const MatchFinder::MatchResult &Result) {
More information about the cfe-commits
mailing list