[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Rewriter / rewrite-nested-blocks-1.mm
blob416fd97ad668c803d0ad66d597563560f8971d3e
1 // 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 // RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3 // 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 -std=gnu++98 -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
5 // radar 7696893
7 typedef unsigned long size_t;
8 void *sel_registerName(const char *);
10 void f(void (^block)(void));
11 void f2(id);
12 void f3(int);
13 char f4(id, id);
15 @interface Baz
16 - (void)b:(void (^)(void))block;
17 @end
19 @interface Bar
20 @end
22 @interface Foo {
23         int _x;
25 @end
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     });
50 @end