John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result |
Argyrios Kyrtzidis | eaed19e | 2011-06-16 00:53:46 +0000 | [diff] [blame] | 2 | // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -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 |
| 4 | |
| 5 | #include "Common.h" |
| 6 | |
| 7 | void NSLog(id, ...); |
| 8 | |
| 9 | int main (int argc, const char * argv[]) { |
| 10 | |
| 11 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 12 | |
| 13 | if (argc) { |
| 14 | NSAutoreleasePool * pool = [NSAutoreleasePool new]; |
| 15 | NSLog(@"%s", "YES"); |
| 16 | [pool drain]; |
| 17 | } |
| 18 | [pool drain]; |
| 19 | |
| 20 | NSAutoreleasePool * pool1 = [[NSAutoreleasePool alloc] init]; |
| 21 | NSLog(@"%s", "YES"); |
| 22 | [pool1 release]; |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | void f(void) { |
| 28 | NSAutoreleasePool *pool1; |
| 29 | |
| 30 | pool1 = [NSAutoreleasePool new]; |
| 31 | int x = 4; |
| 32 | |
| 33 | NSAutoreleasePool *pool2 = [[NSAutoreleasePool alloc] init]; |
| 34 | ++x; |
| 35 | [pool2 drain]; |
| 36 | |
| 37 | [pool1 release]; |
| 38 | } |
| 39 | |
| 40 | int UIApplicationMain(int argc, char *argv[]); |
| 41 | |
| 42 | int main2(int argc, char *argv[]) { |
| 43 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 44 | int result = UIApplicationMain(argc, argv); |
| 45 | [pool release]; |
| 46 | return result; |
| 47 | } |