llvm-project
71 строка · 1.2 Кб
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
7id IhaveSideEffect(void);
8
9@interface Foo : NSObject {
10id 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 {
27id x = self.bar;
28[x retain];
29self.bar = obj;
30if (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];
45return [self retain];
46}
47
48- (id)test1 {
49id x=0;
50([x retain]);
51return ((([x retain])));
52}
53@end
54
55id foo (Foo *p) {
56p = [p retain];
57return ([p retain]);
58}
59
60void block_tests(Foo *p) {
61id (^B)(void) = ^(void) {
62if (p) {
63id (^IB)(void) = ^(void) {
64id bar = [p retain];
65return bar;
66};
67IB();
68}
69return [p retain];
70};
71}
72