blob: 8147cd1e235f256c485412dd6057a2411cffae55 [file] [log] [blame]
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00001// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2
2// RUN: grep 'ret i32' %t | count 1
Daniel Dunbar1c566672009-02-24 01:43:46 +00003// RUN: grep 'ret i32 1' %t | count 1
Fariborz Jahanianb79e6612008-11-17 18:03:28 +00004
Fariborz Jahanianf2878e52008-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 Jahanianf2878e52008-11-21 19:21:53 +000017 }
18}
19
20@end
21
Fariborz Jahanianb79e6612008-11-17 18:03:28 +000022void foo(id a) {
23 @synchronized(a) {
Fariborz Jahanianb79e6612008-11-17 18:03:28 +000024 return;
25 }
26}
27
Daniel Dunbar1c566672009-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 Jahanianf2878e52008-11-21 19:21:53 +000034
Daniel Dunbar1c566672009-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}