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