blob: 538f16c25574977c3b8252591008548af2ac0db5 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result
2// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fblocks -fsyntax-only %s > %t
John McCall8f0e8d22011-06-15 23:25:17 +00003// RUN: diff %t %s.result
4
5#include "Common.h"
6
7@interface Foo : NSObject
8-(Foo *)something;
9@end
10
11void bar(void (^block)());
12
13void test1(Foo *p) {
14 __block Foo *x = p; // __block used just to break cycle.
15 bar(^{
16 [x something];
17 });
18}
19
20void test2(Foo *p) {
21 __block Foo *x; // __block used as output variable.
22 bar(^{
23 x = [p something];
24 });
25}
Argyrios Kyrtzidis2a278182012-03-05 08:46:24 +000026
27void test3(Foo *p) {
28 __block Foo *x; // __block used as output variable.
29 bar(^{
30 [x something];
31 });
32 bar(^{
33 x = 0;
34 });
35}
36
37void test4(Foo *p) {
38 __block Foo *x = p; // __block used just to break cycle.
39 bar(^{
40 [x something];
41 });
42 bar(^{
43 [x something];
44 });
45}