[clang-tools-extra] r351048 - [clang-tidy] update FunctionSizeCheck for D56444

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 14 02:40:41 PST 2019


Author: sammccall
Date: Mon Jan 14 02:40:41 2019
New Revision: 351048

URL: http://llvm.org/viewvc/llvm-project?rev=351048&view=rev
Log:
[clang-tidy] update FunctionSizeCheck for D56444

Reviewers: JonasToth, aaron.ballman

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D56552

Modified:
    clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp?rev=351048&r1=351047&r2=351048&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp Mon Jan 14 02:40:41 2019
@@ -145,7 +145,12 @@ void FunctionSizeCheck::storeOptions(Cla
 }
 
 void FunctionSizeCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("func"), this);
+  // Lambdas ignored - historically considered part of enclosing function.
+  // FIXME: include them instead? Top-level lambdas are currently never counted.
+  Finder->addMatcher(functionDecl(unless(isInstantiated()),
+                                  unless(cxxMethodDecl(ofClass(isLambda()))))
+                         .bind("func"),
+                     this);
 }
 
 void FunctionSizeCheck::check(const MatchFinder::MatchResult &Result) {




More information about the cfe-commits mailing list