[clang-tools-extra] r303191 - [clang-tidy] Speed up performance-unnecessary-value-param check
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue May 16 10:28:17 PDT 2017
Author: alexfh
Date: Tue May 16 12:28:17 2017
New Revision: 303191
URL: http://llvm.org/viewvc/llvm-project?rev=303191&view=rev
Log:
[clang-tidy] Speed up performance-unnecessary-value-param check
Moved slower matchers closer to the end. The total speed up on a large file I
was interested in is not huge, just about 10%, since the check seems to be doing
a lot in the check() method.
Modified:
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=303191&r1=303190&r2=303191&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Tue May 16 12:28:17 2017
@@ -68,15 +68,14 @@ UnnecessaryValueParamCheck::UnnecessaryV
void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) {
const auto ExpensiveValueParamDecl =
- parmVarDecl(hasType(hasCanonicalType(allOf(matchers::isExpensiveToCopy(),
- unless(referenceType())))),
+ parmVarDecl(hasType(hasCanonicalType(allOf(
+ unless(referenceType()), matchers::isExpensiveToCopy()))),
decl().bind("param"));
Finder->addMatcher(
- functionDecl(hasBody(stmt()), isDefinition(),
+ functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
- unless(anyOf(isInstantiated(), isImplicit())),
has(typeLoc(forEach(ExpensiveValueParamDecl))),
- decl().bind("functionDecl")),
+ unless(isInstantiated()), decl().bind("functionDecl")),
this);
}
More information about the cfe-commits
mailing list