-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathobjc_implementation.h
260 lines (173 loc) · 7.68 KB
/
objc_implementation.h
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
249
250
251
252
253
254
255
256
257
258
259
260
#if __OBJC__
@import Foundation;
@interface ObjCBaseClass
- (instancetype)init __attribute__((unavailable));
// Need two initializers to reproduce certain conflict bugs.
- (instancetype)initFromSuperclass:(int)param __attribute__((objc_designated_initializer));
- (instancetype)initFromSuperclass2:(int)param __attribute__((objc_designated_initializer));
- (void)superclassMethod:(int)param;
@property (assign) int superclassProperty;
+ (void)superclassClassMethod;
@end
@protocol ObjCProto
- (instancetype)initFromProtocol1:(int)param;
- (instancetype)initFromProtocol2:(int)param;
@end
@interface ObjCClass : ObjCBaseClass <ObjCProto>
- (instancetype)initNotFromProtocol:(int)param;
- (void)methodFromHeader1:(int)param;
- (void)methodFromHeader2:(int)param;
- (void)methodFromHeader3:(int)param;
- (void)methodFromHeader4:(int)param;
- (int)methodFromHeader5;
- (void)methodFromHeader6:(int)param;
@property int propertyFromHeader1;
@property int propertyFromHeader2;
@property int propertyFromHeader3;
@property int propertyFromHeader4;
@property int propertyFromHeader5;
@property int propertyFromHeader6;
@property int propertyFromHeader7;
@property int propertyFromHeader8;
@property int propertyFromHeader9;
@property int propertyFromHeader10;
@property int propertyFromHeader11;
@property (readonly) int readonlyPropertyFromHeader1;
@property (readonly) int readonlyPropertyFromHeader2;
@property (readonly) int readonlyPropertyFromHeader3;
@property (readonly) int readonlyPropertyFromHeader4;
@property (readonly) int readonlyPropertyFromHeader5;
@property (readonly) int readonlyPropertyFromHeader6;
@property (readonly) int readonlyPropertyFromHeader7;
+ (void)classMethod1:(int)param;
+ (void)classMethod2:(int)param;
+ (void)classMethod3:(int)param;
- (void)instanceMethod1:(int)param;
- (void)instanceMethod2:(int)param;
// rdar://122280735 - crash when the parameter of a block property needs @escaping
@property (nonatomic, readonly) void (^ _Nonnull rdar122280735)(void (^_Nonnull completion)());
@end
@interface ObjCClass () <NSCopying>
- (void)extensionMethodFromHeader1:(int)param;
- (void)extensionMethodFromHeader2:(int)param;
@end
@interface ObjCClass (PresentAdditions)
- (void)categoryMethodFromHeader1:(int)param;
- (void)categoryMethodFromHeader2:(int)param;
- (void)categoryMethodFromHeader3:(int)param;
- (void)categoryMethodFromHeader4:(int)param;
@property int categoryPropertyFromHeader1;
@property int categoryPropertyFromHeader2;
@property int categoryPropertyFromHeader3;
@property int categoryPropertyFromHeader4;
@property int categoryPropertyFromHeader5;
@property (readonly) int categoryReadonlyPropertyFromHeader1;
@end
@interface ObjCClass (SwiftNameTests)
- (void)methodObjCName1 __attribute__((swift_name("methodSwiftName1()")));
- (void)methodObjCName2 __attribute__((swift_name("methodSwiftName2()")));
- (void)methodObjCName3 __attribute__((swift_name("methodSwiftName3()")));
- (void)methodObjCName4 __attribute__((swift_name("methodSwiftName4()")));
- (void)methodObjCName5 __attribute__((swift_name("methodSwiftName5()")));
- (void)methodObjCName6A __attribute__((swift_name("methodSwiftName6A()")));
- (void)methodObjCName6B __attribute__((swift_name("methodSwiftName6B()")));
@end
@interface ObjCClass (AmbiguousMethods)
- (void)ambiguousMethod1WithCInt:(int)param __attribute__((swift_name("ambiguousMethod1(with:)")));
- (void)ambiguousMethod1WithCChar:(char)param __attribute__((swift_name("ambiguousMethod1(with:)")));
- (void)ambiguousMethod2WithCInt:(int)param __attribute__((swift_name("ambiguousMethod2(with:)")));
- (void)ambiguousMethod2WithCChar:(char)param __attribute__((swift_name("ambiguousMethod2(with:)")));
- (void)ambiguousMethod3WithCInt:(int)param __attribute__((swift_name("ambiguousMethod3(with:)")));
- (void)ambiguousMethod3WithCChar:(char)param __attribute__((swift_name("ambiguousMethod3(with:)")));
- (void)ambiguousMethod4WithCInt:(int)param __attribute__((swift_name("ambiguousMethod4(with:)")));
@end
@interface ObjCClass (Effects)
- (void)doSomethingAsynchronousWithCompletionHandler:(void (^ _Nonnull)(id _Nullable result, NSError * _Nullable error))completionHandler;
- (void)doSomethingElseAsynchronousWithCompletionHandler:(void (^ _Nullable)(id _Nonnull result))completionHandler;
- (void)doSomethingFunAndAsynchronousWithCompletionHandler:(void (^ _Nonnull)(id _Nullable result, NSError * _Nullable error))completionHandler;
- (void)doSomethingMissingAndAsynchronousWithCompletionHandler:(void (^ _Nonnull)(id _Nullable result, NSError * _Nullable error))completionHandler;
- (void)doSomethingOverloadedWithCompletionHandler:(void (^ _Nonnull)())completionHandler;
- (void)doSomethingOverloaded __attribute__((__swift_attr__("@_unavailableFromAsync(message: \"Use async doSomethingOverloaded instead.\")")));
- (BOOL)doSomethingThatCanFailWithHandler:(void (^ _Nonnull)())handler error:(NSError **)error;
- (BOOL)doSomethingElseThatCanFail:(NSError **)error handler:(void (^ _Nonnull)())handler;
- (BOOL)doSomethingThatCanFailWithWeirdParameterWithHandler:(void (^ _Nonnull)())handler :(NSError **)error;
- (int)doSomethingThatCanFailWithWeirdReturnCodeWithError:(NSError **)error __attribute__((swift_error(nonzero_result)));
@end
@interface ObjCClass (InvalidMembers)
- (void)unimplementedMember;
- (void)nonObjCMethod:(id)value;
@end
@interface ObjCClass (EmptyCategory)
@end
@protocol PartiallyOptionalProtocol
- (void)requiredMethod1;
- (void)requiredMethod2;
@optional
- (void)optionalMethod1;
- (void)optionalMethod2;
@end
@interface ObjCClass (Conformance) <PartiallyOptionalProtocol>
@end
@interface ObjCClass (TypeMatchOptionality)
- (nullable id)nullableResultAndArg:(nullable id)arg;
- (nonnull id)nonnullResultAndArg:(nonnull id)arg;
- (null_unspecified id)nullUnspecifiedResultAndArg:(null_unspecified id)arg;
- (nonnull id)nonnullResult1;
- (nonnull id)nonnullResult2;
- (nonnull id)nonnullResult3;
- (void)nonnullArgument1:(nonnull id)arg;
- (void)nonnullArgument2:(nonnull id)arg;
- (void)nonnullArgument3:(nonnull id)arg;
- (nullable id)nullableResult;
- (void)nullableArgument:(nullable id)arg;
@end
@interface ObjCClass (TypeMatchOptionalityInvalid)
- (int)nonPointerResult;
- (void)nonPointerArgument:(int)arg;
@end
@interface ObjCSubclass : ObjCClass
- (void)subclassMethodFromHeader1:(int)param;
@end
@interface ObjCImplSubclass : ObjCClass
@end
@interface ObjCBasicInitClass : ObjCBaseClass
- (nonnull instancetype)init __attribute__((objc_designated_initializer));
@end
@interface ObjCImplRootClass
@end
@interface ObjCImplGenericClass<T> : NSObject
@end
@interface ObjCBadClass : NSObject
@end
@interface ObjCBadClass (BadCategory1)
@end
@interface ObjCBadClass (BadCategory2)
@end
@protocol EmptyObjCProto
@end
@interface ObjCClassWithWeirdSwiftAttributeCombo : ObjCBaseClass
@end
#endif
void CImplFunc1(int param);
void CImplFunc2(int param);
void CImplFuncMismatch1(int param);
void CImplFuncMismatch2(int param);
#if __OBJC__
void CImplFuncMismatch3(_Nullable id param);
void CImplFuncMismatch4(_Nullable id param);
void CImplFuncMismatch5(_Nonnull id param);
void CImplFuncMismatch6(_Nonnull id param);
_Nullable id CImplFuncMismatch3a(int param);
_Nullable id CImplFuncMismatch4a(int param);
_Nonnull id CImplFuncMismatch5a(int param);
_Nonnull id CImplFuncMismatch6a(int param);
#endif
void CImplFuncNameMismatch1(int param);
void CImplFuncNameMismatch2(int param);
int CImplGetComputedGlobal1(void) __attribute__((swift_name("getter:cImplComputedGlobal1()")));
void CImplSetComputedGlobal1(int param) __attribute__((swift_name("setter:cImplComputedGlobal1(newValue:)")));
typedef struct CImplStruct {} CImplStruct;
void CImplStructStaticFunc1(int param) __attribute__((swift_name("CImplStruct.staticFunc1(_:)")));
struct ObjCStruct {
int foo;
};