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 | efcfcc0e27ade4e0bb6626824f2bdc0a01bab32b (patch) | |
tree | 79dbd3f6d84ca6d3c780761e426adbcd684f7edd /lib/Analysis/GRExprEngine.cpp | |
parent | d9e0fae40a902ddbd4d53ef60ba7fb908788fe60 (diff) |
GRExprEngine: Polish up handling of casting integer constants to pointers and back.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 415bc3f88a..24250166c2 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/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)); |