[PATCH] [clang-tidy] Add a checker for long functions.

Benjamin Kramer benny.kra at gmail.com
Mon Sep 15 05:56:59 PDT 2014


================
Comment at: test/clang-tidy/misc-function-size.cpp:53
@@ +52,3 @@
+
+void bar2() { class A { void x() {} }; }
+// CHECK: warning: function 'bar2' exceeds recommended size/complexity thresholds
----------------
alexfh wrote:
> For the lambda above the check seems to only warn on the function itself, but not on the lambda. I wonder what happens if you add statements inside the x() method. Will the warning only fire for bar2() or for both? I don't know which behavior is better, but it would be good to know what it does currently.
We do not warn on lambdas currently but add the statements to the number of the surrounding function. For local classes we emit a warning for the function AND add the statements to the surrounding function.

http://reviews.llvm.org/D4986






More information about the cfe-commits mailing list