Add PostStore, a new ProgramPoint to distinguish between 'stores' and other PostStmts.

GRExprEngine:
  Use PostStore in EvalStore.
  Use a second version of EvalStore in EvalBinaryOperator to associate the store with the expression on the LHS.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56383 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 423c485..f39b595 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -928,9 +928,11 @@
   unsigned size = Dst.size();  
 
   SaveAndRestore<bool> OldSink(Builder->BuildSinks);
+  SaveAndRestore<ProgramPoint::Kind> OldSPointKind(Builder->PointKind);
   SaveOr OldHasGen(Builder->HasGeneratedNode);
 
   assert (!location.isUndef());
+  Builder->PointKind = ProgramPoint::PostStoreKind;
   
   getTF().EvalStore(Dst, *this, *Builder, Ex, Pred, St, location, Val);
   
@@ -973,6 +975,16 @@
                                                     Ex->getType())), K);  
 }
 
+void GRExprEngine::EvalStore(NodeSet& Dst, Expr* Ex, Expr* StoreE, NodeTy* Pred,
+                             const GRState* St, RVal location, RVal Val) {
+ 
+  NodeSet TmpDst;
+  EvalStore(TmpDst, StoreE, Pred, St, location, Val);
+
+  for (NodeSet::iterator I=TmpDst.begin(), E=TmpDst.end(); I!=E; ++I)
+    MakeNode(Dst, Ex, *I, (*I)->getState());
+}
+
 const GRState* GRExprEngine::EvalLocation(Expr* Ex, NodeTy* Pred,
                                              const GRState* St,
                                              RVal location, bool isLoad) {
@@ -2001,7 +2013,7 @@
           // Simulate the effects of a "store":  bind the value of the RHS
           // to the L-Value represented by the LHS.
           
-          EvalStore(Dst, B, *I2, SetRVal(St, B, RightV), LeftV, RightV);          
+          EvalStore(Dst, B, LHS, *I2, SetRVal(St, B, RightV), LeftV, RightV);          
           continue;
         }
           
@@ -2071,13 +2083,13 @@
 
         // Propagate undefined values (left-side).          
         if (V.isUndef()) {
-          EvalStore(Dst, B, *I3, SetRVal(St, B, V), location, V);
+          EvalStore(Dst, B, LHS, *I3, SetRVal(St, B, V), location, V);
           continue;
         }
         
         // Propagate unknown values (left and right-side).
         if (RightV.isUnknown() || V.isUnknown()) {
-          EvalStore(Dst, B, *I3, SetRVal(St, B, UnknownVal()), location,
+          EvalStore(Dst, B, LHS, *I3, SetRVal(St, B, UnknownVal()), location,
                     UnknownVal());
           continue;
         }
@@ -2102,11 +2114,9 @@
           if (CheckDivideZero(B, St, *I3, RightV))
             continue;
         }
-        else if (RightV.isUndef()) {
-            
-          // Propagate undefined values (right-side).
-          
-          EvalStore(Dst, B, *I3, SetRVal(St, B, RightV), location, RightV);
+        else if (RightV.isUndef()) {            
+          // Propagate undefined values (right-side).          
+          EvalStore(Dst, B, LHS, *I3, SetRVal(St, B, RightV), location, RightV);
           continue;
         }
       
@@ -2126,7 +2136,7 @@
           continue;
         }
  
-        EvalStore(Dst, B, *I3, SetRVal(St, B, Result), location, Result);
+        EvalStore(Dst, B, LHS, *I3, SetRVal(St, B, Result), location, Result);
       }
     }
   }