1 // RUN: %clang_cc1 -E %s -o %t.mm
2 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
3 // 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
4 // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
5 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
6 // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
9 typedef unsigned long size_t;
13 void I( void (^)(void));
17 int printf(const char*, ...);
19 typedef void (^T) (void);
22 int takeintint(int (^C)(int)) { return C(4); }
30 noop = ^{printf("\nClosure\n"); };
34 return ^{printf("\nClosure\n"); };
39 takeblock(^{ printf("%d\n", x); });
50 void (^noop)(void) = ^{};
54 void myfunc(int (^block)(int)) {}
56 void myfunc3(const int *x);
69 static int global_x = 10;
70 void (^global_block)(void) = ^{ printf("global x is %d\n", global_x); };
72 // CHECK: static __global_block_block_impl_0 __global_global_block_block_impl_0((void *)__global_block_block_func_0, &__global_block_block_desc_0_DATA);
73 // CHECK: void (*global_block)(void) = ((void (*)())&__global_global_block_block_impl_0);
75 typedef void (^void_block_t)(void);
77 static const void_block_t myBlock = ^{ };
79 static const void_block_t myBlock2 = ^ void(void) { };