John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result |
| 2 | // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 4 | |
| 5 | @interface NSAutoreleasePool |
| 6 | - drain; |
| 7 | +new; |
| 8 | +alloc; |
| 9 | -init; |
| 10 | -autorelease; |
| 11 | - release; |
| 12 | @end |
| 13 | |
| 14 | void NSLog(id, ...); |
| 15 | |
| 16 | void test1(int x) { |
| 17 | // All this stuff get removed since nothing is happening inside. |
| 18 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 19 | NSAutoreleasePool *chunkPool = [[NSAutoreleasePool alloc] init]; |
| 20 | while (x) { |
| 21 | chunkPool = [[NSAutoreleasePool alloc] init]; |
| 22 | [chunkPool release]; |
| 23 | } |
| 24 | |
| 25 | [chunkPool drain]; |
| 26 | [pool drain]; |
| 27 | } |
| 28 | |
| 29 | void test2(int x) { |
| 30 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 31 | NSAutoreleasePool *chunkPool = [[NSAutoreleasePool alloc] init]; |
| 32 | while (x) { |
| 33 | chunkPool = [[NSAutoreleasePool alloc] init]; |
| 34 | ++x; |
| 35 | [chunkPool release]; |
| 36 | } |
| 37 | |
| 38 | [chunkPool drain]; |
| 39 | [pool drain]; |
| 40 | } |