aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index c01c973cf5..8aaea7ac9f 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -763,9 +763,11 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
// If this is a call to a builtin function, constant fold it otherwise
// reject it.
if (CE->isBuiltinCall()) {
- APValue ResultAP;
- if (CE->Evaluate(ResultAP, Ctx)) {
- Result = ResultAP.getInt();
+ EvalResult EvalResult;
+ if (CE->Evaluate(EvalResult, Ctx)) {
+ assert(!EvalResult.HasSideEffects &&
+ "Foldable builtin call should not have side effects!");
+ Result = EvalResult.Val.getInt();
break; // It is a constant, expand it.
}
}