Daniel Dunbar | c1ab900 | 2009-07-11 20:32:50 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -emit-llvm %s -o %t |
| 2 | |
| 3 | void p(const char*, ...); |
| 4 | |
| 5 | @interface NSArray |
| 6 | +(NSArray*) arrayWithObjects: (id) first, ...; |
| 7 | -(unsigned) count; |
| 8 | @end |
| 9 | @interface NSString |
| 10 | -(const char*) cString; |
| 11 | @end |
| 12 | |
| 13 | #define S(n) @#n |
| 14 | #define L1(n) S(n+0),S(n+1) |
| 15 | #define L2(n) L1(n+0),L1(n+2) |
| 16 | #define L3(n) L2(n+0),L2(n+4) |
| 17 | #define L4(n) L3(n+0),L3(n+8) |
| 18 | #define L5(n) L4(n+0),L4(n+16) |
| 19 | #define L6(n) L5(n+0),L5(n+32) |
| 20 | |
| 21 | void t0() { |
| 22 | NSArray *array = [NSArray arrayWithObjects: L1(0), (void*)0]; |
| 23 | |
| 24 | p("array.length: %d\n", [array count]); |
| 25 | unsigned index = 0; |
| 26 | for (NSString *i in array) { |
| 27 | p("element %d: %s\n", index++, [i cString]); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | void t1() { |
| 32 | NSArray *array = [NSArray arrayWithObjects: L6(0), (void*)0]; |
| 33 | |
| 34 | p("array.length: %d\n", [array count]); |
| 35 | unsigned index = 0; |
| 36 | for (NSString *i in array) { |
| 37 | index++; |
| 38 | if (index == 10) |
| 39 | continue; |
| 40 | p("element %d: %s\n", index, [i cString]); |
| 41 | if (index == 55) |
| 42 | break; |
| 43 | } |
| 44 | } |