Move logic of GRExprEngine::EvalBinOp to SValuator::EvalBinOp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80018 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index cfb9148..3abaf55 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1354,9 +1354,11 @@
     if (theValueVal.isUndef() || oldValueVal.isUndef()) {
       return false;      
     }
+    
+    SValuator &SVator = Engine.getSValuator();
         
     // Perform the comparison.
-    SVal Cmp = Engine.EvalBinOp(stateLoad, BinaryOperator::EQ, theValueVal,
+    SVal Cmp = SVator.EvalBinOp(stateLoad, BinaryOperator::EQ, theValueVal,
                                 oldValueVal, Engine.getContext().IntTy);
 
     const GRState *stateEqual = stateLoad->assume(Cmp, true);
@@ -1370,9 +1372,8 @@
       // Handle implicit value casts.
       if (const TypedRegion *R =
           dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
-        llvm::tie(state, val) =
-          Engine.getSValuator().EvalCast(val, state, R->getValueType(C),
-                                         newValueExpr->getType());
+        llvm::tie(state, val) = SVator.EvalCast(val, state, R->getValueType(C),
+                                                newValueExpr->getType());
       }      
       
       Engine.EvalStore(TmpStore, theValueExpr, N, stateEqual, location, 
@@ -3033,39 +3034,6 @@
 }
 
 //===----------------------------------------------------------------------===//
-// Transfer-function Helpers.
-//===----------------------------------------------------------------------===//
-
-SVal GRExprEngine::EvalBinOp(const GRState* state, BinaryOperator::Opcode Op, 
-                             SVal L, SVal R, QualType T) {
-  
-  if (L.isUndef() || R.isUndef())
-    return UndefinedVal();
-  
-  if (L.isUnknown() || R.isUnknown())
-    return UnknownVal();
-  
-  if (isa<Loc>(L)) {
-    if (isa<Loc>(R))
-      return SVator.EvalBinOpLL(Op, cast<Loc>(L), cast<Loc>(R), T);
-    else
-      return SVator.EvalBinOpLN(state, Op, cast<Loc>(L), cast<NonLoc>(R), T);
-  }
-  
-  if (isa<Loc>(R)) {
-    // Support pointer arithmetic where the increment/decrement operand
-    // is on the left and the pointer on the right.
-    
-    assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub);
-    
-    // Commute the operands.
-    return SVator.EvalBinOpLN(state, Op, cast<Loc>(R), cast<NonLoc>(L), T);
-  }
-  else
-    return SVator.EvalBinOpNN(Op, cast<NonLoc>(L), cast<NonLoc>(R), T);
-}
-
-//===----------------------------------------------------------------------===//
 // Visualization.
 //===----------------------------------------------------------------------===//