blob: 132553bdd331baf7651a6a7afeef8b5e85da8c02 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// 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 McCall8f0e8d22011-06-15 23:25:17 +00003// RUN: diff %t %s.result
Argyrios Kyrtzidisd8b42162012-01-12 02:34:32 +00004// DISABLE: mingw32
John McCall8f0e8d22011-06-15 23:25:17 +00005
6#include "Common.h"
7
8void NSLog(id, ...);
9
10int 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
28void 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
41int UIApplicationMain(int argc, char *argv[]);
42
43int 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 Kyrtzidis18fd0c62011-07-27 05:28:18 +000049
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