summaryrefslogtreecommitdiffstats
path: root/test/ARCMT/objcmt-property.m
blob: 1ea41093850db4a71e26b9f7772fecc9ed3f9b35 (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// RUN: rm -rf %t
// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -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

#define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION
#define WEAK_IMPORT_ATTRIBUTE __attribute__((objc_arc_weak_reference_unavailable))
#define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
#define DEPRECATED  __attribute__((deprecated)) 

typedef char BOOL;
@class NSString;
@protocol NSCopying @end

@interface NSObject <NSCopying>
@end

@interface NSDictionary : NSObject
@end

@interface I : NSObject {
  int ivarVal;
}
- (void) setWeakProp : (NSString *__weak)Val;
- (NSString *__weak) WeakProp;

- (NSString *) StrongProp;
- (void) setStrongProp : (NSString *)Val;

- (NSString *) UnavailProp  __attribute__((unavailable));
- (void) setUnavailProp  : (NSString *)Val;

- (NSString *) UnavailProp1  __attribute__((unavailable));
- (void) setUnavailProp1  : (NSString *)Val  __attribute__((unavailable));

- (NSString *) UnavailProp2;
- (void) setUnavailProp2  : (NSString *)Val  __attribute__((unavailable));

- (NSDictionary*) undoAction;
- (void) setUndoAction: (NSDictionary*)Arg;
@end

@implementation I
@end

@class NSArray;

@interface MyClass2  {
@private
    NSArray *_names1;
    NSArray *_names2;
    NSArray *_names3;
    NSArray *_names4;
}
- (void)setNames1:(NSArray *)names;
- (void)setNames4:(__strong NSArray *)names;
- (void)setNames3:(__strong NSArray *)names;
- (void)setNames2:(NSArray *)names;
- (NSArray *) names2;
- (NSArray *)names3;
- (__strong NSArray *)names4;
- (NSArray *) names1;
@end

// Properties that contain the name "delegate" or "dataSource",
// or have exact name "target" have unsafe_unretained attribute.
@interface NSInvocation 
- (id)target;
- (void)setTarget:(id)target;

- (id) dataSource;

// rdar://15509831
- (id)delegate;

- (id)xxxdelegateYYY;
- (void)setXxxdelegateYYY:(id)delegate;

- (void)setDataSource:(id)source;

- (id)MYtarget;
- (void)setMYtarget: (id)target;

- (id)targetX;
- (void)setTargetX: (id)t;
 
- (int)value;
- (void)setValue: (int)val;

-(BOOL) isContinuous;
-(void) setContinuous:(BOOL)value;

- (id) isAnObject;
- (void)setAnObject : (id) object;

- (BOOL) isinValid;
- (void) setInValid : (BOOL) arg;

- (void) Nothing;
- (int) Length;
- (id) object;
+ (double) D;
- (void *)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
- (BOOL)isIgnoringInteractionEvents;

- (NSString *)getStringValue;
- (BOOL)getCounterValue;
- (void)setStringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
- (NSDictionary *)getns_dixtionary;

- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out

- (BOOL) getM;
- (BOOL) getMA;
- (BOOL) getALL;
- (BOOL) getMANY;
- (BOOL) getSome;
@end


@interface NSInvocation(CAT)
- (id)target;
- (void)setTarget:(id)target;

- (id) dataSource;

- (id)xxxdelegateYYY;
- (void)setXxxdelegateYYY:(id)delegate;

- (void)setDataSource:(id)source;

- (id)MYtarget;
- (void)setMYtarget: (id)target;

- (id)targetX;
- (void)setTargetX: (id)t;

- (int)value;
- (void)setValue: (int)val;

-(BOOL) isContinuous;
-(void) setContinuous:(BOOL)value;

- (id) isAnObject;
- (void)setAnObject : (id) object;

- (BOOL) isinValid;
- (void) setInValid : (BOOL) arg;

- (void) Nothing;
- (int) Length;
- (id) object;
+ (double) D;

- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out

- (BOOL) getM;
- (BOOL) getMA;
- (BOOL) getALL;
- (BOOL) getMANY;
- (BOOL) getSome;
@end

DEPRECATED
@interface I_DEP
- (BOOL) isinValid;
- (void) setInValid : (BOOL) arg;
@end

@interface AnotherOne
- (BOOL) isinValid DEPRECATED;
- (void) setInValid : (BOOL) arg;
- (id)MYtarget;
- (void)setMYtarget: (id)target DEPRECATED;
- (BOOL) getM DEPRECATED;

- (id)xxxdelegateYYY DEPRECATED;
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end

// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))

@interface NSURL
// Do not infer a property.
- (NSURL *)appStoreReceiptURL NS_AVAILABLE;
- (void) setAppStoreReceiptURL : (NSURL *)object;

- (NSURL *)appStoreReceiptURLX NS_AVAILABLE;
- (void) setAppStoreReceiptURLX : (NSURL *)object NS_AVAILABLE;

// Do not infer a property.
- (NSURL *)appStoreReceiptURLY ;
- (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;

- (id)OkToInfer NS_AVAILABLE;

// Do not infer a property.
- (NSURL *)appStoreReceiptURLZ ;
- (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;

// Do not infer a property.
- (id) t1 NORETURN NS_AVAILABLE;
- (void) setT1 : (id) arg NS_AVAILABLE;

- (id)method1 ALIGNED NS_AVAILABLE;
- (void) setMethod1 : (id) object NS_AVAILABLE ALIGNED;

- (NSURL *)init;  // No Change
+ (id)alloc;      // No Change

- (BOOL)is1stClass; // Not a valid property
- (BOOL)isClass;    // This is a valid property 'class' is not a keyword in ObjC
- (BOOL)isDouble; // Not a valid property

@end

// rdar://15082818
@class NSMutableDictionary;

@interface NSArray
- (id (^)(id, NSArray *, NSMutableDictionary *)) expressionBlock;
- (id (^)(id, NSArray *, NSMutableDictionary *)) MyBlock;
- (void) setMyBlock : (id (^)(id, NSArray *, NSMutableDictionary *)) bl;
- (id (*)(id, NSArray *, NSMutableDictionary *)) expressionFuncptr;
- (id (*)(id, NSArray *, NSMutableDictionary *)) MyFuncptr;
- (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
@end

// rdar://15231241
@interface rdar15231241
@property (nonatomic, readonly) double Ddelegate;
@property (nonatomic, readonly) float Fdelegate;
@property (nonatomic, readonly) int Idelegate;
@property (nonatomic, readonly) BOOL Bdelegate;
@end

// rdar://19372798
@protocol NSObject @end
@protocol MyProtocol <NSObject>
- (id)readonlyProperty;
- (id)readWriteProperty;
- (void)setReadWriteProperty:(id)readWriteProperty;
@end