llvm-project
227 строк · 5.6 Кб
1// RUN: rm -rf %t
2// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -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
11typedef 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 {
22int 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
50NSArray *_names1;
51NSArray *_names2;
52NSArray *_names3;
53NSArray *_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
163DEPRECATED
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#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
181#define NORETURN __attribute__((noreturn))
182#define ALIGNED __attribute__((aligned(16)))
183
184@interface NSURL
185// Do not infer a property.
186- (NSURL *)appStoreReceiptURL NS_AVAILABLE;
187- (void) setAppStoreReceiptURL : (NSURL *)object;
188
189- (NSURL *)appStoreReceiptURLX NS_AVAILABLE;
190- (void) setAppStoreReceiptURLX : (NSURL *)object NS_AVAILABLE;
191
192// Do not infer a property.
193- (NSURL *)appStoreReceiptURLY ;
194- (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
195
196- (id)OkToInfer NS_AVAILABLE;
197
198// Do not infer a property.
199- (NSURL *)appStoreReceiptURLZ ;
200- (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
201
202// Do not infer a property.
203- (id) t1 NORETURN NS_AVAILABLE;
204- (void) setT1 : (id) arg NS_AVAILABLE;
205
206- (id)method1 ALIGNED NS_AVAILABLE;
207- (void) setMethod1 : (id) object NS_AVAILABLE ALIGNED;
208
209- (NSURL *)init; // No Change
210+ (id)alloc; // No Change
211
212- (BOOL)is1stClass; // Not a valid property
213- (BOOL)isClass; // This is a valid property 'class' is not a keyword in ObjC
214- (BOOL)isDouble; // Not a valid property
215
216@end
217
218@class NSMutableDictionary;
219
220@interface NSArray
221- (id (^)(id, NSArray *, NSMutableDictionary *)) expressionBlock;
222- (id (^)(id, NSArray *, NSMutableDictionary *)) MyBlock;
223- (void) setMyBlock : (id (^)(id, NSArray *, NSMutableDictionary *)) bl;
224- (id (*)(id, NSArray *, NSMutableDictionary *)) expressionFuncptr;
225- (id (*)(id, NSArray *, NSMutableDictionary *)) MyFuncptr;
226- (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
227@end
228