blob: a6aed146497b437b944324910a9a4d65ff9007e3 [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
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}
Argyrios Kyrtzidis18fd0c62011-07-27 05:28:18 +000048
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