[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 11 11:15:55 PST 2018
JonasToth added inline comments.
================
Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:138
+ bool cond = false;
+ for (short i = 0; i < (cond ? 0 : size); ++i) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than iteration's upper bound 'int' [bugprone-too-small-loop-variable]
----------------
Could you please add a test
```
for (short i = 0; i < (!cond ? size : 0); ++i) {
}
```
as well. Just to make sure the analysis does not depent on the type of the LHS. If it does, add a FIXME for later.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53974
More information about the cfe-commits
mailing list