diff options
author | John McCall <rjmccall@apple.com> | 2011-07-27 21:50:02 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-07-27 21:50:02 +0000 |
commit | d9bb743e0d343b3a199e218368b33f52f4886a72 (patch) | |
tree | f5328f00546cc49004c1f10f5d5a71e97bd1b0d4 /clang/test/CodeGenObjC/arc.m | |
parent | a94a1544d8d0ae7b54b5a78300e46e81b267e2f9 (diff) | |
download | bcm5719-llvm-d9bb743e0d343b3a199e218368b33f52f4886a72.tar.gz bcm5719-llvm-d9bb743e0d343b3a199e218368b33f52f4886a72.zip |
The lock operand to an @synchronized statement is also
supposed to be a full-expression; make it so. In ARC, make sure
we retain the lock for the entire protected block.
llvm-svn: 136271
Diffstat (limited to 'clang/test/CodeGenObjC/arc.m')
-rw-r--r-- | clang/test/CodeGenObjC/arc.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/arc.m b/clang/test/CodeGenObjC/arc.m index 918cbcbb3b5..3d0abc5c30b 100644 --- a/clang/test/CodeGenObjC/arc.m +++ b/clang/test/CodeGenObjC/arc.m @@ -1666,3 +1666,21 @@ void test58b(void) { __attribute__((objc_precise_lifetime)) Test58 *ptr = test58_helper(); char *c = [ptr interior]; } + +// rdar://problem/9842343 +void test59(void) { + extern id test59_getlock(void); + extern void test59_body(void); + @synchronized (test59_getlock()) { + test59_body(); + } + + // CHECK: define void @test59() + // CHECK: [[T0:%.*]] = call i8* @test59_getlock() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: call void @objc_sync_enter(i8* [[T1]]) + // CHECK-NEXT: call void @test59_body() + // CHECK-NEXT: call void @objc_sync_exit(i8* [[T1]]) + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) + // CHECK-NEXT: ret void +} |