llvm-project
65 строк · 993.0 Байт
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 (strong) 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;
28self.bar = obj;
29
30Something_Macro(@"foo", "@bar");
31
32IhaveSideEffect();
33
34[self something];
35
36[self something];
37
38IhaveSideEffect();
39// do stuff with x;
40return self;
41}
42
43- (id)test1 {
44id x=0;
45return (((x)));
46}
47@end
48
49id foo (Foo *p) {
50p = p;
51return (p);
52}
53
54void block_tests(Foo *p) {
55id (^B)(void) = ^(void) {
56if (p) {
57id (^IB)(void) = ^(void) {
58id bar = p;
59return bar;
60};
61IB();
62}
63return p;
64};
65}
66