diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-15 18:41:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-15 18:41:54 +0000 |
commit | 31e225cc90cfd9ec8fb40a8072f76be650ba822e (patch) | |
tree | 6b28ec7fb82b6c19050437c9227e943468eaccca /clang/lib/CodeGen | |
parent | 57681404b055d1eb0a35a6d3173a23d8c3a6bc87 (diff) | |
download | bcm5719-llvm-31e225cc90cfd9ec8fb40a8072f76be650ba822e.tar.gz bcm5719-llvm-31e225cc90cfd9ec8fb40a8072f76be650ba822e.zip |
Revert r108431 and r108433 (the cast-to-const-reference fixes), which
broke nightlytest.
llvm-svn: 108439
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index db4d23187df..43bab9fece6 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1749,47 +1749,8 @@ CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) { /// cast from scalar to union. LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { switch (E->getCastKind()) { - case CastExpr::CK_ToVoid: + default: return EmitUnsupportedLValue(E, "unexpected cast lvalue"); - - case CastExpr::CK_NoOp: - if (!E->getSubExpr()->Classify(getContext()).isPRValue()) { - LValue LV = EmitLValue(E->getSubExpr()); - if (LV.isPropertyRef()) { - QualType QT = E->getSubExpr()->getType(); - RValue RV = EmitLoadOfPropertyRefLValue(LV, QT); - assert(!RV.isScalar() && "EmitCastLValue - scalar cast of property ref"); - llvm::Value *V = RV.getAggregateAddr(); - return LValue::MakeAddr(V, MakeQualifiers(QT)); - } - return LV; - } - // Fall through to synthesize a temporary. - - case CastExpr::CK_Unknown: - case CastExpr::CK_BitCast: - case CastExpr::CK_ArrayToPointerDecay: - case CastExpr::CK_FunctionToPointerDecay: - case CastExpr::CK_NullToMemberPointer: - case CastExpr::CK_IntegralToPointer: - case CastExpr::CK_PointerToIntegral: - case CastExpr::CK_VectorSplat: - case CastExpr::CK_IntegralCast: - case CastExpr::CK_IntegralToFloating: - case CastExpr::CK_FloatingToIntegral: - case CastExpr::CK_FloatingCast: - case CastExpr::CK_DerivedToBaseMemberPointer: - case CastExpr::CK_BaseToDerivedMemberPointer: - case CastExpr::CK_MemberPointerToBoolean: - case CastExpr::CK_AnyPointerToBlockPointerCast: { - // These casts only produce lvalues when we're binding a reference to a - // temporary realized from a (converted) pure rvalue. Emit the expression - // as a value, copy it into a temporary, and return an lvalue referring to - // that temporary. - llvm::Value *V = CreateMemTemp(E->getType(), "ref.temp"); - EmitAnyExprToMem(E, V, false, false); - return LValue::MakeAddr(V, MakeQualifiers(E->getType())); - } case CastExpr::CK_Dynamic: { LValue LV = EmitLValue(E->getSubExpr()); @@ -1799,6 +1760,17 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { MakeQualifiers(E->getType())); } + case CastExpr::CK_NoOp: { + LValue LV = EmitLValue(E->getSubExpr()); + if (LV.isPropertyRef()) { + QualType QT = E->getSubExpr()->getType(); + RValue RV = EmitLoadOfPropertyRefLValue(LV, QT); + assert(!RV.isScalar() && "EmitCastLValue - scalar cast of property ref"); + llvm::Value *V = RV.getAggregateAddr(); + return LValue::MakeAddr(V, MakeQualifiers(QT)); + } + return LV; + } case CastExpr::CK_ConstructorConversion: case CastExpr::CK_UserDefinedConversion: case CastExpr::CK_AnyPointerToObjCPointerCast: @@ -1854,8 +1826,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { return LValue::MakeAddr(V, MakeQualifiers(E->getType())); } } - - llvm_unreachable("Unhandled lvalue cast kind?"); } LValue CodeGenFunction::EmitNullInitializationLValue( |