[clang-tidy] update FunctionSizeCheck for D56444
authorSam McCall <sam.mccall@gmail.com>
Mon, 14 Jan 2019 10:40:41 +0000 (10:40 +0000)
committerSam McCall <sam.mccall@gmail.com>
Mon, 14 Jan 2019 10:40:41 +0000 (10:40 +0000)
Reviewers: JonasToth, aaron.ballman

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 351048

clang-tools-extra/clang-tidy/readability/FunctionSizeCheck.cpp

index 9547afb..4d91f2e 100644 (file)
@@ -145,7 +145,12 @@ void FunctionSizeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
 }
 
 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) {