[PATCH] D34202: [clang-tidy] readability-function-size: fix nesting level calculation

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 09:22:47 PDT 2017


lebedev.ri added a comment.

In https://reviews.llvm.org/D34202#780394, @malcolm.parsons wrote:

> What do you expect for this?
>
>   if (true)
>       if (true)
>           if (true) {
>               int j;
>           }
>


that it is equivalent to

  if (true && true && true) { // 1
    int j;
  }

This was the intent of that option. There is only one compound statement in your example. All the docs say that it counts compound statements
https://github.com/llvm-mirror/clang-tools-extra/blob/9fd3636de8d7034ca4640939fefebd9833ef9ea0/docs/clang-tidy/checks/readability-function-size.rst

  .. option:: NestingThreshold
  
      Flag compound statements ...


Repository:
  rL LLVM

https://reviews.llvm.org/D34202





More information about the cfe-commits mailing list