Skip to content

Commit 67453a1

Browse files
authored
Merge pull request #66176 from mikeash/dont-scan-objc-classes-5.9
[5.9][Runtime] Skip metadata records search for classes in the __C module.
2 parents 8cd5aff + 3f10fad commit 67453a1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,16 @@ swift::_contextDescriptorMatchesMangling(const ContextDescriptor *context,
732732
static const ContextDescriptor *
733733
_searchTypeMetadataRecords(TypeMetadataPrivateState &T,
734734
Demangle::NodePointer node) {
735+
#if SWIFT_OBJC_INTEROP
736+
// Classes in the __C module are ObjC classes. They never have a
737+
// nominal type descriptor, so don't bother to search for one.
738+
if (node && node->getKind() == Node::Kind::Class)
739+
if (auto child = node->getFirstChild())
740+
if (child->getKind() == Node::Kind::Module && child->hasText())
741+
if (child->getText() == MANGLING_MODULE_OBJC)
742+
return nullptr;
743+
#endif
744+
735745
for (auto &section : T.SectionsToScan.snapshot()) {
736746
for (const auto &record : section) {
737747
if (auto context = record.getContextDescriptor()) {

0 commit comments

Comments
 (0)