aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-05 02:33:55 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-05 02:33:55 +0000
commit16aac3222898df04fa660765d1a3c96f163f1622 (patch)
tree3114d7b2252739417a7cc4a3aba064e6cf6d9ea8
parent27b7f1028255149978356f85c4825522d234a253 (diff)
Fix regression in transparent translation of nonloc::ConcreteInto to loc::ConcreteInt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66125 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/GRExprEngine.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 3d577006f3..415bc3f88a 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1778,13 +1778,7 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
continue;
}
-
- // Just pass through function and block pointers.
- if (T->isBlockPointerType() || T->isFunctionPointerType()) {
- MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
- continue;
- }
-
+
// Check for casts from pointers to integers.
if (T->isIntegerType() && Loc::IsLocType(ExTy)) {
VisitCastPointerToInteger(V, state, ExTy, CastE, N, Dst);
@@ -1792,14 +1786,27 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
}
// Check for casts from integers to pointers.
- if (Loc::IsLocType(T) && ExTy->isIntegerType())
+ if (Loc::IsLocType(T) && ExTy->isIntegerType()) {
if (nonloc::LocAsInteger *LV = dyn_cast<nonloc::LocAsInteger>(&V)) {
// Just unpackage the lval and return it.
V = LV->getLoc();
MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
- continue;
}
-
+ else if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&V)) {
+ MakeNode(Dst, CastE, N,
+ BindExpr(state, CastE, loc::ConcreteInt(CI->getValue())));
+ }
+
+ continue;
+ }
+
+ // Just pass through function and block pointers.
+ if (ExTy->isBlockPointerType() || ExTy->isFunctionPointerType()) {
+ assert(Loc::IsLocType(T));
+ MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
+ continue;
+ }
+
// Check for casts from array type to another type.
if (ExTy->isArrayType()) {
// We will always decay to a pointer.