summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 5fc7cf25f3d..e78c3599f6f 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1195,10 +1195,7 @@ ObjCMessageExpr::ClassInfo ObjCMessageExpr::getClassInfo() const {
}
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 @@ static int64_t evaluateOffsetOf(ASTContext& C, const Expr *E)
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))
OpenPOWER on IntegriCloud