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