Get rid of the old Expr::Evaluate variant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61260 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6c1af5f..86af210 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1888,8 +1888,9 @@
     // should always be able to do in theory).  If so, we only require the
     // specified arm of the conditional to be a constant.  This is a horrible
     // hack, but is require by real world code that uses __builtin_constant_p.
-    APValue Val;
-    if (!Exp->getCond()->Evaluate(Val, Context)) {
+    Expr::EvalResult EvalResult;
+    if (!Exp->getCond()->Evaluate(EvalResult, Context) || 
+        EvalResult.HasSideEffects) {
       // If Evaluate couldn't fold it, CheckArithmeticConstantExpression
       // won't be able to either.  Use it to emit the diagnostic though.
       bool Res = CheckArithmeticConstantExpression(Exp->getCond());
@@ -1899,7 +1900,7 @@
     
     // Verify that the side following the condition is also a constant.
     const Expr *TrueSide = Exp->getLHS(), *FalseSide = Exp->getRHS();
-    if (Val.getInt() == 0) 
+    if (EvalResult.Val.getInt() == 0) 
       std::swap(TrueSide, FalseSide);
     
     if (TrueSide && CheckArithmeticConstantExpression(TrueSide))
@@ -2717,13 +2718,13 @@
   const VariableArrayType* VLATy = dyn_cast<VariableArrayType>(T);
   if (!VLATy) return QualType();
   
-  APValue Result;
+  Expr::EvalResult EvalResult;
   if (!VLATy->getSizeExpr() ||
-      !VLATy->getSizeExpr()->Evaluate(Result, Context))
+      !VLATy->getSizeExpr()->Evaluate(EvalResult, Context))
     return QualType();
     
-  assert(Result.isInt() && "Size expressions must be integers!");
-  llvm::APSInt &Res = Result.getInt();
+  assert(EvalResult.Val.isInt() && "Size expressions must be integers!");
+  llvm::APSInt &Res = EvalResult.Val.getInt();
   if (Res > llvm::APSInt(Res.getBitWidth(), Res.isUnsigned()))
     return Context.getConstantArrayType(VLATy->getElementType(),
                                         Res, ArrayType::Normal, 0);