xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-nested-blocks-1.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// 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
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
5*f4a2713aSLionel Sambuc// radar 7696893
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuctypedef unsigned long size_t;
8*f4a2713aSLionel Sambucvoid *sel_registerName(const char *);
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambucvoid f(void (^block)(void));
11*f4a2713aSLionel Sambucvoid f2(id);
12*f4a2713aSLionel Sambucvoid f3(int);
13*f4a2713aSLionel Sambucchar f4(id, id);
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface Baz
16*f4a2713aSLionel Sambuc- (void)b:(void (^)(void))block;
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@interface Bar
20*f4a2713aSLionel Sambuc@end
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc@interface Foo {
23*f4a2713aSLionel Sambuc	int _x;
24*f4a2713aSLionel Sambuc}
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@implementation Foo
28*f4a2713aSLionel Sambuc- (void)method:(Bar *)up {
29*f4a2713aSLionel Sambuc    Baz *down;
30*f4a2713aSLionel Sambuc	int at;
31*f4a2713aSLionel Sambuc    id cq;
32*f4a2713aSLionel Sambuc    __block char didit = 'a';
33*f4a2713aSLionel Sambuc    __block char upIsFinished = 'b';
34*f4a2713aSLionel Sambuc    f(^{
35*f4a2713aSLionel Sambuc            id old_cq;
36*f4a2713aSLionel Sambuc			f2(cq);
37*f4a2713aSLionel Sambuc            [down b:^{
38*f4a2713aSLionel Sambuc                    [down b:^{
39*f4a2713aSLionel Sambuc                            f(^{
40*f4a2713aSLionel Sambuc                                    didit = f4(up, down);
41*f4a2713aSLionel Sambuc									upIsFinished = 'c';
42*f4a2713aSLionel Sambuc                                    self->_x++;
43*f4a2713aSLionel Sambuc                                });
44*f4a2713aSLionel Sambuc                        }];
45*f4a2713aSLionel Sambuc                }];
46*f4a2713aSLionel Sambuc				f2(old_cq);
47*f4a2713aSLionel Sambuc			f3(at);
48*f4a2713aSLionel Sambuc    });
49*f4a2713aSLionel Sambuc}
50*f4a2713aSLionel Sambuc@end
51