summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/FunctionSizeCheck.h
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Switch checks to #include "ClangTidyCheck.h"Alexander Kornienko2019-03-251-1/+1
| | | | llvm-svn: 356892
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clang-tidy] readability-function-size: add VariableThreshold param.Roman Lebedev2018-04-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Pretty straight-forward, just count all the variable declarations in the function's body, and if more than the configured threshold - do complain. Note that this continues perverse practice of disabling the new option by default. I'm not certain where is the balance point between not being too noisy, and actually enforcing the good practice. If we really want to not disable this by default, but also to not cause too many new warnings, we could default to 50 or so. But that is a lot of variables too... I was able to find one coding style referencing variable count: - https://www.kernel.org/doc/html/v4.15/process/coding-style.html#functions > Another measure of the function is the number of local variables. They shouldn’t exceed 5-10, or you’re doing something wrong. Reviewers: hokein, xazax.hun, JonasToth, aaron.ballman, alexfh Reviewed By: aaron.ballman Subscribers: kimgr, Eugene.Zelenko, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D44602 llvm-svn: 329902
* [clang-tidy] readability-function-size: add NestingThreshold param.Roman Lebedev2017-06-091-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds compound statements which create next nesting level after `NestingThreshold` and emits a warning. Do note that it warns about each compound statement that breaches the threshold, but not any of it's sub-statements, to have readable warnings. I was able to find only one coding style referencing nesting: - https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation > In short, 8-char indents make things easier to read, and have the added benefit of warning you when you’re nesting your functions too deep. This seems too basic, i'm not sure what else to test. Are more tests needed? Reviewers: alexfh, aaron.ballman, sbenza Reviewed By: alexfh, aaron.ballman Subscribers: xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32942 llvm-svn: 305082
* [clang-tidy] Add parametercount for readibility-function-sizeAlexander Kornienko2017-03-011-0/+3
| | | | | | | | | | | | | | | | | | | Summary: Add an option to function-size to warn about high parameter counts. This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well. Reviewers: sbenza, alexfh, hokein Reviewed By: alexfh, hokein Subscribers: JDevlieghere Patch by Jonas Toth! Differential Revision: https://reviews.llvm.org/D29561 llvm-svn: 296599
* Speed up check by using a recursive visitor.Samuel Benzaquen2016-05-251-10/+0
| | | | | | | | | | | | | | | | Summary: Use a recursive visitor instead of forEachDescendant() matcher. The latter requires several layers of virtual function calls for each node and it is more expensive than the visitor. Benchmark results show improvement of ~6% walltime in clang-tidy. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20597 llvm-svn: 270714
* [clang-tidy] Update docs for clang-tidy checks. NFCAlexander Kornienko2015-08-271-1/+11
| | | | | | | | | | | Changes mostly address formatting and unification of the style. Use MarkDown style for inline code snippets and lists. Added some text for a few checks. The idea is to move most of the documentation out to separate rST files and have implementation files refer to the corresponding documentation files. llvm-svn: 246169
* [clang-tidy] Refactor: Rename clang-tidy readability check files and classes ↵Alexander Kornienko2015-03-091-0/+48
to follow naming conventions Classes are named WhateverCheck, files are WhateverCheck.cpp and` WhateverCheck.h` http://reviews.llvm.org/D8144 Patch by Richard Thomson! llvm-svn: 231650
OpenPOWER on IntegriCloud