[cfe-commits] r141009 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenObjCXX/property-object-reference.mm
Fariborz Jahanian
fjahanian at apple.com
Mon Oct 3 10:58:22 PDT 2011
Author: fjahanian
Date: Mon Oct 3 12:58:21 2011
New Revision: 141009
URL: http://llvm.org/viewvc/llvm-project?rev=141009&view=rev
Log:
objc++: Accessing explicit property of reference type need
not bind to a temporary. Fixes //rdar://10188258
Added:
cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=141009&r1=141008&r2=141009&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct 3 12:58:21 2011
@@ -7388,7 +7388,13 @@
<< PRE->getBase()->getType();
}
}
-
+ else {
+ // lvalue-ness of an explicit property is determined by
+ // property type.
+ ObjCPropertyDecl *PDecl = PRE->getExplicitProperty();
+ VK = Expr::getValueKindForType(PDecl->getType());
+ }
+
E = ImplicitCastExpr::Create(Context, T, CK_GetObjCProperty,
E, 0, VK);
Added: cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm?rev=141009&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm Mon Oct 3 12:58:21 2011
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - | FileCheck %s
+// rdar://10188258
+
+struct Foo {int i;};
+
+ at interface ObjCTest { }
+ at property (nonatomic, readonly) Foo& FooRefProperty;
+ at end
+
+
+ at implementation ObjCTest
+ at dynamic FooRefProperty;
+
+-(void) test {
+ Foo& f = self.FooRefProperty;
+}
+ at end
+
+// CHECK: [[T0:%.*]] = load {{%.*}} [[S0:%.*]]
+// CHECK: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_
+// CHECK: [[T2:%.*]] = bitcast {{%.*}} [[T0]] to i8*
+// CHECK: @objc_msgSend
+
More information about the cfe-commits
mailing list