summaryrefslogtreecommitdiffstats
path: root/test/CodeGenObjCXX/property-reference.mm
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenObjCXX/property-reference.mm')
-rw-r--r--test/CodeGenObjCXX/property-reference.mm44
1 files changed, 43 insertions, 1 deletions
diff --git a/test/CodeGenObjCXX/property-reference.mm b/test/CodeGenObjCXX/property-reference.mm
index bc3bb47..4897f6d 100644
--- a/test/CodeGenObjCXX/property-reference.mm
+++ b/test/CodeGenObjCXX/property-reference.mm
@@ -35,7 +35,7 @@ namespace test1 {
@interface Test1 {
test1::A ivar;
}
-@property const test1::A &prop1;
+@property (nonatomic) const test1::A &prop1;
@end
@implementation Test1
@synthesize prop1 = ivar;
@@ -52,3 +52,45 @@ namespace test1 {
// CHECK: call [[A]]* @_ZN5test11AaSERKS0_(
// CHECK-NEXT: ret void
+// rdar://problem/10497174
+@interface Test2
+@property int prop;
+@end
+
+// The fact that these are all non-dependent is critical.
+template <class T> void test2(Test2 *a) {
+ int x = a.prop;
+ a.prop = x;
+ a.prop += x;
+}
+template void test2<int>(Test2*);
+// CHECK: define weak_odr void @_Z5test2IiEvP5Test2(
+// CHECK: [[X:%.*]] = alloca i32,
+// CHECK: @objc_msgSend
+// CHECK: store i32 {{%.*}}, i32* [[X]],
+// CHECK: load i32* [[X]],
+// CHECK: @objc_msgSend
+// CHECK: @objc_msgSend
+// CHECK: load i32* [[X]],
+// CHECK-NEXT: add nsw
+// CHECK: @objc_msgSend
+// CHECK-NEXT: ret void
+
+// Same as the previous test, but instantiation-dependent.
+template <class T> void test3(Test2 *a) {
+ int x = (sizeof(T), a).prop;
+ a.prop = (sizeof(T), x);
+ a.prop += (sizeof(T), x);
+}
+template void test3<int>(Test2*);
+// CHECK: define weak_odr void @_Z5test3IiEvP5Test2(
+// CHECK: [[X:%.*]] = alloca i32,
+// CHECK: @objc_msgSend
+// CHECK: store i32 {{%.*}}, i32* [[X]],
+// CHECK: load i32* [[X]],
+// CHECK: @objc_msgSend
+// CHECK: @objc_msgSend
+// CHECK: load i32* [[X]],
+// CHECK-NEXT: add nsw
+// CHECK: @objc_msgSend
+// CHECK-NEXT: ret void
OpenPOWER on IntegriCloud