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
5#include "Common.h"
6
7void NSLog(id, ...);
8
9int 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
27void 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
40int UIApplicationMain(int argc, char *argv[]);
41
42int main2(int argc, char *argv[]) {
43    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
44    int result = UIApplicationMain(argc, argv);
45    [pool release];
46    return result;
47}
48
49@interface Foo : NSObject
50@property (assign) id myProp;
51@end
52
53@implementation Foo
54@synthesize myProp;
55
56-(void)test:(id)p {
57  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
58  [pool drain];
59  self.myProp = p;
60}
61@end
62