llvm-project/clang-tools-extra
Roman Lebedev eb6d821cda [clang-tidy] readability-function-size: fix nesting level calculation
Summary:
A followup for D32942.

Malcolm Parsons has provided a valid testcase that the initial version of the check complained about nested `if`'s.
As it turns out, the culprit is the **partially** un-intentional `switch` fallthrough.
So rewrite the NestingThreshold logic without ab-using+mis-using that switch with fallthrough, and add testcases with nested `if`' where there should be a warning and shouldn't be a warning. This results in a cleaner, simpler code, too.

I guess, now it would be actually possible to pick some reasonable default for `NestingThreshold` setting.

Fixes PR33454.

Reviewers: malcolm.parsons, alexfh

Reviewed By: malcolm.parsons

Subscribers: sbenza, xazax.hun, cfe-commits, aaron.ballman

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D34202

llvm-svn: 305554
2017-06-16 13:07:47 +00:00
..
change-namespace [change-namespace] avoid adding leading '::' when possible. 2017-03-21 12:41:59 +00:00
clang-apply-replacements Adjust SetVersionPrinter call for D33899 2017-06-06 21:54:45 +00:00
clang-move [clang-move] Find template class forward declarations more precisely. 2017-05-02 12:15:11 +00:00
clang-query modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00
clang-rename clang-rename: add new -force option 2017-06-02 09:32:28 +00:00
clang-reorder-fields [clang-rename] Fix handling of unchanged files 2016-09-17 17:08:47 +00:00
clang-tidy [clang-tidy] readability-function-size: fix nesting level calculation 2017-06-16 13:07:47 +00:00
clang-tidy-vs Remove 'misc-pointer-and-integral-operation' clang-tidy check. The only cases 2016-10-21 21:50:28 +00:00
clangd [clangd] Add priority to completion item sort text 2017-06-15 09:11:57 +00:00
docs [clang-tidy] readability-function-size: add NestingThreshold param. 2017-06-09 14:22:10 +00:00
include-fixer Recommit "[include-fixer] Don't throw exception when parsing unknown ar… …guments in vim script." 2017-05-17 14:13:59 +00:00
modularize Fix memory leak by using unique_ptr 2017-02-11 05:25:21 +00:00
pp-trace Update Append Argument to more efficiently traverse tokens 2017-06-15 00:27:23 +00:00
test [clang-tidy] readability-function-size: fix nesting level calculation 2017-06-16 13:07:47 +00:00
tool-template [clang-tools-extra] Format sources with clang-format. NFC. 2016-11-08 07:50:19 +00:00
unittests [clangd] Add a filename parameter to FileSystemProvider. 2017-06-14 09:46:44 +00:00
.arcconfig Upgrade all the .arcconfigs to https. 2016-07-14 13:15:37 +00:00
.gitignore
CMakeLists.txt Add a prototype for clangd 2017-02-07 10:28:20 +00:00
CODE_OWNERS.TXT Updating the code owners list. 2015-09-02 20:00:41 +00:00
LICENSE.TXT Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA. 2017-03-19 17:23:23 +00:00
README.txt Update references to new lists.llvm.org mailing lists. 2015-08-05 03:56:44 +00:00

README.txt

//===----------------------------------------------------------------------===//
// Clang Tools repository
//===----------------------------------------------------------------------===//

Welcome to the repository of extra Clang Tools.  This repository holds tools
that are developed as part of the LLVM compiler infrastructure project and the
Clang frontend.  These tools are kept in a separate "extra" repository to
allow lighter weight checkouts of the core Clang codebase.

This repository is only intended to be checked out inside of a full LLVM+Clang
tree, and in the 'tools/extra' subdirectory of the Clang checkout.

All discussion regarding Clang, Clang-based tools, and code in this repository
should be held using the standard Clang mailing lists:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

Code review for this tree should take place on the standard Clang patch and
commit lists:
  http://lists.llvm.org/mailman/listinfo/cfe-commits

If you find a bug in these tools, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/