| Fariborz Jahanian | 8877376 | 2012-04-17 18:40:53 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks -o %t-rw.cpp %s |
| 2 | // RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -Wno-attributes -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
| 3 | // rdar://11131490 |
| 4 | |
| NAKAMURA Takumi | c6fbdf0 | 2012-04-21 09:39:58 +0000 | [diff] [blame] | 5 | // XFAIL: mingw |
| 6 | // FIXME: __declspec(X) is predefined on mingw. |
| 7 | |
| Fariborz Jahanian | 8877376 | 2012-04-17 18:40:53 +0000 | [diff] [blame] | 8 | extern "C" __declspec(dllexport) void BreakTheRewriter(void) { |
| 9 | __block int aBlockVariable = 0; |
| 10 | void (^aBlock)(void) = ^ { |
| 11 | aBlockVariable = 42; |
| 12 | }; |
| 13 | aBlockVariable++; |
| 14 | void (^bBlocks)(void) = ^ { |
| 15 | aBlockVariable = 43; |
| 16 | }; |
| 17 | void (^c)(void) = ^ { |
| 18 | aBlockVariable = 44; |
| 19 | }; |
| 20 | |
| 21 | } |
| 22 | __declspec(dllexport) extern "C" void AnotherBreakTheRewriter(int *p1, double d) { |
| 23 | |
| 24 | __block int bBlockVariable = 0; |
| 25 | void (^aBlock)(void) = ^ { |
| 26 | bBlockVariable = 42; |
| 27 | }; |
| 28 | bBlockVariable++; |
| 29 | void (^bBlocks)(void) = ^ { |
| 30 | bBlockVariable = 43; |
| 31 | }; |
| 32 | void (^c)(void) = ^ { |
| 33 | bBlockVariable = 44; |
| 34 | }; |
| 35 | |
| 36 | } |
| 37 | |
| 38 | int |
| 39 | |
| 40 | __declspec (dllexport) |
| 41 | |
| 42 | main (int argc, char *argv[]) |
| 43 | { |
| 44 | __block int bBlockVariable = 0; |
| 45 | void (^aBlock)(void) = ^ { |
| 46 | bBlockVariable = 42; |
| 47 | }; |
| 48 | } |
| Fariborz Jahanian | ca357d9 | 2012-04-19 00:50:01 +0000 | [diff] [blame] | 49 | |
| 50 | // rdar://11275241 |
| 51 | static char stringtype; |
| 52 | char CFStringGetTypeID(); |
| 53 | void x(void (^)()); |
| 54 | |
| Fariborz Jahanian | df0577d | 2012-04-19 16:30:28 +0000 | [diff] [blame] | 55 | static void initStatics(int arg, ...) { |
| Fariborz Jahanian | ca357d9 | 2012-04-19 00:50:01 +0000 | [diff] [blame] | 56 | x(^{ |
| 57 | stringtype = CFStringGetTypeID(); |
| 58 | }); |
| 59 | } |
| Fariborz Jahanian | df0577d | 2012-04-19 16:30:28 +0000 | [diff] [blame] | 60 | static void initStatics1(...) { |
| 61 | x(^{ |
| 62 | stringtype = CFStringGetTypeID(); |
| 63 | }); |
| 64 | } |
| 65 | static void initStatics2() { |
| 66 | x(^{ |
| 67 | stringtype = CFStringGetTypeID(); |
| 68 | }); |
| 69 | } |
| 70 | |
| Fariborz Jahanian | e49a42c | 2012-04-25 17:56:48 +0000 | [diff] [blame^] | 71 | // rdar://11314329 |
| 72 | static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; } |