summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenObjC/arc-weak-property.m
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGenObjC/arc-weak-property.m
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGenObjC/arc-weak-property.m')
-rw-r--r--clang/test/CodeGenObjC/arc-weak-property.m55
1 files changed, 55 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/arc-weak-property.m b/clang/test/CodeGenObjC/arc-weak-property.m
new file mode 100644
index 0000000..0a6b2a6
--- /dev/null
+++ b/clang/test/CodeGenObjC/arc-weak-property.m
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s
+// rdar://8899430
+
+@interface WeakPropertyTest {
+ __weak id PROP;
+}
+@property () __weak id PROP;
+@end
+
+@implementation WeakPropertyTest
+@synthesize PROP;
+@end
+
+// CHECK: define internal i8* @"\01-[WeakPropertyTest PROP]"
+// CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
+// CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
+// CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
+// CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
+// CHECK-NEXT: [[T0:%.*]] = load [[WPT]]** [[SELF]]
+// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
+// CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
+// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]]
+// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
+// CHECK-NEXT: [[T5:%.*]] = call i8* @objc_loadWeakRetained(i8** [[T4]])
+// CHECK-NEXT: [[T6:%.*]] = call i8* @objc_autoreleaseReturnValue(i8* [[T5]])
+// CHECK-NEXT: ret i8* [[T6]]
+
+// CHECK: define internal void @"\01-[WeakPropertyTest setPROP:]"
+// CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
+// CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
+// CHECK-NEXT: [[PROP:%.*]] = alloca i8*,
+// CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
+// CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
+// CHECK-NEXT: store i8* {{%.*}}, i8** [[PROP]]
+// CHECK-NEXT: [[V:%.*]] = load i8** [[PROP]]
+// CHECK-NEXT: [[T0:%.*]] = load [[WPT]]** [[SELF]]
+// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
+// CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
+// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]]
+// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
+// CHECK-NEXT: call i8* @objc_storeWeak(i8** [[T4]], i8* [[V]])
+// CHECK-NEXT: ret void
+
+// CHECK: define internal void @"\01-[WeakPropertyTest .cxx_destruct]"
+// CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
+// CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
+// CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
+// CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
+// CHECK-NEXT: [[T0:%.*]] = load [[WPT]]** [[SELF]]
+// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
+// CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
+// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]]
+// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
+// CHECK-NEXT: call void @objc_destroyWeak(i8** [[T4]])
+// CHECK-NEXT: ret void