diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 00:50:52 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 00:50:52 +0000 |
| commit | 51f4708c00110940ca3f337961915f2ca1668375 (patch) | |
| tree | 8507a7dfb0f17042f2373b7fa309b00967283c2c /lib/CodeGen/CGExprScalar.cpp | |
| parent | 7800212ef29be314d55814e8dcc568ff8beed106 (diff) | |
| download | clang-51f4708c00110940ca3f337961915f2ca1668375.tar.gz clang-51f4708c00110940ca3f337961915f2ca1668375.tar.bz2 clang-51f4708c00110940ca3f337961915f2ca1668375.tar.xz | |
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
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 25b4a0a0e7..50c5057f3e 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -208,7 +208,7 @@ public: // 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::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { } 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::VisitUnaryLNot(const UnaryOperator *E) { 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 @@ ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( // 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()); } |
