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 3 // RUN: diff %t %s.result 4 // DISABLE: mingw32 5 6 @interface NSAutoreleasePool 7 - drain; 8 +new; 9 +alloc; 10 -init; 11 -autorelease; 12 - release; 13 @end 14 15 void NSLog(id, ...); 16 17 void test1(int x) { 18 // All this stuff get removed since nothing is happening inside. 19 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 20 NSAutoreleasePool *chunkPool = [[NSAutoreleasePool alloc] init]; 21 while (x) { 22 chunkPool = [[NSAutoreleasePool alloc] init]; 23 [chunkPool release]; 24 } 25 26 [chunkPool drain]; 27 [pool drain]; 28 } 29 30 void test2(int x) { 31 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 32 NSAutoreleasePool *chunkPool = [[NSAutoreleasePool alloc] init]; 33 while (x) { 34 chunkPool = [[NSAutoreleasePool alloc] init]; 35 ++x; 36 [chunkPool release]; 37 } 38 39 [chunkPool drain]; 40 [pool drain]; 41 } 42