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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits