blob: e037a6eb2558076fe7226df3bcadc9fa0a1fe7e7 [file] [log] [blame]
Fariborz Jahanian88773762012-04-17 18:40:53 +00001// 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
5extern "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
35int
36
37__declspec (dllexport)
38
39main (int argc, char *argv[])
40{
41 __block int bBlockVariable = 0;
42 void (^aBlock)(void) = ^ {
43 bBlockVariable = 42;
44 };
45}
Fariborz Jahanianca357d92012-04-19 00:50:01 +000046
47// rdar://11275241
48static char stringtype;
49char CFStringGetTypeID();
50void x(void (^)());
51
52static void initStatics() {
53 x(^{
54 stringtype = CFStringGetTypeID();
55 });
56}