[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 2 10:45:38 PDT 2018


whisperity added inline comments.


================
Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:18
+This for loop is an infinite loop because the short type can't represent all
+values in the [0..size] interval.
+
----------------
Format the interval as code (monospace): `[0 .. size]`


================
Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:24
+
+    int doSometinhg(const std::vector& items) {
+        for (short i = 0; i < items.size(); ++i) {}
----------------
There is a typo in the function's name.


================
Comment at: test/clang-tidy/bugprone-too-small-loop-variable.cpp:116
+
+// TODO: handle those cases when the loop condition contains a floating point expression
+void voidDoubleForCond() {
----------------
(Misc: You might want to check out D52730 for floats later down the line.)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974





More information about the cfe-commits mailing list