Debian Codegraph @

clang/test/ARCMT/retains.m

raw
1 // RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result
2 // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -x objective-c %s > %t
3 // RUN: diff %t %s.result
4
5 #include "Common.h"
6
7 id IhaveSideEffect(void);
8
9 @interface Foo : NSObject {
10 id bar;
11 }
12 @property (retain) id bar;
13 -(id)test:(id)obj;
14 -(id)something;
15 @end
16
17 #define Something_Macro(key, comment) \
18 [[Foo new] something]
19
20 @implementation Foo
21
22 @synthesize bar;
23
24 -(id)something {}
25
26 -(id)test:(id)obj {
27 id x = self.bar;
28 [x retain];
29 self.bar = obj;
30 if (obj)
31 [obj retain];
32
33 [Something_Macro(@"foo", "@bar") retain];
34
35 [IhaveSideEffect() retain];
36
37 [[self something] retain];
38
39 [[self retain] something];
40
41 [[IhaveSideEffect() retain] release];
42 [[x retain] release];
43 // do stuff with x;
44 [x release];
45 return [self retain];
46 }
47
48 - (id)test1 {
49 id x=0;
50 ([x retain]);
51 return ((([x retain])));
52 }
53 @end
54
55 id foo (Foo *p) {
56 p = [p retain];
57 return ([p retain]);
58 }
59
60 void block_tests(Foo *p) {
61 id (^B)(void) = ^(void) {
62 if (p) {
63 id (^IB)(void) = ^(void) {
64 id bar = [p retain];
65 return bar;
66 };
67 IB();
68 }
69 return [p retain];
70 };
71 }