[PATCH] D59870: [clang-tidy] Add MagnitudeBitsUpperLimit option to bugprone-too-small-loop-variable

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 09:33:07 PDT 2019


JonasToth added a comment.

I think in general this is a good direction. What do you think about other heuristics?
E.g. one could say that a vector will not contain more then X GB or similar. That is probably more complicated to figure out though.



================
Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:44
+    long size = 294967296l;
+    for (unsigned i = 0; i < size; ++i) {} // no warning
+    for (int i = 0; i < size; ++i) {} // warning
----------------
no warning for which value? 31? Please make that explicit in the doc.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59870/new/

https://reviews.llvm.org/D59870





More information about the cfe-commits mailing list