[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
Thu Mar 28 11:42:47 PDT 2019


JonasToth added a comment.

> I think it's the easiest way to specify the bits of the ineteger type to limit the catches. In real life, I met with this overflow / infinite loop problem with 16-bit short type, so I think the real use cases are 8 and 16 bit integers. It seems intuitive to me to use the size of the loop variable's type to separate those catches which can lead broken functionality in practice from those use cases which are just integer incompatibilities.

Given your experience and the false positive rate in some projects, should we maybe default to 16 for that option?


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

https://reviews.llvm.org/D59870





More information about the cfe-commits mailing list