brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · c379773 Raw
57 lines · plain
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.cpp2// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp3// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp4// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp5 6typedef unsigned long size_t;7void f(void (^block)(void));8 9@interface X {10	int y;11}12- (void)foo;13@end14 15@implementation X16- (void)foo {17    f(^{18  f(^{19    f(^{20      y=42;21    });22  });23});24 25}26@end27 28struct S {29  int y;30};31 32void foo () {33	struct S *SELF;34	f(^{35		f(^{36			SELF->y = 42;37		});38	});39}40 41@interface Bar42@end43 44void f(Bar *);45void q(void (^block)(void));46 47void 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