John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp |
Rafael Espindola | 437bbff | 2013-06-07 18:41:01 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=struct objc_object*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
Fariborz Jahanian | 42f1e65 | 2011-02-24 21:29:21 +0000 | [diff] [blame] | 3 | |
| 4 | void *sel_registerName(const char *); |
| 5 | void objc_enumerationMutation(id); |
Fariborz Jahanian | e8d1c05 | 2008-01-15 23:58:23 +0000 | [diff] [blame] | 6 | |
| 7 | @interface MyList |
| 8 | - (id) allKeys; |
| 9 | @end |
| 10 | |
| 11 | @implementation MyList |
| 12 | - (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount |
| 13 | { |
| 14 | return 0; |
| 15 | } |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 16 | - (id) allKeys { return 0; } |
Fariborz Jahanian | e8d1c05 | 2008-01-15 23:58:23 +0000 | [diff] [blame] | 17 | @end |
| 18 | |
| 19 | @interface MyList (BasicTest) |
| 20 | - (void)compilerTestAgainst; |
| 21 | @end |
| 22 | |
| 23 | int LOOP(); |
| 24 | @implementation MyList (BasicTest) |
| 25 | - (void)compilerTestAgainst { |
| 26 | MyList * el; |
| 27 | int i; |
| 28 | for (el in [el allKeys]) { |
| 29 | for (i = 0; i < 10; i++) |
| 30 | if (i == 5) |
| 31 | break; |
| 32 | |
| 33 | if (el == 0) |
| 34 | break; |
| 35 | if (el != self) |
| 36 | continue; |
| 37 | LOOP(); |
| 38 | } |
| 39 | |
| 40 | for (id el1 in[el allKeys]) { |
| 41 | LOOP(); |
| 42 | for (el in self) { |
| 43 | if (el) |
| 44 | continue; |
| 45 | } |
| 46 | if (el1) |
| 47 | break; |
| 48 | } |
| 49 | } |
| 50 | @end |
| 51 | |