blob: 8981777b8e95b1843180c2c44d7177949126b8ab [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
Fariborz Jahanian72952fc2010-03-01 23:36:21 +00002// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
Fariborz Jahanian43aa1c32012-04-16 22:14:01 +00003// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
4// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
Fariborz Jahanian72952fc2010-03-01 23:36:21 +00005// radar 7696893
6
Fariborz Jahanian8b08adb2012-05-03 21:44:12 +00007typedef unsigned long size_t;
Fariborz Jahanian72952fc2010-03-01 23:36:21 +00008void *sel_registerName(const char *);
9
10void f(void (^block)(void));
11void f2(id);
12void f3(int);
13char f4(id, id);
14
15@interface Baz
16- (void)b:(void (^)(void))block;
17@end
18
19@interface Bar
20@end
21
22@interface Foo {
23 int _x;
24}
25@end
26
27@implementation Foo
28- (void)method:(Bar *)up {
29 Baz *down;
30 int at;
31 id cq;
32 __block char didit = 'a';
33 __block char upIsFinished = 'b';
34 f(^{
35 id old_cq;
36 f2(cq);
37 [down b:^{
38 [down b:^{
39 f(^{
40 didit = f4(up, down);
41 upIsFinished = 'c';
42 self->_x++;
43 });
44 }];
45 }];
46 f2(old_cq);
47 f3(at);
48 });
49}
50@end