summaryrefslogtreecommitdiffstats
path: root/test/CodeGenObjC/synchronized.m
blob: b398ca6c0a59d8f23384a3c7b700fd2bb38bf15a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2 &&
// RUN: grep 'ret i32' %t | count 1 &&
// RUN: grep 'ret i32 1' %t | count 1

@interface MyClass
{
}
- (void)method;
@end

@implementation MyClass

- (void)method
{
	@synchronized(self)
	{
	}
}

@end

void foo(id a) {
  @synchronized(a) {
    return;
  }
}

int f0(id a) {
  int x = 0;
  @synchronized((x++, a)) {    
  }
  return x; // ret i32 1
}

void f1(id a) {
  // The trick here is that the return shouldn't go through clean up,
  // but there isn't a simple way to check this property.
  @synchronized(({ return; }), a) {
    return;
  }
}
OpenPOWER on IntegriCloud