summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-11-21 12:47:43 +0000
committerNico Weber <nicolasweber@gmx.de>2018-11-21 12:47:43 +0000
commit9f0246d47390775ec3bf2c2b7e4ded3d26193468 (patch)
treeb04d1324ec67a7b17d8824779c13deb94dac2812 /clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
parent4923930be5367488be818168916ad94dc878bb59 (diff)
downloadbcm5719-llvm-9f0246d47390775ec3bf2c2b7e4ded3d26193468.tar.gz
bcm5719-llvm-9f0246d47390775ec3bf2c2b7e4ded3d26193468.zip
Revert r347364 again, the fix was incomplete.
llvm-svn: 347389
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
index 4e45a37fd89..fc2ab1d6e3f 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
@@ -135,9 +135,9 @@ private:
bool isIntZeroExpr(const Expr *E) const {
if (!E->getType()->isIntegralOrEnumerationType())
return false;
- Expr::EvalResult Result;
+ llvm::APSInt Result;
if (E->EvaluateAsInt(Result, Context))
- return Result.Val.getInt() == 0;
+ return Result == 0;
return false;
}
@@ -191,11 +191,8 @@ private:
if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(rhse)) {
if (BOp->getOpcode() == BO_Div) {
const Expr *denom = BOp->getRHS()->IgnoreParenImpCasts();
- Expr::EvalResult Result;
- if (denom->EvaluateAsInt(Result, Context)) {
- denomVal = Result.Val.getInt();
+ if (denom->EvaluateAsInt(denomVal, Context))
denomKnown = true;
- }
const Expr *numerator = BOp->getLHS()->IgnoreParenImpCasts();
if (numerator->isEvaluatable(Context))
numeratorKnown = true;
OpenPOWER on IntegriCloud