diff options
author | Fangrui Song <maskray@google.com> | 2018-11-30 21:26:09 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-11-30 21:26:09 +0000 |
commit | f5d3335d75dfe13b1263bbc305514ccfbc25417d (patch) | |
tree | 109c58b9f8af11bcec6b2b974867c9f7d07729af /clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp | |
parent | d1a4b06c208c177a4a86c4c8ec994ca4fd44870e (diff) | |
download | bcm5719-llvm-f5d3335d75dfe13b1263bbc305514ccfbc25417d.tar.gz bcm5719-llvm-f5d3335d75dfe13b1263bbc305514ccfbc25417d.zip |
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp
while we are investigating why the following snippet fails:
extern char extern_var;
struct { int a; } a = {__builtin_constant_p(extern_var)};
llvm-svn: 348039
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; |