diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-11-21 12:47:43 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-11-21 12:47:43 +0000 |
commit | 9f0246d47390775ec3bf2c2b7e4ded3d26193468 (patch) | |
tree | b04d1324ec67a7b17d8824779c13deb94dac2812 /clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp | |
parent | 4923930be5367488be818168916ad94dc878bb59 (diff) | |
download | bcm5719-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.cpp | 9 |
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; |