]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenObjC/synchronized.m
Update clang to r89205.
[FreeBSD/FreeBSD.git] / test / CodeGenObjC / synchronized.m
1 // RUN: clang-cc -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2
2 // RUN: grep 'ret i32' %t | count 1
3 // RUN: grep 'ret i32 1' %t | count 1
4
5 @interface MyClass
6 {
7 }
8 - (void)method;
9 @end
10
11 @implementation MyClass
12
13 - (void)method
14 {
15         @synchronized(self)
16         {
17         }
18 }
19
20 @end
21
22 void foo(id a) {
23   @synchronized(a) {
24     return;
25   }
26 }
27
28 int f0(id a) {
29   int x = 0;
30   @synchronized((x++, a)) {    
31   }
32   return x; // ret i32 1
33 }
34
35 void 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 }