From: Ted Kremenek Date: Thu, 5 Mar 2009 02:33:55 +0000 (+0000) Subject: Fix regression in transparent translation of nonloc::ConcreteInto to loc::ConcreteInt. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16aac3222898df04fa660765d1a3c96f163f1622;p=clang 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 --- 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(&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(&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.