Skip to content

Commit 8bc8b85

Browse files
authored
Merge pull request #3796 from DougGregor/swift-nested-archetype-removal-20210726
Work around upcoming removal of NestedArchetypeType.
2 parents d61a0a3 + 8da499b commit 8bc8b85

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,7 +2276,9 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
22762276
[&](swift::SubstitutableType *type) -> swift::Type {
22772277
auto opaque_type =
22782278
llvm::dyn_cast<swift::OpaqueTypeArchetypeType>(type);
2279-
if (!opaque_type)
2279+
if (!opaque_type ||
2280+
!opaque_type->getInterfaceType()
2281+
->is<swift::GenericTypeParamType>())
22802282
return type;
22812283

22822284
// Try to find the symbol for the opaque type descriptor in the
@@ -2308,11 +2310,13 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
23082310

23092311
// Ask RemoteAST to get the underlying type out of the descriptor.
23102312
auto &remote_ast = GetRemoteASTContext(*scratch_ctx);
2313+
auto genericParam = opaque_type->getInterfaceType()
2314+
->getAs<swift::GenericTypeParamType>();
23112315
auto underlying_type_result =
23122316
remote_ast.getUnderlyingTypeForOpaqueType(
23132317
swift::remote::RemoteAddress(addr),
23142318
opaque_type->getSubstitutions(),
2315-
opaque_type->getOrdinal());
2319+
genericParam->getIndex());
23162320

23172321
if (!underlying_type_result)
23182322
continue;

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5644,7 +5644,6 @@ SwiftASTContext::GetTypeInfo(opaque_compiler_type_t type,
56445644
case swift::TypeKind::Error:
56455645
case swift::TypeKind::InOut:
56465646
case swift::TypeKind::Module:
5647-
case swift::TypeKind::NestedArchetype:
56485647
case swift::TypeKind::OpaqueTypeArchetype:
56495648
case swift::TypeKind::OpenedArchetype:
56505649
case swift::TypeKind::Placeholder:
@@ -5829,7 +5828,6 @@ lldb::TypeClass SwiftASTContext::GetTypeClass(opaque_compiler_type_t type) {
58295828
case swift::TypeKind::Existential:
58305829
case swift::TypeKind::Metatype:
58315830
case swift::TypeKind::Module:
5832-
case swift::TypeKind::NestedArchetype:
58335831
case swift::TypeKind::OpaqueTypeArchetype:
58345832
case swift::TypeKind::OpenedArchetype:
58355833
case swift::TypeKind::PrimaryArchetype:
@@ -6289,7 +6287,6 @@ lldb::Encoding SwiftASTContext::GetEncoding(opaque_compiler_type_t type,
62896287
case swift::TypeKind::BuiltinFloat:
62906288
return lldb::eEncodingIEEE754; // TODO: detect if an integer is unsigned
62916289

6292-
case swift::TypeKind::NestedArchetype:
62936290
case swift::TypeKind::OpaqueTypeArchetype:
62946291
case swift::TypeKind::OpenedArchetype:
62956292
case swift::TypeKind::PrimaryArchetype:
@@ -6430,7 +6427,6 @@ uint32_t SwiftASTContext::GetNumChildren(opaque_compiler_type_t type,
64306427

64316428
case swift::TypeKind::ExistentialMetatype:
64326429
case swift::TypeKind::Metatype:
6433-
case swift::TypeKind::NestedArchetype:
64346430
case swift::TypeKind::OpaqueTypeArchetype:
64356431
case swift::TypeKind::OpenedArchetype:
64366432
case swift::TypeKind::PrimaryArchetype:
@@ -6567,7 +6563,6 @@ uint32_t SwiftASTContext::GetNumFields(opaque_compiler_type_t type,
65676563
case swift::TypeKind::Metatype:
65686564
return 0;
65696565

6570-
case swift::TypeKind::NestedArchetype:
65716566
case swift::TypeKind::OpaqueTypeArchetype:
65726567
case swift::TypeKind::OpenedArchetype:
65736568
case swift::TypeKind::PrimaryArchetype:
@@ -6865,7 +6860,6 @@ CompilerType SwiftASTContext::GetFieldAtIndex(opaque_compiler_type_t type,
68656860
case swift::TypeKind::Metatype:
68666861
break;
68676862

6868-
case swift::TypeKind::NestedArchetype:
68696863
case swift::TypeKind::OpaqueTypeArchetype:
68706864
case swift::TypeKind::OpenedArchetype:
68716865
case swift::TypeKind::PrimaryArchetype:
@@ -6941,7 +6935,6 @@ uint32_t SwiftASTContext::GetNumPointeeChildren(opaque_compiler_type_t type) {
69416935
case swift::TypeKind::Class:
69426936
case swift::TypeKind::Protocol:
69436937
case swift::TypeKind::Metatype:
6944-
case swift::TypeKind::NestedArchetype:
69456938
case swift::TypeKind::OpaqueTypeArchetype:
69466939
case swift::TypeKind::OpenedArchetype:
69476940
case swift::TypeKind::PrimaryArchetype:
@@ -7296,7 +7289,6 @@ CompilerType SwiftASTContext::GetChildCompilerTypeAtIndex(
72967289
case swift::TypeKind::Metatype:
72977290
break;
72987291

7299-
case swift::TypeKind::NestedArchetype:
73007292
case swift::TypeKind::OpaqueTypeArchetype:
73017293
case swift::TypeKind::OpenedArchetype:
73027294
case swift::TypeKind::PrimaryArchetype:
@@ -7532,7 +7524,6 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
75327524
case swift::TypeKind::Metatype:
75337525
break;
75347526

7535-
case swift::TypeKind::NestedArchetype:
75367527
case swift::TypeKind::OpaqueTypeArchetype:
75377528
case swift::TypeKind::OpenedArchetype:
75387529
case swift::TypeKind::PrimaryArchetype:
@@ -7789,7 +7780,6 @@ bool SwiftASTContext::DumpTypeValue(
77897780
case swift::TypeKind::BuiltinNativeObject:
77907781
case swift::TypeKind::BuiltinUnsafeValueBuffer:
77917782
case swift::TypeKind::BuiltinBridgeObject:
7792-
case swift::TypeKind::NestedArchetype:
77937783
case swift::TypeKind::OpaqueTypeArchetype:
77947784
case swift::TypeKind::OpenedArchetype:
77957785
case swift::TypeKind::PrimaryArchetype:

0 commit comments

Comments
 (0)