Delete dead code.

llvm-svn: 185119
This commit is contained in:
Eli Friedman 2013-06-28 00:23:34 +00:00
parent cb9cd6c714
commit c7ad5c4e29
2 changed files with 16 additions and 40 deletions

View File

@ -821,8 +821,6 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
return EmitLValue(cleanups->getSubExpr()); return EmitLValue(cleanups->getSubExpr());
} }
case Expr::CXXScalarValueInitExprClass:
return EmitNullInitializationLValue(cast<CXXScalarValueInitExpr>(E));
case Expr::CXXDefaultArgExprClass: case Expr::CXXDefaultArgExprClass:
return EmitLValue(cast<CXXDefaultArgExpr>(E)->getExpr()); return EmitLValue(cast<CXXDefaultArgExpr>(E)->getExpr());
case Expr::CXXDefaultInitExprClass: { case Expr::CXXDefaultInitExprClass: {
@ -2676,26 +2674,6 @@ EmitConditionalOperatorLValue(const AbstractConditionalOperator *expr) {
LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
switch (E->getCastKind()) { switch (E->getCastKind()) {
case CK_ToVoid: case CK_ToVoid:
return EmitUnsupportedLValue(E, "unexpected cast lvalue");
case CK_Dependent:
llvm_unreachable("dependent cast kind in IR gen!");
case CK_BuiltinFnToFnPtr:
llvm_unreachable("builtin functions are handled elsewhere");
// These two casts are currently treated as no-ops, although they could
// potentially be real operations depending on the target's ABI.
case CK_NonAtomicToAtomic:
case CK_AtomicToNonAtomic:
case CK_NoOp:
case CK_LValueToRValue:
if (!E->getSubExpr()->Classify(getContext()).isPRValue()
|| E->getType()->isRecordType())
return EmitLValue(E->getSubExpr());
// Fall through to synthesize a temporary.
case CK_BitCast: case CK_BitCast:
case CK_ArrayToPointerDecay: case CK_ArrayToPointerDecay:
case CK_FunctionToPointerDecay: case CK_FunctionToPointerDecay:
@ -2730,15 +2708,20 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CK_ARCConsumeObject: case CK_ARCConsumeObject:
case CK_ARCReclaimReturnedObject: case CK_ARCReclaimReturnedObject:
case CK_ARCExtendBlockObject: case CK_ARCExtendBlockObject:
case CK_CopyAndAutoreleaseBlockObject: { case CK_CopyAndAutoreleaseBlockObject:
// These casts only produce lvalues when we're binding a reference to a return EmitUnsupportedLValue(E, "unexpected cast lvalue");
// temporary realized from a (converted) pure rvalue. Emit the expression
// as a value, copy it into a temporary, and return an lvalue referring to case CK_Dependent:
// that temporary. llvm_unreachable("dependent cast kind in IR gen!");
llvm::Value *V = CreateMemTemp(E->getType(), "ref.temp");
EmitAnyExprToMem(E, V, E->getType().getQualifiers(), false); case CK_BuiltinFnToFnPtr:
return MakeAddrLValue(V, E->getType()); llvm_unreachable("builtin functions are handled elsewhere");
}
// These two casts are currently treated as no-ops, although they could
// potentially be real operations depending on the target's ABI.
case CK_NonAtomicToAtomic:
case CK_AtomicToNonAtomic:
return EmitLValue(E->getSubExpr());
case CK_Dynamic: { case CK_Dynamic: {
LValue LV = EmitLValue(E->getSubExpr()); LValue LV = EmitLValue(E->getSubExpr());
@ -2751,6 +2734,8 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CK_UserDefinedConversion: case CK_UserDefinedConversion:
case CK_CPointerToObjCPointerCast: case CK_CPointerToObjCPointerCast:
case CK_BlockPointerToObjCPointerCast: case CK_BlockPointerToObjCPointerCast:
case CK_NoOp:
case CK_LValueToRValue:
return EmitLValue(E->getSubExpr()); return EmitLValue(E->getSubExpr());
case CK_UncheckedDerivedToBase: case CK_UncheckedDerivedToBase:
@ -2817,14 +2802,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
llvm_unreachable("Unhandled lvalue cast kind?"); llvm_unreachable("Unhandled lvalue cast kind?");
} }
LValue CodeGenFunction::EmitNullInitializationLValue(
const CXXScalarValueInitExpr *E) {
QualType Ty = E->getType();
LValue LV = MakeAddrLValue(CreateMemTemp(Ty), Ty);
EmitNullInitialization(LV.getAddress(), Ty);
return LV;
}
LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) {
assert(OpaqueValueMappingData::shouldBindAsLValue(e)); assert(OpaqueValueMappingData::shouldBindAsLValue(e));
return getOpaqueLValueMapping(e); return getOpaqueLValueMapping(e);

View File

@ -1991,7 +1991,6 @@ public:
LValue EmitInitListLValue(const InitListExpr *E); LValue EmitInitListLValue(const InitListExpr *E);
LValue EmitConditionalOperatorLValue(const AbstractConditionalOperator *E); LValue EmitConditionalOperatorLValue(const AbstractConditionalOperator *E);
LValue EmitCastLValue(const CastExpr *E); LValue EmitCastLValue(const CastExpr *E);
LValue EmitNullInitializationLValue(const CXXScalarValueInitExpr *E);
LValue EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E); LValue EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E);
LValue EmitOpaqueValueLValue(const OpaqueValueExpr *e); LValue EmitOpaqueValueLValue(const OpaqueValueExpr *e);