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