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

Alexander Kornienko alexfh at google.com
Wed Sep 3 08:48:13 PDT 2014


================
Comment at: unittests/clang-tidy/FunctionLengthCheckTest.cpp:1
@@ +1,2 @@
+#include "ClangTidyTest.h"
+#include "misc/FunctionLength.h"
----------------
alexfh wrote:
> It would be nice to test: multiple functions, lambdas, local classes/functions.
> 
> It would be nice to test: multiple functions, lambdas, local classes/functions.

What's with this?

================
Comment at: unittests/clang-tidy/FunctionLengthCheckTest.cpp:10
@@ +9,3 @@
+namespace {
+std::string getWarning(ClangTidyCheck &Check, StringRef Code) {
+  ClangTidyContext Context(
----------------
alexfh wrote:
> I'd make this function a bit more generic (e.g. return llvm::ErrorOr<std::vector<std::string>>) and move it to ClangTidyTest.h. Or maybe even extend runCheckOnCode.
> I'd make this function a bit more generic (e.g. return 
> llvm::ErrorOr<std::vector<std::string>>) and move it to ClangTidyTest.h. Or 
> maybe even extend runCheckOnCode.

So what's with this? And even more: wouldn't it be shorter/cleaner with lit-based tests?

http://reviews.llvm.org/D4986






More information about the cfe-commits mailing list