blob: 2011e506360c575526e12016d793704d4f363f41 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// 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
John McCall8f0e8d22011-06-15 23:25:17 +00003// RUN: diff %t %s.result
4
5#include "Common.h"
6
7id IhaveSideEffect();
8
9@interface Foo : NSObject {
10 id bar;
11}
Fariborz Jahanian86f96012012-01-20 19:15:02 +000012@property (strong) id bar;
John McCall8f0e8d22011-06-15 23:25:17 +000013-(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 self.bar = obj;
29
30 Something_Macro(@"foo", "@bar");
31
32 IhaveSideEffect();
33
34 [self something];
35
36 [self something];
37
38 IhaveSideEffect();
39 // do stuff with x;
40 return self;
41}
42
43- (id)test1 {
44 id x=0;
45 return (((x)));
46}
47@end
48
49id foo (Foo *p) {
50 p = p;
51 return (p);
52}
53
54void block_tests(Foo *p) {
55 id (^B)() = ^() {
56 if (p) {
57 id (^IB)() = ^() {
58 id bar = p;
59 return bar;
60 };
61 IB();
62 }
63 return p;
64 };
65}