summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-12-28 19:48:30 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-12-28 19:48:30 +0000
commit5fab0c9e1ad172c0db6cc9f3169666e49b7864b6 (patch)
treea5682a764875540c534db1a6460792d4a599c6a3 /clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
parente4a84c4f1f17a1e9b7f0e9a75f9d8ee1824feb33 (diff)
downloadbcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.tar.gz
bcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.zip
Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change. llvm-svn: 147318
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
index fadfdc40d74..83bc39e1fde 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -482,9 +482,8 @@ void ExprEngine::
VisitOffsetOfExpr(const OffsetOfExpr *OOE,
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
StmtNodeBuilder B(Pred, Dst, *currentBuilderContext);
- Expr::EvalResult Res;
- if (OOE->EvaluateAsRValue(Res, getContext()) && Res.Val.isInt()) {
- const APSInt &IV = Res.Val.getInt();
+ APSInt IV;
+ if (OOE->EvaluateAsInt(IV, getContext())) {
assert(IV.getBitWidth() == getContext().getTypeSize(OOE->getType()));
assert(OOE->getType()->isIntegerType());
assert(IV.isSigned() == OOE->getType()->isSignedIntegerOrEnumerationType());
@@ -519,9 +518,8 @@ VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Ex,
}
}
- Expr::EvalResult Result;
- Ex->EvaluateAsRValue(Result, getContext());
- CharUnits amt = CharUnits::fromQuantity(Result.Val.getInt().getZExtValue());
+ APSInt Value = Ex->EvaluateKnownConstInt(getContext());
+ CharUnits amt = CharUnits::fromQuantity(Value.getZExtValue());
const ProgramState *state = Pred->getState();
state = state->BindExpr(Ex, svalBuilder.makeIntVal(amt.getQuantity(),
OpenPOWER on IntegriCloud