From f6a1648197562e0b133440d612d9af297d0a86cc Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 4 Dec 2010 03:47:34 +0000 Subject: Although we currently have explicit lvalue-to-rvalue conversions, they're not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index c98ee17842..78605ba8b1 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1755,6 +1755,21 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { case CK_Dependent: llvm_unreachable("dependent cast kind in IR gen!"); + case CK_GetObjCProperty: { + LValue LV = EmitLValue(E->getSubExpr()); + assert(LV.isPropertyRef()); + RValue RV = EmitLoadOfPropertyRefLValue(LV); + + // Property is an aggregate r-value. + if (RV.isAggregate()) { + return MakeAddrLValue(RV.getAggregateAddr(), E->getType()); + } + + // Implicit property returns an l-value. + assert(RV.isScalar()); + return MakeAddrLValue(RV.getScalarVal(), E->getSubExpr()->getType()); + } + case CK_NoOp: if (!E->getSubExpr()->isRValue() || E->getType()->isRecordType()) { LValue LV = EmitLValue(E->getSubExpr()); -- cgit v1.2.3