[cfe-commits] r76481 - /cfe/trunk/lib/Analysis/SimpleSValuator.cpp

Ted Kremenek kremenek at apple.com
Mon Jul 20 14:39:27 PDT 2009


Author: kremenek
Date: Mon Jul 20 16:39:27 2009
New Revision: 76481

URL: http://llvm.org/viewvc/llvm-project?rev=76481&view=rev
Log:
Enhance SimpleSValuator to handle nonloc::LocAsInteger -> location casts.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/SimpleSValuator.cpp (original)
+++ cfe/trunk/lib/Analysis/SimpleSValuator.cpp Mon Jul 20 16:39:27 2009
@@ -44,11 +44,16 @@
 // Transfer function for Casts.
 //===----------------------------------------------------------------------===//
 
-SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) {  
+SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) {
+  
+  bool isLocType = Loc::IsLocType(castTy);
+  
+  if (isLocType)
+    if (nonloc::LocAsInteger *LI = dyn_cast<nonloc::LocAsInteger>(&val))
+      return LI->getLoc();
+  
   if (!isa<nonloc::ConcreteInt>(val))
     return UnknownVal();
-
-  bool isLocType = Loc::IsLocType(castTy);
   
   // Only handle casts from integers to integers.
   if (!isLocType && !castTy->isIntegerType())





More information about the cfe-commits mailing list