@@ -148,20 +148,19 @@ class CategoryInitializerVisitor
148
148
if (method->getAttrs ().hasAttribute <NSManagedAttr>())
149
149
return ;
150
150
151
- llvm::Constant *name, *imp, *types;
152
- emitObjCMethodDescriptorParts (IGM, method, /* concrete*/ true ,
153
- name, types, imp);
151
+ auto descriptor = emitObjCMethodDescriptorParts (IGM, method,
152
+ /* concrete*/ true );
154
153
155
154
// When generating JIT'd code, we need to call sel_registerName() to force
156
155
// the runtime to unique the selector.
157
156
llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
158
- name );
157
+ descriptor. selectorRef );
159
158
160
159
llvm::Value *args[] = {
161
160
method->isStatic () ? metaclassMetadata : classMetadata,
162
161
sel,
163
- imp ,
164
- types
162
+ descriptor. impl ,
163
+ descriptor. typeEncoding
165
164
};
166
165
167
166
Builder.CreateCall (class_replaceMethod, args);
@@ -172,20 +171,19 @@ class CategoryInitializerVisitor
172
171
173
172
void visitConstructorDecl (ConstructorDecl *constructor) {
174
173
if (!requiresObjCMethodDescriptor (constructor)) return ;
175
- llvm::Constant *name, *imp, *types;
176
- emitObjCMethodDescriptorParts (IGM, constructor, /* concrete*/ true ,
177
- name, types, imp);
174
+ auto descriptor = emitObjCMethodDescriptorParts (IGM, constructor,
175
+ /* concrete*/ true );
178
176
179
177
// When generating JIT'd code, we need to call sel_registerName() to force
180
178
// the runtime to unique the selector.
181
179
llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
182
- name );
180
+ descriptor. selectorRef );
183
181
184
182
llvm::Value *args[] = {
185
183
classMetadata,
186
184
sel,
187
- imp ,
188
- types
185
+ descriptor. impl ,
186
+ descriptor. typeEncoding
189
187
};
190
188
191
189
Builder.CreateCall (class_replaceMethod, args);
@@ -206,23 +204,22 @@ class CategoryInitializerVisitor
206
204
if (prop->getAttrs ().hasAttribute <NSManagedAttr>())
207
205
return ;
208
206
209
- llvm::Constant *name, *imp, *types;
210
- emitObjCGetterDescriptorParts (IGM, prop,
211
- name, types, imp);
207
+ auto descriptor = emitObjCGetterDescriptorParts (IGM, prop);
212
208
// When generating JIT'd code, we need to call sel_registerName() to force
213
209
// the runtime to unique the selector.
214
210
llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
215
- name );
211
+ descriptor. selectorRef );
216
212
auto theClass = prop->isStatic () ? metaclassMetadata : classMetadata;
217
- llvm::Value *getterArgs[] = {theClass, sel, imp, types};
213
+ llvm::Value *getterArgs[] =
214
+ {theClass, sel, descriptor.impl , descriptor.typeEncoding };
218
215
Builder.CreateCall (class_replaceMethod, getterArgs);
219
216
220
217
if (prop->isSettable (prop->getDeclContext ())) {
221
- emitObjCSetterDescriptorParts (IGM, prop,
222
- name, types, imp);
218
+ auto descriptor = emitObjCSetterDescriptorParts (IGM, prop);
223
219
sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
224
- name);
225
- llvm::Value *setterArgs[] = {theClass, sel, imp, types};
220
+ descriptor.selectorRef );
221
+ llvm::Value *setterArgs[] =
222
+ {theClass, sel, descriptor.impl , descriptor.typeEncoding };
226
223
227
224
Builder.CreateCall (class_replaceMethod, setterArgs);
228
225
}
@@ -232,22 +229,21 @@ class CategoryInitializerVisitor
232
229
assert (!subscript->isStatic () && " objc doesn't support class subscripts" );
233
230
if (!requiresObjCSubscriptDescriptor (IGM, subscript)) return ;
234
231
235
- llvm::Constant *name, *imp, *types;
236
- emitObjCGetterDescriptorParts (IGM, subscript,
237
- name, types, imp);
232
+ auto descriptor = emitObjCGetterDescriptorParts (IGM, subscript);
238
233
// When generating JIT'd code, we need to call sel_registerName() to force
239
234
// the runtime to unique the selector.
240
235
llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
241
- name);
242
- llvm::Value *getterArgs[] = {classMetadata, sel, imp, types};
236
+ descriptor.selectorRef );
237
+ llvm::Value *getterArgs[] =
238
+ {classMetadata, sel, descriptor.impl , descriptor.typeEncoding };
243
239
Builder.CreateCall (class_replaceMethod, getterArgs);
244
240
245
241
if (subscript->supportsMutation ()) {
246
- emitObjCSetterDescriptorParts (IGM, subscript,
247
- name, types, imp);
242
+ auto descriptor = emitObjCSetterDescriptorParts (IGM, subscript);
248
243
sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
249
- name);
250
- llvm::Value *setterArgs[] = {classMetadata, sel, imp, types};
244
+ descriptor.selectorRef );
245
+ llvm::Value *setterArgs[] =
246
+ {classMetadata, sel, descriptor.impl , descriptor.typeEncoding };
251
247
252
248
Builder.CreateCall (class_replaceMethod, setterArgs);
253
249
}
@@ -353,16 +349,16 @@ class ObjCProtocolInitializerVisitor
353
349
return ;
354
350
}
355
351
356
- llvm::Constant *name, *imp, *types;
357
- emitObjCMethodDescriptorParts (IGM, method, /* concrete*/ false ,
358
- name, types, imp);
352
+ auto descriptor = emitObjCMethodDescriptorParts (IGM, method,
353
+ /* concrete*/ false );
359
354
360
355
// When generating JIT'd code, we need to call sel_registerName() to force
361
356
// the runtime to unique the selector.
362
- llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (), name);
357
+ llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
358
+ descriptor.selectorRef );
363
359
364
360
llvm::Value *args[] = {
365
- NewProto, sel, types ,
361
+ NewProto, sel, descriptor. typeEncoding ,
366
362
// required?
367
363
llvm::ConstantInt::get (IGM.ObjCBoolTy ,
368
364
!method->getAttrs ().hasAttribute <OptionalAttr>()),
@@ -381,14 +377,13 @@ class ObjCProtocolInitializerVisitor
381
377
void visitAbstractStorageDecl (AbstractStorageDecl *prop) {
382
378
// TODO: Add properties to protocol.
383
379
384
- llvm::Constant *name, *imp, *types;
385
- emitObjCGetterDescriptorParts (IGM, prop,
386
- name, types, imp);
380
+ auto descriptor = emitObjCGetterDescriptorParts (IGM, prop);
387
381
// When generating JIT'd code, we need to call sel_registerName() to force
388
382
// the runtime to unique the selector.
389
- llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (), name);
383
+ llvm::Value *sel = Builder.CreateCall (IGM.getObjCSelRegisterNameFn (),
384
+ descriptor.selectorRef );
390
385
llvm::Value *getterArgs[] = {
391
- NewProto, sel, types ,
386
+ NewProto, sel, descriptor. typeEncoding ,
392
387
// required?
393
388
llvm::ConstantInt::get (IGM.ObjCBoolTy ,
394
389
!prop->getAttrs ().hasAttribute <OptionalAttr>()),
@@ -399,11 +394,11 @@ class ObjCProtocolInitializerVisitor
399
394
Builder.CreateCall (protocol_addMethodDescription, getterArgs);
400
395
401
396
if (prop->isSettable (nullptr )) {
402
- emitObjCSetterDescriptorParts (IGM, prop,
403
- name, types, imp);
404
- sel = Builder. CreateCall (IGM. getObjCSelRegisterNameFn (), name );
397
+ auto descriptor = emitObjCSetterDescriptorParts (IGM, prop);
398
+ sel = Builder. CreateCall (IGM. getObjCSelRegisterNameFn (),
399
+ descriptor. selectorRef );
405
400
llvm::Value *setterArgs[] = {
406
- NewProto, sel, types ,
401
+ NewProto, sel, descriptor. typeEncoding ,
407
402
// required?
408
403
llvm::ConstantInt::get (IGM.ObjCBoolTy ,
409
404
!prop->getAttrs ().hasAttribute <OptionalAttr>()),
0 commit comments