Home | History | Annotate | Download | only in ARCMT
      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 #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 }
     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
     63