Debian Codegraph @

clang/test/ARCMT/objcmt-property.m

raw
1 // RUN: rm -rf %t
2 // 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
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 #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION
7 #define WEAK_IMPORT_ATTRIBUTE __attribute__((objc_arc_weak_reference_unavailable))
8 #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
9 #define DEPRECATED __attribute__((deprecated))
10
11 typedef char BOOL;
12 @class NSString;
13 @protocol NSCopying @end
14
15 @interface NSObject <NSCopying>
16 @end
17
18 @interface NSDictionary : NSObject
19 @end
20
21 @interface I : NSObject {
22 int ivarVal;
23 }
24 - (void) setWeakProp : (NSString *__weak)Val;
25 - (NSString *__weak) WeakProp;
26
27 - (NSString *) StrongProp;
28 - (void) setStrongProp : (NSString *)Val;
29
30 - (NSString *) UnavailProp __attribute__((unavailable));
31 - (void) setUnavailProp : (NSString *)Val;
32
33 - (NSString *) UnavailProp1 __attribute__((unavailable));
34 - (void) setUnavailProp1 : (NSString *)Val __attribute__((unavailable));
35
36 - (NSString *) UnavailProp2;
37 - (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
38
39 - (NSDictionary*) undoAction;
40 - (void) setUndoAction: (NSDictionary*)Arg;
41 @end
42
43 @implementation I
44 @end
45
46 @class NSArray;
47
48 @interface MyClass2 {
49 @private
50 NSArray *_names1;
51 NSArray *_names2;
52 NSArray *_names3;
53 NSArray *_names4;
54 }
55 - (void)setNames1:(NSArray *)names;
56 - (void)setNames4:(__strong NSArray *)names;
57 - (void)setNames3:(__strong NSArray *)names;
58 - (void)setNames2:(NSArray *)names;
59 - (NSArray *) names2;
60 - (NSArray *)names3;
61 - (__strong NSArray *)names4;
62 - (NSArray *) names1;
63 @end
64
65 // Properties that contain the name "delegate" or "dataSource",
66 // or have exact name "target" have unsafe_unretained attribute.
67 @interface NSInvocation
68 - (id)target;
69 - (void)setTarget:(id)target;
70
71 - (id) dataSource;
72
73 - (id)delegate;
74
75 - (id)xxxdelegateYYY;
76 - (void)setXxxdelegateYYY:(id)delegate;
77
78 - (void)setDataSource:(id)source;
79
80 - (id)MYtarget;
81 - (void)setMYtarget: (id)target;
82
83 - (id)targetX;
84 - (void)setTargetX: (id)t;
85
86 - (int)value;
87 - (void)setValue: (int)val;
88
89 -(BOOL) isContinuous;
90 -(void) setContinuous:(BOOL)value;
91
92 - (id) isAnObject;
93 - (void)setAnObject : (id) object;
94
95 - (BOOL) isinValid;
96 - (void) setInValid : (BOOL) arg;
97
98 - (void) Nothing;
99 - (int) Length;
100 - (id) object;
101 + (double) D;
102 - (void *)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
103 - (BOOL)isIgnoringInteractionEvents;
104
105 - (NSString *)getStringValue;
106 - (BOOL)getCounterValue;
107 - (void)setStringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
108 - (NSDictionary *)getns_dixtionary;
109
110 - (BOOL)is3bar; // watch out
111 - (NSString *)get3foo; // watch out
112
113 - (BOOL) getM;
114 - (BOOL) getMA;
115 - (BOOL) getALL;
116 - (BOOL) getMANY;
117 - (BOOL) getSome;
118 @end
119
120
121 @interface NSInvocation(CAT)
122 - (id)target;
123 - (void)setTarget:(id)target;
124
125 - (id) dataSource;
126
127 - (id)xxxdelegateYYY;
128 - (void)setXxxdelegateYYY:(id)delegate;
129
130 - (void)setDataSource:(id)source;
131
132 - (id)MYtarget;
133 - (void)setMYtarget: (id)target;
134
135 - (id)targetX;
136 - (void)setTargetX: (id)t;
137
138 - (int)value;
139 - (void)setValue: (int)val;
140
141 -(BOOL) isContinuous;
142 -(void) setContinuous:(BOOL)value;
143
144 - (id) isAnObject;
145 - (void)setAnObject : (id) object;
146
147 - (BOOL) isinValid;
148 - (void) setInValid : (BOOL) arg;
149
150 - (void) Nothing;
151 - (int) Length;
152 - (id) object;
153 + (double) D;
154
155 - (BOOL)is3bar; // watch out
156 - (NSString *)get3foo; // watch out
157
158 - (BOOL) getM;
159 - (BOOL) getMA;
160 - (BOOL) getALL;
161 - (BOOL) getMANY;
162 - (BOOL) getSome;
163 @end
164
165 DEPRECATED
166 @interface I_DEP
167 - (BOOL) isinValid;
168 - (void) setInValid : (BOOL) arg;
169 @end
170
171 @interface AnotherOne
172 - (BOOL) isinValid DEPRECATED;
173 - (void) setInValid : (BOOL) arg;
174 - (id)MYtarget;
175 - (void)setMYtarget: (id)target DEPRECATED;
176 - (BOOL) getM DEPRECATED;
177
178 - (id)xxxdelegateYYY DEPRECATED;
179 - (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
180 @end
181
182 #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
183 #define NORETURN __attribute__((noreturn))
184 #define ALIGNED __attribute__((aligned(16)))
185
186 @interface NSURL
187 // Do not infer a property.
188 - (NSURL *)appStoreReceiptURL NS_AVAILABLE;
189 - (void) setAppStoreReceiptURL : (NSURL *)object;
190
191 - (NSURL *)appStoreReceiptURLX NS_AVAILABLE;
192 - (void) setAppStoreReceiptURLX : (NSURL *)object NS_AVAILABLE;
193
194 // Do not infer a property.
195 - (NSURL *)appStoreReceiptURLY ;
196 - (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
197
198 - (id)OkToInfer NS_AVAILABLE;
199
200 // Do not infer a property.
201 - (NSURL *)appStoreReceiptURLZ ;
202 - (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
203
204 // Do not infer a property.
205 - (id) t1 NORETURN NS_AVAILABLE;
206 - (void) setT1 : (id) arg NS_AVAILABLE;
207
208 - (id)method1 ALIGNED NS_AVAILABLE;
209 - (void) setMethod1 : (id) object NS_AVAILABLE ALIGNED;
210
211 - (NSURL *)init; // No Change
212 + (id)alloc; // No Change
213
214 - (BOOL)is1stClass; // Not a valid property
215 - (BOOL)isClass; // This is a valid property 'class' is not a keyword in ObjC
216 - (BOOL)isDouble; // Not a valid property
217
218 @end
219
220 @class NSMutableDictionary;
221
222 @interface NSArray
223 - (id (^)(id, NSArray *, NSMutableDictionary *)) expressionBlock;
224 - (id (^)(id, NSArray *, NSMutableDictionary *)) MyBlock;
225 - (void) setMyBlock : (id (^)(id, NSArray *, NSMutableDictionary *)) bl;
226 - (id (*)(id, NSArray *, NSMutableDictionary *)) expressionFuncptr;
227 - (id (*)(id, NSArray *, NSMutableDictionary *)) MyFuncptr;
228 - (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
229 @end
230
231 @interface rdar15231241
232 @property (nonatomic, readonly) double Ddelegate;
233 @property (nonatomic, readonly) float Fdelegate;
234 @property (nonatomic, readonly) int Idelegate;
235 @property (nonatomic, readonly) BOOL Bdelegate;
236 @end
237
238 @protocol NSObject @end
239 @protocol MyProtocol <NSObject>
240 - (id)readonlyProperty;
241 - (id)readWriteProperty;
242 - (void)setReadWriteProperty:(id)readWriteProperty;
243 @end