]> granicus.if.org Git - clang/commitdiff
Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week...
authorTed Kremenek <kremenek@apple.com>
Wed, 16 Jul 2008 00:23:49 +0000 (00:23 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 16 Jul 2008 00:23:49 +0000 (00:23 +0000)
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

lib/Analysis/GRSimpleVals.cpp

index 562e5794b2fec9ee52033e21fc1b8c59da56c4e6..e3ba0f3c4abbf12638d19a5a4fbbe832e38b9957 100644 (file)
@@ -377,8 +377,10 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) {
   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 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) {
   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));