Home | History | Annotate | Download | only in Rewriter
      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 -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 typedef unsigned long size_t;
      8 void *sel_registerName(const char *);
      9 
     10 void f(void (^block)(void));
     11 void f2(id);
     12 void f3(int);
     13 char 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
     51