summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-08-05 00:14:38 +0000
committerJohn McCall <rjmccall@apple.com>2011-08-05 00:14:38 +0000
commit91e82dd47734ecd8a190a0e10b2283bae34319ef (patch)
treebd4529a6a1757bd074dda5aad07fcd266935e1b5 /clang/test
parent4283092a4b86aed16a5e27f822d641012d31267d (diff)
downloadbcm5719-llvm-91e82dd47734ecd8a190a0e10b2283bae34319ef.tar.gz
bcm5719-llvm-91e82dd47734ecd8a190a0e10b2283bae34319ef.zip
The continue label in an ARC for-in loop should not involve
releasing the collection. llvm-svn: 136949
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenObjC/arc-foreach.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/arc-foreach.m b/clang/test/CodeGenObjC/arc-foreach.m
index c5593ffb70e..cfd0c0de684 100644
--- a/clang/test/CodeGenObjC/arc-foreach.m
+++ b/clang/test/CodeGenObjC/arc-foreach.m
@@ -148,3 +148,24 @@ void test2(Test2 *a) {
// This bitcast is for the final release.
// CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[COLL]] to i8*
// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]])
+
+
+// Check that the 'continue' label is positioned appropriately
+// relative to the collection clenaup.
+void test3(NSArray *array) {
+ for (id x in array) {
+ if (!x) continue;
+ use(x);
+ }
+
+ // CHECK-LP64: define void @test3(
+ // CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8
+ // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8
+ // CHECK-LP64: [[T0:%.*]] = load i8** [[X]], align 8
+ // CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
+ // CHECK-LP64-NEXT: br i1 [[T1]],
+ // CHECK-LP64: br label [[L:%[^ ]+]]
+ // CHECK-LP64: [[T0:%.*]] = load i8** [[X]], align 8
+ // CHECK-LP64-NEXT: call void @use(i8* [[T0]])
+ // CHECK-LP64-NEXT: br label [[L]]
+}
OpenPOWER on IntegriCloud