]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ARCMT/objcmt-property.m
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / ARCMT / objcmt-property.m
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)xxxdelegateYYY;
74 - (void)setXxxdelegateYYY:(id)delegate;
75
76 - (void)setDataSource:(id)source;
77
78 - (id)MYtarget;
79 - (void)setMYtarget: (id)target;
80
81 - (id)targetX;
82 - (void)setTargetX: (id)t;
83  
84 - (int)value;
85 - (void)setValue: (int)val;
86
87 -(BOOL) isContinuous;
88 -(void) setContinuous:(BOOL)value;
89
90 - (id) isAnObject;
91 - (void)setAnObject : (id) object;
92
93 - (BOOL) isinValid;
94 - (void) setInValid : (BOOL) arg;
95
96 - (void) Nothing;
97 - (int) Length;
98 - (id) object;
99 + (double) D;
100 - (void *)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
101 - (BOOL)isIgnoringInteractionEvents;
102
103 - (NSString *)getStringValue;
104 - (BOOL)getCounterValue;
105 - (void)setStringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
106 - (NSDictionary *)getns_dixtionary;
107
108 - (BOOL)is3bar; // watch out
109 - (NSString *)get3foo; // watch out
110
111 - (BOOL) getM;
112 - (BOOL) getMA;
113 - (BOOL) getALL;
114 - (BOOL) getMANY;
115 - (BOOL) getSome;
116 @end
117
118
119 @interface NSInvocation(CAT)
120 - (id)target;
121 - (void)setTarget:(id)target;
122
123 - (id) dataSource;
124
125 - (id)xxxdelegateYYY;
126 - (void)setXxxdelegateYYY:(id)delegate;
127
128 - (void)setDataSource:(id)source;
129
130 - (id)MYtarget;
131 - (void)setMYtarget: (id)target;
132
133 - (id)targetX;
134 - (void)setTargetX: (id)t;
135
136 - (int)value;
137 - (void)setValue: (int)val;
138
139 -(BOOL) isContinuous;
140 -(void) setContinuous:(BOOL)value;
141
142 - (id) isAnObject;
143 - (void)setAnObject : (id) object;
144
145 - (BOOL) isinValid;
146 - (void) setInValid : (BOOL) arg;
147
148 - (void) Nothing;
149 - (int) Length;
150 - (id) object;
151 + (double) D;
152
153 - (BOOL)is3bar; // watch out
154 - (NSString *)get3foo; // watch out
155
156 - (BOOL) getM;
157 - (BOOL) getMA;
158 - (BOOL) getALL;
159 - (BOOL) getMANY;
160 - (BOOL) getSome;
161 @end
162
163 DEPRECATED
164 @interface I_DEP
165 - (BOOL) isinValid;
166 - (void) setInValid : (BOOL) arg;
167 @end
168
169 @interface AnotherOne
170 - (BOOL) isinValid DEPRECATED;
171 - (void) setInValid : (BOOL) arg;
172 - (id)MYtarget;
173 - (void)setMYtarget: (id)target DEPRECATED;
174 - (BOOL) getM DEPRECATED;
175
176 - (id)xxxdelegateYYY DEPRECATED;
177 - (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
178 @end
179
180 // rdar://14987909
181 #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
182 #define NORETURN __attribute__((noreturn))
183 #define ALIGNED __attribute__((aligned(16)))
184
185 @interface NSURL
186 // Do not infer a property.
187 - (NSURL *)appStoreReceiptURL NS_AVAILABLE;
188 - (void) setAppStoreReceiptURL : (NSURL *)object;
189
190 - (NSURL *)appStoreReceiptURLX NS_AVAILABLE;
191 - (void) setAppStoreReceiptURLX : (NSURL *)object NS_AVAILABLE;
192
193 // Do not infer a property.
194 - (NSURL *)appStoreReceiptURLY ;
195 - (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
196
197 - (id)OkToInfer NS_AVAILABLE;
198
199 // Do not infer a property.
200 - (NSURL *)appStoreReceiptURLZ ;
201 - (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
202
203 // Do not infer a property.
204 - (id) t1 NORETURN NS_AVAILABLE;
205 - (void) setT1 : (id) arg NS_AVAILABLE;
206
207 - (id)method1 ALIGNED NS_AVAILABLE;
208 - (void) setMethod1 : (id) object NS_AVAILABLE ALIGNED;
209
210 - (NSURL *)init;  // No Change
211 + (id)alloc;      // No Change
212
213 - (BOOL)is1stClass; // Not a valid property
214 - (BOOL)isClass;    // This is a valid property 'class' is not a keyword in ObjC
215 - (BOOL)isDouble; // Not a valid property
216
217 @end
218
219 // rdar://15082818
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 // rdar://15231241
232 @interface rdar15231241
233 @property (nonatomic, readonly) double Ddelegate;
234 @property (nonatomic, readonly) float Fdelegate;
235 @property (nonatomic, readonly) int Idelegate;
236 @property (nonatomic, readonly) BOOL Bdelegate;
237 @end