[cfe-commits] r66130 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Wed Mar 4 19:42:31 PST 2009


Author: kremenek
Date: Wed Mar  4 21:42:31 2009
New Revision: 66130

URL: http://llvm.org/viewvc/llvm-project?rev=66130&view=rev
Log:
More fixes in cast logic.

Modified:
    cfe/trunk/lib/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=66130&r1=66129&r2=66130&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Mar  4 21:42:31 2009
@@ -1719,18 +1719,12 @@
   if (!V.isUnknownOrUndef()) {
     // 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.
-    
-    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);
-    }
+    // If not, flag an error.    
+    MakeNode(Dst, CastE, Pred, BindExpr(state, CastE,
+                                        EvalCast(V, CastE->getType())));
   }
-  
-  MakeNode(Dst, CastE, Pred, BindExpr(state, CastE, V));
+  else  
+    MakeNode(Dst, CastE, Pred, BindExpr(state, CastE, V));
 }
 
   
@@ -1798,10 +1792,9 @@
         V = LV->getLoc();
         MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
       }
-      else if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&V)) {
-        MakeNode(Dst, CastE, N,
-                 BindExpr(state, CastE, loc::ConcreteInt(CI->getValue())));
-      }
+      
+      MakeNode(Dst, CastE, N, BindExpr(state, CastE,
+                                       EvalCast(V, CastE->getType())));
       
       continue;      
     }
@@ -2729,7 +2722,7 @@
         // Evaluate operands and promote to result type.                    
         if (RightV.isUndef()) {            
           // Propagate undefined values (right-side).          
-          EvalStore(Dst,B, LHS, *I3, BindExpr(state, B, RightV), location,
+          EvalStore(Dst, B, LHS, *I3, BindExpr(state, B, RightV), location,
                     RightV);
           continue;
         }





More information about the cfe-commits mailing list