[PATCH] D44602: [clang-tidy] readability-function-size: add VariableThreshold param.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 20 09:10:49 PDT 2018
aaron.ballman added inline comments.
================
Comment at: clang-tidy/readability/FunctionSizeCheck.cpp:30-31
+ bool VisitDecompositionDecl(DecompositionDecl *) {
+ // DecompositionDecl was already visited as VarDecl. Don't count it twice.
+ Info.Variables--;
+ return true;
----------------
This comment could be clarified. I think what it's trying to express is that the decomposition declaration was already counted as a variable declaration but we do not want to count it as such.
I think a better way to express this is to change `VisitVarDecl()` to check `isa<DecompositionDecl>()` and not increment in that case, rather than increment in one place and decrement in another. You could also check `isa<ParmVarDecl>()` at the same time and skip subtracting off formal parameters.
================
Comment at: docs/ReleaseNotes.rst:125
+
+ Flags functions that have more than this number of variables declared in the body.
+
----------------
I'd tweak slightly: Flags functions that have more than a specified number of variables declared in the body.
================
Comment at: docs/clang-tidy/checks/readability-function-size.rst:42
+
+ Flag functions exceeding this number of variables declared in the body.
+ The default is `-1` (ignore the number of variables).
----------------
This should clarify that parameters do not count as variables declared in the body.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D44602
More information about the cfe-commits
mailing list