Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 25b4a0a..50c5057 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -208,7 +208,7 @@
// l-values.
Value *VisitDeclRefExpr(DeclRefExpr *E) {
Expr::EvalResult Result;
- if (!E->Evaluate(Result, CGF.getContext()))
+ if (!E->EvaluateAsRValue(Result, CGF.getContext()))
return EmitLoadOfLValue(E);
assert(!Result.HasSideEffects && "Constant declref with side-effect?!");
@@ -801,7 +801,7 @@
}
Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) {
Expr::EvalResult Result;
- if (E->Evaluate(Result, CGF.getContext()) && Result.Val.isInt()) {
+ if (E->EvaluateAsRValue(Result, CGF.getContext()) && Result.Val.isInt()) {
if (E->isArrow())
CGF.EmitScalarExpr(E->getBase());
else
@@ -1474,7 +1474,7 @@
Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) {
// Try folding the offsetof to a constant.
Expr::EvalResult EvalResult;
- if (E->Evaluate(EvalResult, CGF.getContext()))
+ if (E->EvaluateAsRValue(EvalResult, CGF.getContext()))
return Builder.getInt(EvalResult.Val.getInt());
// Loop over the components of the offsetof to compute the value.
@@ -1597,7 +1597,7 @@
// If this isn't sizeof(vla), the result must be constant; use the constant
// folding logic so we don't have to duplicate it here.
Expr::EvalResult Result;
- E->Evaluate(Result, CGF.getContext());
+ E->EvaluateAsRValue(Result, CGF.getContext());
return Builder.getInt(Result.Val.getInt());
}