blob: 590a4d4346f0bd7b839a48a13147ce67f02c47a0 [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
NAKAMURA Takumic6fbdf02012-04-21 09:39:58 +00005// XFAIL: mingw
6// FIXME: __declspec(X) is predefined on mingw.
7
Fariborz Jahanian88773762012-04-17 18:40:53 +00008extern "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
38int
39
40__declspec (dllexport)
41
42main (int argc, char *argv[])
43{
44 __block int bBlockVariable = 0;
45 void (^aBlock)(void) = ^ {
46 bBlockVariable = 42;
47 };
48}
Fariborz Jahanianca357d92012-04-19 00:50:01 +000049
50// rdar://11275241
51static char stringtype;
52char CFStringGetTypeID();
53void x(void (^)());
54
Fariborz Jahaniandf0577d2012-04-19 16:30:28 +000055static void initStatics(int arg, ...) {
Fariborz Jahanianca357d92012-04-19 00:50:01 +000056 x(^{
57 stringtype = CFStringGetTypeID();
58 });
59}
Fariborz Jahaniandf0577d2012-04-19 16:30:28 +000060static void initStatics1(...) {
61 x(^{
62 stringtype = CFStringGetTypeID();
63 });
64}
65static void initStatics2() {
66 x(^{
67 stringtype = CFStringGetTypeID();
68 });
69}
70
Fariborz Jahaniane49a42c2012-04-25 17:56:48 +000071// rdar://11314329
72static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; }