| 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 | |
| 5 | extern "C" __declspec(dllexport) void BreakTheRewriter(void) { |
| 6 | __block int aBlockVariable = 0; |
| 7 | void (^aBlock)(void) = ^ { |
| 8 | aBlockVariable = 42; |
| 9 | }; |
| 10 | aBlockVariable++; |
| 11 | void (^bBlocks)(void) = ^ { |
| 12 | aBlockVariable = 43; |
| 13 | }; |
| 14 | void (^c)(void) = ^ { |
| 15 | aBlockVariable = 44; |
| 16 | }; |
| 17 | |
| 18 | } |
| 19 | __declspec(dllexport) extern "C" void AnotherBreakTheRewriter(int *p1, double d) { |
| 20 | |
| 21 | __block int bBlockVariable = 0; |
| 22 | void (^aBlock)(void) = ^ { |
| 23 | bBlockVariable = 42; |
| 24 | }; |
| 25 | bBlockVariable++; |
| 26 | void (^bBlocks)(void) = ^ { |
| 27 | bBlockVariable = 43; |
| 28 | }; |
| 29 | void (^c)(void) = ^ { |
| 30 | bBlockVariable = 44; |
| 31 | }; |
| 32 | |
| 33 | } |
| 34 | |
| 35 | int |
| 36 | |
| 37 | __declspec (dllexport) |
| 38 | |
| 39 | main (int argc, char *argv[]) |
| 40 | { |
| 41 | __block int bBlockVariable = 0; |
| 42 | void (^aBlock)(void) = ^ { |
| 43 | bBlockVariable = 42; |
| 44 | }; |
| 45 | } |
| Fariborz Jahanian | ca357d9 | 2012-04-19 00:50:01 +0000 | [diff] [blame] | 46 | |
| 47 | // rdar://11275241 |
| 48 | static char stringtype; |
| 49 | char CFStringGetTypeID(); |
| 50 | void x(void (^)()); |
| 51 | |
| Fariborz Jahanian | df0577d | 2012-04-19 16:30:28 +0000 | [diff] [blame^] | 52 | static void initStatics(int arg, ...) { |
| Fariborz Jahanian | ca357d9 | 2012-04-19 00:50:01 +0000 | [diff] [blame] | 53 | x(^{ |
| 54 | stringtype = CFStringGetTypeID(); |
| 55 | }); |
| 56 | } |
| Fariborz Jahanian | df0577d | 2012-04-19 16:30:28 +0000 | [diff] [blame^] | 57 | static void initStatics1(...) { |
| 58 | x(^{ |
| 59 | stringtype = CFStringGetTypeID(); |
| 60 | }); |
| 61 | } |
| 62 | static void initStatics2() { |
| 63 | x(^{ |
| 64 | stringtype = CFStringGetTypeID(); |
| 65 | }); |
| 66 | } |
| 67 | |