diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-05 02:42:32 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-05 02:42:32 +0000 |
commit | eba836a4571a3bc9bf0cd0b03b442eb432b7621a (patch) | |
tree | 95fdc4fec607b8fcc5bccbf2adad4ed7f8943f39 /clang/lib | |
parent | cd1280b405af3f99746cccbf09d68364213aa320 (diff) | |
download | bcm5719-llvm-eba836a4571a3bc9bf0cd0b03b442eb432b7621a.tar.gz bcm5719-llvm-eba836a4571a3bc9bf0cd0b03b442eb432b7621a.zip |
GRExprEngine: Polish up handling of casting integer constants to pointers and back.
llvm-svn: 66127
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index 415bc3f88a1..24250166c2e 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -1720,8 +1720,14 @@ void GRExprEngine::VisitCastPointerToInteger(SVal V, const GRState* state, // 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. - unsigned bits = getContext().getTypeSize(PtrTy); - V = nonloc::LocAsInteger::Make(getBasicVals(), cast<Loc>(V), bits); + + 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); + } } MakeNode(Dst, CastE, Pred, BindExpr(state, CastE, V)); |