summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC/mrc-weak.m
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-11-19 02:28:03 +0000
committerJohn McCall <rjmccall@apple.com>2015-11-19 02:28:03 +0000
commit00b2bbb7bb5a02306095db2b39d7bf9bc12df90d (patch)
tree44544c17e94d76a965ffa1a0f6829533ddec5b1d /clang/test/CodeGenObjC/mrc-weak.m
parentd80218fa4221c76fa1b822a406253921d4c7f8fc (diff)
downloadbcm5719-llvm-00b2bbb7bb5a02306095db2b39d7bf9bc12df90d.tar.gz
bcm5719-llvm-00b2bbb7bb5a02306095db2b39d7bf9bc12df90d.zip
Don't actually add the __unsafe_unretained qualifier in MRC;
driving a canonical difference between that and an unqualified type is a really bad idea when both are valid. Instead, remember that it was there in a non-canonical way, then look for that in the one place we really care about it: block captures. The net effect closely resembles the behavior of a decl attribute, except still closely following ARC's standard qualifier parsing rules. llvm-svn: 253534
Diffstat (limited to 'clang/test/CodeGenObjC/mrc-weak.m')
-rw-r--r--clang/test/CodeGenObjC/mrc-weak.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/mrc-weak.m b/clang/test/CodeGenObjC/mrc-weak.m
index 9072b1a0832..e2c78f07336 100644
--- a/clang/test/CodeGenObjC/mrc-weak.m
+++ b/clang/test/CodeGenObjC/mrc-weak.m
@@ -160,3 +160,32 @@ void test8(void) {
// CHECK-LABEL: define internal void @__Block_byref_object_dispose
// CHECK: call void @objc_destroyWeak
+
+// CHECK-LABEL: define void @test9_baseline()
+// CHECK: define internal void @__copy_helper
+// CHECK: define internal void @__destroy_helper
+void test9_baseline(void) {
+ Foo *p = get_object();
+ use_block(^{ [p run]; });
+}
+
+// CHECK-LABEL: define void @test9()
+// CHECK-NOT: define internal void @__copy_helper
+// CHECK-NOT: define internal void @__destroy_helper
+// CHECK: define void @test9_fin()
+void test9(void) {
+ __unsafe_unretained Foo *p = get_object();
+ use_block(^{ [p run]; });
+}
+void test9_fin() {}
+
+// CHECK-LABEL: define void @test10()
+// CHECK-NOT: define internal void @__copy_helper
+// CHECK-NOT: define internal void @__destroy_helper
+// CHECK: define void @test10_fin()
+void test10(void) {
+ typedef __unsafe_unretained Foo *UnsafeFooPtr;
+ UnsafeFooPtr p = get_object();
+ use_block(^{ [p run]; });
+}
+void test10_fin() {}
OpenPOWER on IntegriCloud