Skip to content

Commit a770507

Browse files
committed
lldb: ignore invertible protocols
resolves rdar://124701762 (cherry picked from commit 9b4bb07)
1 parent 6f66051 commit a770507

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
@@ -5648,7 +5648,6 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,
56485648

56495649
swift::ExistentialLayout layout = swift_can_type.getExistentialLayout();
56505650
protocol_info.m_is_class_only = layout.requiresClass();
5651-
protocol_info.m_num_protocols = layout.getProtocols().size();
56525651
protocol_info.m_is_objc = layout.isObjC();
56535652
protocol_info.m_is_anyobject = layout.isAnyObject();
56545653
protocol_info.m_is_errortype = layout.isErrorExistential();
@@ -5658,11 +5657,24 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,
56585657
}
56595658

56605659
unsigned num_witness_tables = 0;
5660+
unsigned num_protocols = 0;
56615661
for (auto protoDecl : layout.getProtocols()) {
5662+
// Ignore invertible protocols like Copyable entirely. They're marker
5663+
// protocols that are not mangled into generic signatures. Only their
5664+
// absence is mangled.
5665+
// FIXME: this should probably be filtering all marker protocols,
5666+
// including Sendable, since marker protocols lack a witness table.
5667+
if (protoDecl->getInvertibleProtocolKind())
5668+
continue;
5669+
5670+
num_protocols++;
5671+
56625672
if (!protoDecl->isObjC())
56635673
num_witness_tables++;
56645674
}
56655675

5676+
protocol_info.m_num_protocols = num_protocols;
5677+
56665678
if (layout.isErrorExistential()) {
56675679
// Error existential -- instance pointer only.
56685680
protocol_info.m_num_payload_words = 0;

0 commit comments

Comments
 (0)