Fariborz Jahanian | 9e0393d | 2012-02-04 19:06:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp |
Fariborz Jahanian | 7c7e349 | 2010-03-04 21:57:21 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
Fariborz Jahanian | a73165e | 2010-01-14 23:05:52 +0000 | [diff] [blame] | 3 | // radar 7540194 |
| 4 | |
| 5 | extern "C" __declspec(dllexport) void BreakTheRewriter(int i) { |
| 6 | __block int aBlockVariable = 0; |
| 7 | void (^aBlock)(void) = ^ { |
| 8 | aBlockVariable = 42; |
| 9 | }; |
| 10 | aBlockVariable++; |
| 11 | if (i) { |
| 12 | __block int bbBlockVariable = 0; |
| 13 | void (^aBlock)(void) = ^ { |
| 14 | bbBlockVariable = 42; |
| 15 | }; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | __declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter(void) { |
| 20 | |
| 21 | __block int aBlockVariable = 0; |
| 22 | void (^aBlock)(void) = ^ { |
| 23 | aBlockVariable = 42; |
| 24 | }; |
| 25 | aBlockVariable++; |
| 26 | void (^bBlocks)(void) = ^ { |
| 27 | aBlockVariable = 43; |
| 28 | }; |
| 29 | void (^c)(void) = ^ { |
| 30 | aBlockVariable = 44; |
| 31 | }; |
| 32 | |
| 33 | } |
| 34 | |
Fariborz Jahanian | dfa4fa0 | 2010-01-16 19:36:43 +0000 | [diff] [blame] | 35 | @interface I |
| 36 | { |
| 37 | id list; |
| 38 | } |
| 39 | - (void) Meth; |
Fariborz Jahanian | 0e1c99a | 2010-01-29 01:55:49 +0000 | [diff] [blame] | 40 | // radar 7589385 use before definition |
| 41 | - (void) allObjects; |
Fariborz Jahanian | dfa4fa0 | 2010-01-16 19:36:43 +0000 | [diff] [blame] | 42 | @end |
| 43 | |
| 44 | @implementation I |
Fariborz Jahanian | 0e1c99a | 2010-01-29 01:55:49 +0000 | [diff] [blame] | 45 | // radar 7589385 use before definition |
| 46 | - (void) allObjects { |
| 47 | __attribute__((__blocks__(byref))) id *listp; |
| 48 | |
| 49 | ^(void) { |
| 50 | *listp++ = 0; |
| 51 | }; |
| 52 | } |
Fariborz Jahanian | dfa4fa0 | 2010-01-16 19:36:43 +0000 | [diff] [blame] | 53 | - (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; } |
| 54 | @end |
| 55 | |
Fariborz Jahanian | 9e0393d | 2012-02-04 19:06:06 +0000 | [diff] [blame] | 56 | // $CLANG -cc1 -fms-extensions -rewrite-objc -fobjc-fragile-abi -x objective-c++ -fblocks bug.mm |
Fariborz Jahanian | a73165e | 2010-01-14 23:05:52 +0000 | [diff] [blame] | 57 | // g++ -c -D"__declspec(X)=" bug.cpp |