Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080714/006514.html.
The regression was the casts from integers to pointers where not being handled: they would just return UnknownVal. This would greatly decrease path-sensitivity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53659 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp
index 562e579..e3ba0f3 100644
--- a/lib/Analysis/GRSimpleVals.cpp
+++ b/lib/Analysis/GRSimpleVals.cpp
@@ -377,8 +377,10 @@
if (!isa<nonlval::ConcreteInt>(X))
return UnknownVal();
+ bool isLValType = LVal::IsLValType(T);
+
// Only handle casts from integers to integers.
- if (!T->isIntegerType())
+ if (!isLValType && !T->isIntegerType())
return UnknownVal();
BasicValueFactory& BasicVals = Eng.getBasicVals();
@@ -387,7 +389,7 @@
V.setIsUnsigned(T->isUnsignedIntegerType() || LVal::IsLValType(T));
V.extOrTrunc(Eng.getContext().getTypeSize(T));
- if (LVal::IsLValType(T))
+ if (isLValType)
return lval::ConcreteInt(BasicVals.getValue(V));
else
return nonlval::ConcreteInt(BasicVals.getValue(V));