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
8 typedef unsigned long size_t;
10 void I( void (^)(void));
14 int printf(const char*, ...);
16 typedef void (^T) (void);
19 int takeintint(int (^C)(int)) { return C(4); }
27 noop = ^{printf("\nClosure\n"); };
31 return ^{printf("\nClosure\n"); };
36 takeblock(^{ printf("%d\n", x); });
47 void (^noop)(void) = ^{};
51 void myfunc(int (^block)(int)) {}
53 void myfunc3(const int *x);
66 static int global_x = 10;
67 void (^global_block)(void) = ^{ printf("global x is %d\n", global_x); };
69 // 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);
70 // CHECK: void (*global_block)(void) = ((void (*)())&__global_global_block_block_impl_0);
72 typedef void (^void_block_t)(void);
74 static const void_block_t myBlock = ^{ };
76 static const void_block_t myBlock2 = ^ void(void) { };