@@ -69,7 +69,7 @@ static const char *class_getName(const ClassMetadata* type) {
69
69
extern " C" const void *swift_dynamicCastObjCProtocolConditional (
70
70
const void *object,
71
71
size_t numProtocols,
72
- const ProtocolDescriptor * const *protocols);
72
+ Protocol * const *protocols);
73
73
#endif
74
74
75
75
// Build a user-comprehensible name for a type.
@@ -303,7 +303,7 @@ swift_dynamicCastClassUnconditionalImpl(const void *object,
303
303
304
304
#if SWIFT_OBJC_INTEROP
305
305
static bool _unknownClassConformsToObjCProtocol (const OpaqueValue *value,
306
- const ProtocolDescriptor *protocol) {
306
+ Protocol *protocol) {
307
307
const void *object
308
308
= *reinterpret_cast <const void * const *>(value);
309
309
return swift_dynamicCastObjCProtocolConditional (object, 1 , &protocol);
@@ -312,11 +312,11 @@ static bool _unknownClassConformsToObjCProtocol(const OpaqueValue *value,
312
312
313
313
bool swift::_conformsToProtocol (const OpaqueValue *value,
314
314
const Metadata *type,
315
- const ProtocolDescriptor * protocol,
315
+ ProtocolDescriptorRef protocol,
316
316
const WitnessTable **conformance) {
317
317
// Look up the witness table for protocols that need them.
318
- if (protocol-> Flags .needsWitnessTable ()) {
319
- auto witness = swift_conformsToProtocol (type, protocol);
318
+ if (protocol.needsWitnessTable ()) {
319
+ auto witness = swift_conformsToProtocol (type, protocol. getSwiftProtocol () );
320
320
if (!witness)
321
321
return false ;
322
322
if (conformance)
@@ -330,22 +330,22 @@ bool swift::_conformsToProtocol(const OpaqueValue *value,
330
330
case MetadataKind::Class:
331
331
#if SWIFT_OBJC_INTEROP
332
332
if (value) {
333
- return _unknownClassConformsToObjCProtocol (value, protocol);
333
+ return _unknownClassConformsToObjCProtocol (value,
334
+ protocol.getObjCProtocol ());
334
335
} else {
335
- return classConformsToObjCProtocol (type,
336
- ProtocolDescriptorRef (protocol, ProtocolDispatchStrategy::ObjC));
336
+ return classConformsToObjCProtocol (type, protocol);
337
337
}
338
338
#endif
339
339
return false ;
340
340
341
341
case MetadataKind::ObjCClassWrapper: {
342
342
#if SWIFT_OBJC_INTEROP
343
343
if (value) {
344
- return _unknownClassConformsToObjCProtocol (value, protocol);
344
+ return _unknownClassConformsToObjCProtocol (value,
345
+ protocol.getObjCProtocol ());
345
346
} else {
346
347
auto wrapper = cast<ObjCClassWrapperMetadata>(type);
347
- return classConformsToObjCProtocol (wrapper->Class ,
348
- ProtocolDescriptorRef (protocol, ProtocolDispatchStrategy::ObjC));
348
+ return classConformsToObjCProtocol (wrapper->Class , protocol);
349
349
}
350
350
#endif
351
351
return false ;
@@ -354,7 +354,8 @@ bool swift::_conformsToProtocol(const OpaqueValue *value,
354
354
case MetadataKind::ForeignClass:
355
355
#if SWIFT_OBJC_INTEROP
356
356
if (value)
357
- return _unknownClassConformsToObjCProtocol (value, protocol);
357
+ return _unknownClassConformsToObjCProtocol (value,
358
+ protocol.getObjCProtocol ());
358
359
return false ;
359
360
#else
360
361
return false ;
@@ -387,9 +388,7 @@ static bool _conformsToProtocols(const OpaqueValue *value,
387
388
}
388
389
389
390
for (auto protocol : existentialType->getProtocols ()) {
390
- if (!_conformsToProtocol (value, type,
391
- protocol.getProtocolDescriptorUnchecked (),
392
- conformances))
391
+ if (!_conformsToProtocol (value, type, protocol, conformances))
393
392
return false ;
394
393
if (protocol.needsWitnessTable ()) {
395
394
assert (*conformances != nullptr );
0 commit comments