From 569c3166874324c24011f8ade6978421f0d39b3c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 7 Aug 2010 11:51:51 +0000 Subject: Allow reference binding of a reference of Objective-C object type to an lvalue of another, compatible Objective-C object type (e.g., a subclass). Introduce a new initialization sequence step kind to describe this binding, along with a new cast kind. Fixes PR7741. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 9424776898..e2ccf55f93 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1851,6 +1851,13 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { ConvertType(CE->getTypeAsWritten())); return LValue::MakeAddr(V, MakeQualifiers(E->getType())); } + case CastExpr::CK_ObjCObjectLValueCast: { + LValue LV = EmitLValue(E->getSubExpr()); + QualType ToType = getContext().getLValueReferenceType(E->getType()); + llvm::Value *V = Builder.CreateBitCast(LV.getAddress(), + ConvertType(ToType)); + return LValue::MakeAddr(V, MakeQualifiers(E->getType())); + } } llvm_unreachable("Unhandled lvalue cast kind?"); -- cgit v1.2.3-70-g09d2