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

Ted Kremenek kremenek at apple.com
Wed Mar 4 18:33:55 PST 2009


Author: kremenek
Date: Wed Mar  4 20:33:55 2009
New Revision: 66125

URL: http://llvm.org/viewvc/llvm-project?rev=66125&view=rev
Log:
Fix regression in transparent translation of nonloc::ConcreteInto to loc::ConcreteInt.

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=66125&r1=66124&r2=66125&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Mar  4 20:33:55 2009
@@ -1778,13 +1778,7 @@
       MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
       continue;
     }
-    
-    // Just pass through function and block pointers.
-    if (T->isBlockPointerType() || T->isFunctionPointerType()) {
-      MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
-      continue;
-    }
-  
+      
     // Check for casts from pointers to integers.
     if (T->isIntegerType() && Loc::IsLocType(ExTy)) {
       VisitCastPointerToInteger(V, state, ExTy, CastE, N, Dst);
@@ -1792,14 +1786,27 @@
     }
     
     // Check for casts from integers to pointers.
-    if (Loc::IsLocType(T) && ExTy->isIntegerType())
+    if (Loc::IsLocType(T) && ExTy->isIntegerType()) {
       if (nonloc::LocAsInteger *LV = dyn_cast<nonloc::LocAsInteger>(&V)) {
         // Just unpackage the lval and return it.
         V = LV->getLoc();
         MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
-        continue;
       }
-
+      else if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&V)) {
+        MakeNode(Dst, CastE, N,
+                 BindExpr(state, CastE, loc::ConcreteInt(CI->getValue())));
+      }
+      
+      continue;      
+    }
+    
+    // Just pass through function and block pointers.
+    if (ExTy->isBlockPointerType() || ExTy->isFunctionPointerType()) {
+      assert(Loc::IsLocType(T));
+      MakeNode(Dst, CastE, N, BindExpr(state, CastE, V));
+      continue;
+    }
+    
     // Check for casts from array type to another type.
     if (ExTy->isArrayType()) {
       // We will always decay to a pointer.





More information about the cfe-commits mailing list