Update some isIntegerConstantExpr uses to use
  getIntegerConstantExprValue where appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54771 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 643d475..7ff4ae9 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -370,11 +370,8 @@
   if (const Expr *BitWidthExpr = FD->getBitWidth()) {
     // TODO: Need to check this algorithm on other targets!
     //       (tested on Linux-X86)
-    llvm::APSInt I(32);
-    bool BitWidthIsICE = 
-      BitWidthExpr->isIntegerConstantExpr(I, Context);
-    assert (BitWidthIsICE  && "Invalid BitField size expression");
-    FieldSize = I.getZExtValue();
+    FieldSize = 
+      BitWidthExpr->getIntegerConstantExprValue(Context).getZExtValue();
     
     std::pair<uint64_t, unsigned> FieldInfo = 
       Context.getTypeInfo(FD->getType());
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 5fc7cf2..e78c359 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1195,10 +1195,7 @@
 }
 
 bool ChooseExpr::isConditionTrue(ASTContext &C) const {
-  llvm::APSInt CondVal(32);
-  bool IsConst = getCond()->isIntegerConstantExpr(CondVal, C);
-  assert(IsConst && "Condition of choose expr must be i-c-e"); IsConst=IsConst;
-  return CondVal != 0;
+  return getCond()->getIntegerConstantExprValue(C) != 0;
 }
 
 static int64_t evaluateOffsetOf(ASTContext& C, const Expr *E)
@@ -1220,12 +1217,9 @@
     return RL.getFieldOffset(i) + evaluateOffsetOf(C, ME->getBase());
   } else if (const ArraySubscriptExpr *ASE = dyn_cast<ArraySubscriptExpr>(E)) {
     const Expr *Base = ASE->getBase();
-    llvm::APSInt Idx(32);
-    bool ICE = ASE->getIdx()->isIntegerConstantExpr(Idx, C);
-    assert(ICE && "Array index is not a constant integer!");
     
     int64_t size = C.getTypeSize(ASE->getType());
-    size *= Idx.getSExtValue();
+    size *= ASE->getIdx()->getIntegerConstantExprValue(C).getSExtValue();
     
     return size + evaluateOffsetOf(C, Base);
   } else if (isa<CompoundLiteralExpr>(E))