blob: 1af82345e0bc1b2946b5c2452c50fc16d516db45 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2
Daniel Dunbar8b576972009-11-08 01:45:36 +00002// RUN: grep 'ret i32' %t | count 1
Daniel Dunbar94ceb612009-02-24 01:43:46 +00003// RUN: grep 'ret i32 1' %t | count 1
Fariborz Jahaniane3126a22008-11-17 18:03:28 +00004
Fariborz Jahaniane2caaaa2008-11-21 19:21:53 +00005@interface MyClass
6{
7}
8- (void)method;
9@end
10
11@implementation MyClass
12
13- (void)method
14{
15 @synchronized(self)
16 {
Fariborz Jahaniane2caaaa2008-11-21 19:21:53 +000017 }
18}
19
20@end
21
Fariborz Jahaniane3126a22008-11-17 18:03:28 +000022void foo(id a) {
23 @synchronized(a) {
Fariborz Jahaniane3126a22008-11-17 18:03:28 +000024 return;
25 }
26}
27
Daniel Dunbar94ceb612009-02-24 01:43:46 +000028int f0(id a) {
29 int x = 0;
30 @synchronized((x++, a)) {
31 }
32 return x; // ret i32 1
33}
Fariborz Jahaniane2caaaa2008-11-21 19:21:53 +000034
Daniel Dunbar94ceb612009-02-24 01:43:46 +000035void f1(id a) {
36 // The trick here is that the return shouldn't go through clean up,
37 // but there isn't a simple way to check this property.
38 @synchronized(({ return; }), a) {
39 return;
40 }
41}