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

Ted Kremenek kremenek at apple.com
Tue Mar 10 19:24:48 PDT 2009


Author: kremenek
Date: Tue Mar 10 21:24:48 2009
New Revision: 66627

URL: http://llvm.org/viewvc/llvm-project?rev=66627&view=rev
Log:
GRExprEngine: For places we might conjure up a new symbol to recover
path-sensitivity, beyond checking to see if the value is "unknown" also check if
the ConstraintManager can handle the SVal. This allows us to recover some
path-sensitivity by actually discarding some information.

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=66627&r1=66626&r2=66627&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Tue Mar 10 21:24:48 2009
@@ -1978,7 +1978,8 @@
       
       // Recover some path-sensitivity if a scalar value evaluated to
       // UnknownVal.
-      if (InitVal.isUnknown()) {
+      if (InitVal.isUnknown() || 
+          !getConstraintManager().canReasonAbout(InitVal)) {
         if (Loc::IsLocType(T)) {
           SymbolRef Sym = SymMgr.getConjuredSymbol(InitEx, Count);        
           InitVal = loc::SymbolVal(Sym);
@@ -2593,8 +2594,10 @@
           // FIXME: Handle structs.
           QualType T = RHS->getType();
           
-          if (RightV.isUnknown() && (Loc::IsLocType(T) || 
-                                  (T->isScalarType() && T->isIntegerType()))) {
+          if ((RightV.isUnknown() || 
+               !getConstraintManager().canReasonAbout(RightV))              
+              && (Loc::IsLocType(T) || 
+                  (T->isScalarType() && T->isIntegerType()))) {
             unsigned Count = Builder->getCurrentBlockCount();
             SymbolRef Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
             
@@ -2604,8 +2607,7 @@
           }
           
           // Simulate the effects of a "store":  bind the value of the RHS
-          // to the L-Value represented by the LHS.
-          
+          // to the L-Value represented by the LHS.          
           EvalStore(Dst, B, LHS, *I2, BindExpr(state, B, RightV), LeftV,
                     RightV);
           continue;
@@ -2760,8 +2762,10 @@
         
         SVal LHSVal;
         
-        if (Result.isUnknown() && (Loc::IsLocType(CTy) 
-                            || (CTy->isScalarType() && CTy->isIntegerType()))) {
+        if ((Result.isUnknown() || 
+             !getConstraintManager().canReasonAbout(Result))
+            && (Loc::IsLocType(CTy) 
+                || (CTy->isScalarType() && CTy->isIntegerType()))) {
           
           unsigned Count = Builder->getCurrentBlockCount();
           





More information about the cfe-commits mailing list