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 |
Argyrios Kyrtzidis | d8b4216 | 2012-01-12 02:34:32 +0000 | [diff] [blame] | 4 | // DISABLE: mingw32 |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 5 | |
| 6 | #include "Common.h" |
| 7 | |
| 8 | void NSLog(id, ...); |
| 9 | |
| 10 | int main (int argc, const char * argv[]) { |
| 11 | |
| 12 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 13 | |
| 14 | if (argc) { |
| 15 | NSAutoreleasePool * pool = [NSAutoreleasePool new]; |
| 16 | NSLog(@"%s", "YES"); |
| 17 | [pool drain]; |
| 18 | } |
| 19 | [pool drain]; |
| 20 | |
| 21 | NSAutoreleasePool * pool1 = [[NSAutoreleasePool alloc] init]; |
| 22 | NSLog(@"%s", "YES"); |
| 23 | [pool1 release]; |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | void f(void) { |
| 29 | NSAutoreleasePool *pool1; |
| 30 | |
| 31 | pool1 = [NSAutoreleasePool new]; |
| 32 | int x = 4; |
| 33 | |
| 34 | NSAutoreleasePool *pool2 = [[NSAutoreleasePool alloc] init]; |
| 35 | ++x; |
| 36 | [pool2 drain]; |
| 37 | |
| 38 | [pool1 release]; |
| 39 | } |
| 40 | |
| 41 | int UIApplicationMain(int argc, char *argv[]); |
| 42 | |
| 43 | int main2(int argc, char *argv[]) { |
| 44 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
| 45 | int result = UIApplicationMain(argc, argv); |
| 46 | [pool release]; |
| 47 | return result; |
| 48 | } |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 49 | |
| 50 | @interface Foo : NSObject |
| 51 | @property (assign) id myProp; |
| 52 | @end |
| 53 | |
| 54 | @implementation Foo |
| 55 | @synthesize myProp; |
| 56 | |
| 57 | -(void)test:(id)p { |
| 58 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
| 59 | [pool drain]; |
| 60 | self.myProp = p; |
| 61 | } |
| 62 | @end |