Debian Codegraph @

clang/test/ARCMT/objcmt-property-dot-syntax.m

raw
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -objcmt-migrate-property-dot-syntax -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
3 // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
4 // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
5
6 @class NSString;
7
8 @protocol NSObject
9 @property (readonly, copy) NSString *description;
10 @end
11
12 @interface NSObject <NSObject> @end
13
14 @interface P : NSObject
15 {
16 P* obj;
17 int i1, i2, i3;
18 }
19 @property int count;
20 @property (copy) P* PropertyReturnsPObj;
21 - (P*) MethodReturnsPObj;
22 @end
23
24 P* fun(void);
25
26 @implementation P
27 - (int) Meth : (P*)array {
28 [obj setCount : 100];
29
30 [(P*)0 setCount : [array count]];
31
32 [[obj PropertyReturnsPObj] setCount : [array count]];
33
34 [obj setCount : (i1+i2*i3 - 100)];
35
36 return [obj count] -
37 [(P*)0 count] + [array count] +
38 [fun() count] -
39 [[obj PropertyReturnsPObj] count] +
40 [self->obj count];
41 }
42
43 - (P*) MethodReturnsPObj { return 0; }
44
45 - (NSString *)description { return [super description]; }
46 @end
47
48 @interface Sub : P
49 @end
50
51 @implementation Sub
52 - (int) Meth : (P*)array {
53 [super setCount : 100];
54
55 [super setCount : [array count]];
56
57 [[super PropertyReturnsPObj] setCount : [array count]];
58
59 [super setCount : (i1+i2*i3 - 100)];
60
61 return [super count] -
62 [(P*)0 count] + [array count] +
63 [fun() count] -
64 [[super PropertyReturnsPObj] count] +
65 [self->obj count];
66 }
67 @end
68
69
70 @interface Rdar19038838
71 @property id newItem; // should be marked objc_method_family(none), but isn't.
72 @end
73
74 id testRdar19038838(Rdar19038838 *obj) {
75 return [obj newItem];
76 }
77
78 @interface rdar19381786 : NSObject
79 {
80 rdar19381786* obj;
81 }
82 @property int count;
83 @end
84
85 @protocol PR
86 @property int count;
87 @end
88
89 @implementation rdar19381786
90 -(void)test:(id)some : (id<PR>)qsome : (SEL)selsome
91 {
92 [obj setCount : 100];
93 [some setCount : [some count]];
94 [qsome setCount : [qsome count]];
95 }
96 @end
97
98 int NSOnState;
99 int ArrNSOnState[4];
100 @interface rdar19140114 : NSObject
101 {
102 rdar19140114* menuItem;
103 }
104 @property int state;
105 @end
106
107 @implementation rdar19140114
108 - (void) Meth {
109 [menuItem setState:NSOnState];
110 [menuItem setState :NSOnState];
111 [menuItem setState :ArrNSOnState[NSOnState]];
112 [menuItem setState : NSOnState];
113 [menuItem setState: NSOnState];
114 [menuItem setState: NSOnState];
115 [menuItem setState : NSOnState];
116 }
117 @end