Skip to content

Commit 9b4bb07

Browse files
committed
lldb: ignore invertible protocols
resolves rdar://124701762
1 parent f3fb460 commit 9b4bb07

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5606,7 +5606,6 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,
56065606

56075607
swift::ExistentialLayout layout = swift_can_type.getExistentialLayout();
56085608
protocol_info.m_is_class_only = layout.requiresClass();
5609-
protocol_info.m_num_protocols = layout.getProtocols().size();
56105609
protocol_info.m_is_objc = layout.isObjC();
56115610
protocol_info.m_is_anyobject = layout.isAnyObject();
56125611
protocol_info.m_is_errortype = layout.isErrorExistential();
@@ -5616,11 +5615,24 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,
56165615
}
56175616

56185617
unsigned num_witness_tables = 0;
5618+
unsigned num_protocols = 0;
56195619
for (auto protoDecl : layout.getProtocols()) {
5620+
// Ignore invertible protocols like Copyable entirely. They're marker
5621+
// protocols that are not mangled into generic signatures. Only their
5622+
// absence is mangled.
5623+
// FIXME: this should probably be filtering all marker protocols,
5624+
// including Sendable, since marker protocols lack a witness table.
5625+
if (protoDecl->getInvertibleProtocolKind())
5626+
continue;
5627+
5628+
num_protocols++;
5629+
56205630
if (!protoDecl->isObjC())
56215631
num_witness_tables++;
56225632
}
56235633

5634+
protocol_info.m_num_protocols = num_protocols;
5635+
56245636
if (layout.isErrorExistential()) {
56255637
// Error existential -- instance pointer only.
56265638
protocol_info.m_num_payload_words = 0;

0 commit comments

Comments
 (0)