diff options
author | Bill Wendling <isanbard@gmail.com> | 2018-11-20 23:24:16 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2018-11-20 23:24:16 +0000 |
commit | 91549ed15f97f21de8770196e66da3d228820cdc (patch) | |
tree | a4a3c5ffe121d9c0fdcce151e96eba612d3c7ded /clang/lib/StaticAnalyzer/Core | |
parent | 8eb65cb25e67a2b426b94152f9c9bb3c1025b701 (diff) | |
download | bcm5719-llvm-91549ed15f97f21de8770196e66da3d228820cdc.tar.gz bcm5719-llvm-91549ed15f97f21de8770196e66da3d228820cdc.zip |
Reinstate 347294 with a fix for the failures.
EvaluateAsInt() is sometimes called in a constant context. When that's the
case, we need to specify it as so.
llvm-svn: 347364
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 3 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 5 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 91f022d1e44..d001f4de940 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1283,9 +1283,6 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, break; case Expr::ConstantExprClass: - // Handled due to it being a wrapper class. - break; - case Stmt::ExprWithCleanupsClass: // Handled due to fully linearised CFG. break; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index fb13e89b5fa..7d47cf4f337 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -810,8 +810,9 @@ void ExprEngine:: VisitOffsetOfExpr(const OffsetOfExpr *OOE, ExplodedNode *Pred, ExplodedNodeSet &Dst) { StmtNodeBuilder B(Pred, Dst, *currBldrCtx); - APSInt IV; - if (OOE->EvaluateAsInt(IV, getContext())) { + Expr::EvalResult Result; + if (OOE->EvaluateAsInt(Result, getContext())) { + APSInt IV = Result.Val.getInt(); assert(IV.getBitWidth() == getContext().getTypeSize(OOE->getType())); assert(OOE->getType()->isBuiltinType()); assert(OOE->getType()->getAs<BuiltinType>()->isInteger()); diff --git a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp index ef3d5b76659..8c39b798946 100644 --- a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -362,9 +362,9 @@ Optional<SVal> SValBuilder::getConstantVal(const Expr *E) { return None; ASTContext &Ctx = getContext(); - llvm::APSInt Result; + Expr::EvalResult Result; if (E->EvaluateAsInt(Result, Ctx)) - return makeIntVal(Result); + return makeIntVal(Result.Val.getInt()); if (Loc::isLocType(E->getType())) if (E->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNotNull)) |