This revision was automatically updated to reflect the committed changes.
Closed by commit rL310589: [clang-tidy] Add integer division check (authored by
xazax).
Changed prior to commit:
https://reviews.llvm.org/D35932?vs=110539&id=110570#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
LG
https://reviews.llvm.org/D35932
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com
rnkovacs updated this revision to Diff 110539.
rnkovacs marked 3 inline comments as done.
rnkovacs edited the summary of this revision.
rnkovacs added a comment.
Thanks for the comments. I improved the docs and truncated the messages in the
test file.
We also had concerns about the nested `hasAn
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.
A few more nits.
Comment at: clang-tidy/bugprone/IntegerDivisionCheck.cpp:40-44
+ hasAncestor(
+ castExpr(hasCastKind(CK_IntegralToFloating)).
rnkovacs updated this revision to Diff 109497.
rnkovacs edited the summary of this revision.
rnkovacs added a comment.
Uploaded a more thought-out version of the check with more cases covered and
hopefully clearer docs. It produces no hits on LLVM&Clang.
https://reviews.llvm.org/D35932
Files:
rnkovacs added a comment.
I run the check on LLVM-Clang, and got this one hit:
/home/reka/codechecker_dev_env/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:1000:43:
warning: integer division; possible precision loss [bugprone-integer-division]
SDValue TWOHW = DAG.getConstantFP(1 <<
rnkovacs updated this revision to Diff 108605.
rnkovacs edited the summary of this revision.
https://reviews.llvm.org/D35932
Files:
clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tidy/bugprone/CMakeLists.txt
clang-tidy/bugprone/IntegerDivisionCheck.cpp
clang-tidy/bugprone/IntegerDivisio
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.
Could you run the check over LLVM+Clang code and post a summary of results here?
https://reviews.llvm.org/D35932
___
cfe-commits mailin
alexfh added inline comments.
Comment at: docs/clang-tidy/checks/bugprone-integer-division.rst:21-24
+ // Do not warn, there are signs of deliberateness.
+ sin(abs(3) / 5);
+ sin(1 + abs(1 + 7 / 2));
+ 1 << 2 / 3;
I'd argue that the presence of `abs` here doe
rnkovacs created this revision.
rnkovacs added a project: clang-tools-extra.
Herald added subscribers: baloghadamsoftware, JDevlieghere, mgorny.
Finds integer divisions in environments expecting floating-point values.
Examples of possibly unintended precision loss:
sin(7 / (2 + 3));
abs(sin(
10 matches
Mail list logo