[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
Sun Apr 7 05:25:26 PDT 2019
JonasToth accepted this revision.
JonasToth added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:33
+
+ Upper limit for the magnitue bits of the loop variable. If it's set the check
+ filters out those catches in which the loop variable's type has more magnitude
----------------
ztamas wrote:
> JonasToth wrote:
> > typo `magnitude`
> >
> > The commit you reference to the project fixing the "bugs" stated, that the version without conversions is more efficient (by one instruction :)). I think this might be worth a note, that even though the
> > code is not a bug in itself it might still be preferable to remove those code locations in the long run.
> Typo is fixed
>
> The referenced commit message mentions 32 bit system, where changing integer types was a bit faster. I'm not sure how general this is. I'm not familiar with the low level implementation of integer comparison, so I would not mention something, that I don't actually understand how it works.
I dont understand it either in detail, it sounded logical that you need to convert the different integer sizes first somehow, but I am fine with not mentioning it :)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59870/new/
https://reviews.llvm.org/D59870
More information about the cfe-commits
mailing list