Skip to content

Commit 8da499b

Browse files
committed
Work around upcoming removal of NestedArchetypeType.
1 parent 9295a4a commit 8da499b

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
@@ -2279,7 +2279,9 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
22792279
[&](swift::SubstitutableType *type) -> swift::Type {
22802280
auto opaque_type =
22812281
llvm::dyn_cast<swift::OpaqueTypeArchetypeType>(type);
2282-
if (!opaque_type)
2282+
if (!opaque_type ||
2283+
!opaque_type->getInterfaceType()
2284+
->is<swift::GenericTypeParamType>())
22832285
return type;
22842286

22852287
// Try to find the symbol for the opaque type descriptor in the
@@ -2311,11 +2313,13 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
23112313

23122314
// Ask RemoteAST to get the underlying type out of the descriptor.
23132315
auto &remote_ast = GetRemoteASTContext(*scratch_ctx);
2316+
auto genericParam = opaque_type->getInterfaceType()
2317+
->getAs<swift::GenericTypeParamType>();
23142318
auto underlying_type_result =
23152319
remote_ast.getUnderlyingTypeForOpaqueType(
23162320
swift::remote::RemoteAddress(addr),
23172321
opaque_type->getSubstitutions(),
2318-
opaque_type->getOrdinal());
2322+
genericParam->getIndex());
23192323

23202324
if (!underlying_type_result)
23212325
continue;

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5632,7 +5632,6 @@ SwiftASTContext::GetTypeInfo(opaque_compiler_type_t type,
56325632
case swift::TypeKind::Error:
56335633
case swift::TypeKind::InOut:
56345634
case swift::TypeKind::Module:
5635-
case swift::TypeKind::NestedArchetype:
56365635
case swift::TypeKind::OpaqueTypeArchetype:
56375636
case swift::TypeKind::OpenedArchetype:
56385637
case swift::TypeKind::Placeholder:
@@ -5815,7 +5814,6 @@ lldb::TypeClass SwiftASTContext::GetTypeClass(opaque_compiler_type_t type) {
58155814
case swift::TypeKind::ProtocolComposition:
58165815
case swift::TypeKind::Metatype:
58175816
case swift::TypeKind::Module:
5818-
case swift::TypeKind::NestedArchetype:
58195817
case swift::TypeKind::OpaqueTypeArchetype:
58205818
case swift::TypeKind::OpenedArchetype:
58215819
case swift::TypeKind::PrimaryArchetype:
@@ -6275,7 +6273,6 @@ lldb::Encoding SwiftASTContext::GetEncoding(opaque_compiler_type_t type,
62756273
case swift::TypeKind::BuiltinFloat:
62766274
return lldb::eEncodingIEEE754; // TODO: detect if an integer is unsigned
62776275

6278-
case swift::TypeKind::NestedArchetype:
62796276
case swift::TypeKind::OpaqueTypeArchetype:
62806277
case swift::TypeKind::OpenedArchetype:
62816278
case swift::TypeKind::PrimaryArchetype:
@@ -6414,7 +6411,6 @@ uint32_t SwiftASTContext::GetNumChildren(opaque_compiler_type_t type,
64146411

64156412
case swift::TypeKind::ExistentialMetatype:
64166413
case swift::TypeKind::Metatype:
6417-
case swift::TypeKind::NestedArchetype:
64186414
case swift::TypeKind::OpaqueTypeArchetype:
64196415
case swift::TypeKind::OpenedArchetype:
64206416
case swift::TypeKind::PrimaryArchetype:
@@ -6550,7 +6546,6 @@ uint32_t SwiftASTContext::GetNumFields(opaque_compiler_type_t type,
65506546
case swift::TypeKind::Metatype:
65516547
return 0;
65526548

6553-
case swift::TypeKind::NestedArchetype:
65546549
case swift::TypeKind::OpaqueTypeArchetype:
65556550
case swift::TypeKind::OpenedArchetype:
65566551
case swift::TypeKind::PrimaryArchetype:
@@ -6847,7 +6842,6 @@ CompilerType SwiftASTContext::GetFieldAtIndex(opaque_compiler_type_t type,
68476842
case swift::TypeKind::Metatype:
68486843
break;
68496844

6850-
case swift::TypeKind::NestedArchetype:
68516845
case swift::TypeKind::OpaqueTypeArchetype:
68526846
case swift::TypeKind::OpenedArchetype:
68536847
case swift::TypeKind::PrimaryArchetype:
@@ -6923,7 +6917,6 @@ uint32_t SwiftASTContext::GetNumPointeeChildren(opaque_compiler_type_t type) {
69236917
case swift::TypeKind::Class:
69246918
case swift::TypeKind::Protocol:
69256919
case swift::TypeKind::Metatype:
6926-
case swift::TypeKind::NestedArchetype:
69276920
case swift::TypeKind::OpaqueTypeArchetype:
69286921
case swift::TypeKind::OpenedArchetype:
69296922
case swift::TypeKind::PrimaryArchetype:
@@ -7276,7 +7269,6 @@ CompilerType SwiftASTContext::GetChildCompilerTypeAtIndex(
72767269
case swift::TypeKind::Metatype:
72777270
break;
72787271

7279-
case swift::TypeKind::NestedArchetype:
72807272
case swift::TypeKind::OpaqueTypeArchetype:
72817273
case swift::TypeKind::OpenedArchetype:
72827274
case swift::TypeKind::PrimaryArchetype:
@@ -7511,7 +7503,6 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
75117503
case swift::TypeKind::Metatype:
75127504
break;
75137505

7514-
case swift::TypeKind::NestedArchetype:
75157506
case swift::TypeKind::OpaqueTypeArchetype:
75167507
case swift::TypeKind::OpenedArchetype:
75177508
case swift::TypeKind::PrimaryArchetype:
@@ -7768,7 +7759,6 @@ bool SwiftASTContext::DumpTypeValue(
77687759
case swift::TypeKind::BuiltinNativeObject:
77697760
case swift::TypeKind::BuiltinUnsafeValueBuffer:
77707761
case swift::TypeKind::BuiltinBridgeObject:
7771-
case swift::TypeKind::NestedArchetype:
77727762
case swift::TypeKind::OpaqueTypeArchetype:
77737763
case swift::TypeKind::OpenedArchetype:
77747764
case swift::TypeKind::PrimaryArchetype:

0 commit comments

Comments
 (0)