]> granicus.if.org Git - clang/commitdiff
GRExprEngine: For places we might conjure up a new symbol to recover
authorTed Kremenek <kremenek@apple.com>
Wed, 11 Mar 2009 02:24:48 +0000 (02:24 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 11 Mar 2009 02:24:48 +0000 (02:24 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66627 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp

index 222ef173e8938f146c4d5460d54f9fd779d0899d..8bc84d4bf5291ca8ae9b9a29c8996911b0a1c17c 100644 (file)
@@ -1978,7 +1978,8 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst) {
       
       // 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 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
           // 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 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
           }
           
           // 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 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
         
         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();