From 0aebc81e02397a5987aaa8e8c7acbdb01a31d7c3 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 9 Sep 2009 21:33:21 +0000 Subject: If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81383 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 969b789d51..dde6899c29 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1158,19 +1158,11 @@ LValue CodeGenFunction::EmitConditionalOperator(const ConditionalOperator* E) { /// all the reasons that casts are permitted with aggregate result, including /// noop aggregate casts, and cast from scalar to union. LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { - if (E->getCastKind() == CastExpr::CK_UserDefinedConversion) { - if (const CXXFunctionalCastExpr *CXXFExpr = - dyn_cast(E)) - return LValue::MakeAddr( - EmitCXXFunctionalCastExpr(CXXFExpr).getScalarVal(), 0); - assert(isa(E) && - "EmitCastLValue - Expected CStyleCastExpr"); - return EmitLValue(E->getSubExpr()); - } - // If this is an aggregate-to-aggregate cast, just use the input's address as // the lvalue. - if (E->getCastKind() == CastExpr::CK_NoOp) + if (E->getCastKind() == CastExpr::CK_NoOp || + E->getCastKind() == CastExpr::CK_ConstructorConversion || + E->getCastKind() == CastExpr::CK_UserDefinedConversion) return EmitLValue(E->getSubExpr()); // If this is an lvalue cast, treat it as a no-op. -- cgit v1.2.3