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

Ted Kremenek kremenek at apple.com
Mon Aug 25 10:14:54 PDT 2014


> On Aug 25, 2014, at 3:59 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
> 
> It doesn't seem to be very common in C++ coding styles (probably due to lack of tools). I've seen warnings for this in other languages, e.g. Microsoft's C# analyzer puts an upper bound on cyclomatic complexity. It's yet another metric that seems slightly more useful than counting lines or statements.
> 
> I couldn't fully make up my mind about the static analyzer as its goals are slightly different. It tries hard to prune dead paths to avoid false positives while we still want to warn about complex functions that are mostly dead. Not sure if that matters in practice though.

It might be interesting to make cyclomatic complexity and similar metrics to be general internal APIs in libAnalysis, and build warnings and other things on top of those APIs.  We could then expose them in clang-tidy, the static analyzer, and libclang APIs.  The nice thing about exposing them in libclang APIs is that it opens the door for IDE tools to do interesting things with them as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140825/1706bb18/attachment.html>


More information about the cfe-commits mailing list