[PATCH] D46081: [analyzer] Expand conversion check to check more expressions for overflow and underflow
George Karpenkov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 26 01:27:03 PDT 2018
george.karpenkov added a comment.
Looks reasonable. Have you tried on any large codebases? You relax two guards, so I would be wary of explosion in false positives.
================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:77
if (Opc == BO_Assign) {
- LossOfSign = isLossOfSign(Cast, C);
- LossOfPrecision = isLossOfPrecision(Cast, Cast->getType(), C);
+ if (!B->getRHS()->isIntegerConstantExpr(C.getASTContext())) {
+ LossOfSign = isLossOfSign(Cast, C);
----------------
Sorry, I don't quite follow: why we don't want to warn when RHS is an integer constant?
Repository:
rC Clang
https://reviews.llvm.org/D46081
More information about the cfe-commits
mailing list