aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-05 03:42:31 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-05 03:42:31 +0000
commite121da4f81ffa3d484912ad314109c3af8a026f2 (patch)
treee5d4b4d2360abd8247838122a06870b07509aeba /lib/Analysis/GRExprEngine.cpp
parentb3b6b9b27ab8bdb2a435a5a92ce62e74e3399377 (diff)
More fixes in cast logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66130 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r--lib/Analysis/GRExprEngine.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 24250166c2..89ae70c090 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1719,18 +1719,12 @@ void GRExprEngine::VisitCastPointerToInteger(SVal V, const GRState* state,
if (!V.isUnknownOrUndef()) {
// FIXME: Determine if the number of bits of the target type is
// equal or exceeds the number of bits to store the pointer value.
- // If not, flag an error.
-
- if (loc::ConcreteInt *CI = dyn_cast<loc::ConcreteInt>(&V)) {
- V = nonloc::ConcreteInt(CI->getValue());
- }
- else {
- unsigned bits = getContext().getTypeSize(PtrTy);
- V = nonloc::LocAsInteger::Make(getBasicVals(), cast<Loc>(V), bits);
- }
+ // If not, flag an error.
+ MakeNode(Dst, CastE, Pred, BindExpr(state, CastE,
+ EvalCast(V, CastE->getType())));
}
-
- MakeNode(Dst, CastE, Pred, BindExpr(state, CastE, V));
+ else
+ MakeNode(Dst, CastE, Pred, BindExpr(state, CastE, V));
}
@@ -1798,10 +1792,9 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
V = LV->getLoc();
MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
}
- else if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&V)) {
- MakeNode(Dst, CastE, N,
- BindExpr(state, CastE, loc::ConcreteInt(CI->getValue())));
- }
+
+ MakeNode(Dst, CastE, N, BindExpr(state, CastE,
+ EvalCast(V, CastE->getType())));
continue;
}
@@ -2729,7 +2722,7 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
// Evaluate operands and promote to result type.
if (RightV.isUndef()) {
// Propagate undefined values (right-side).
- EvalStore(Dst,B, LHS, *I3, BindExpr(state, B, RightV), location,
+ EvalStore(Dst, B, LHS, *I3, BindExpr(state, B, RightV), location,
RightV);
continue;
}