[PATCH] D31252: Clang-tidy: add readability-compound-statement-size check.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 12:34:00 PDT 2017


lebedev.ri created this revision.
lebedev.ri added a project: clang-tools-extra.
Herald added a subscriber: mgorny.

This check is quite similar to the readability-function-size
check. But it is more generic. It works for each compound
statement, excluding the ones directly related to the function,
i.e. it does not duplicate the readability-function-size output.

The rationale behind the check is the same as behind
readability-function-size check, it may make sense to be able
to control sizes of the compound statements, not just the
size of the functions.

Eventually, i would like these two checkers to be one, and
handle more cases and be more configurable, e.g. to be able to
apply such a check to the 'True' block of 'If' and so on.

But since this is my first attempt at any llvm/clang patch, 
this is what it is. Please do review carefully.


https://reviews.llvm.org/D31252

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/CompoundStatementSizeCheck.cpp
  clang-tidy/readability/CompoundStatementSizeCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-compound-statement-size.rst
  docs/clang-tidy/checks/readability-function-size.rst
  test/clang-tidy/readability-compound-statement-size.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31252.92678.patch
Type: text/x-patch
Size: 13921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170322/72926ef0/attachment-0001.bin>


More information about the cfe-commits mailing list