Home | History | Annotate | Download | only in Rewriter
      1 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
      2 // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
      3 // radar 7682149
      4 
      5 
      6 void f(void (^block)(void));
      7 
      8 @interface X {
      9 	int y;
     10 }
     11 - (void)foo;
     12 @end
     13 
     14 @implementation X
     15 - (void)foo {
     16     f(^{
     17   f(^{
     18     f(^{
     19       y=42;
     20     });
     21   });
     22 });
     23 
     24 }
     25 @end
     26 
     27 struct S {
     28   int y;
     29 };
     30 
     31 void foo () {
     32 	struct S *SELF;
     33 	f(^{
     34 		f(^{
     35 			SELF->y = 42;
     36 		});
     37 	});
     38 }
     39 
     40 // radar 7692419
     41 @interface Bar
     42 @end
     43 
     44 void f(Bar *);
     45 void q(void (^block)(void));
     46 
     47 void x() {
     48         void (^myblock)(Bar *b) = ^(Bar *b) {
     49                 q(^{
     50                         f(b);   
     51                 });
     52         };
     53         
     54         Bar *b = (Bar *)42;
     55         myblock(b);
     56 }
     57