Fix regression in transparent translation of nonloc::ConcreteInto to loc::ConcreteInt.

llvm-svn: 66125
This commit is contained in:
Ted Kremenek 2009-03-05 02:33:55 +00:00
parent 477f990ac5
commit 6c29a91c05
1 changed files with 17 additions and 10 deletions

View File

@ -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.