Skip to content

Work around upcoming removal of NestedArchetypeType. #3796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,9 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
[&](swift::SubstitutableType *type) -> swift::Type {
auto opaque_type =
llvm::dyn_cast<swift::OpaqueTypeArchetypeType>(type);
if (!opaque_type)
if (!opaque_type ||
!opaque_type->getInterfaceType()
->is<swift::GenericTypeParamType>())
return type;

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

// Ask RemoteAST to get the underlying type out of the descriptor.
auto &remote_ast = GetRemoteASTContext(*scratch_ctx);
auto genericParam = opaque_type->getInterfaceType()
->getAs<swift::GenericTypeParamType>();
auto underlying_type_result =
remote_ast.getUnderlyingTypeForOpaqueType(
swift::remote::RemoteAddress(addr),
opaque_type->getSubstitutions(),
opaque_type->getOrdinal());
genericParam->getIndex());

if (!underlying_type_result)
continue;
Expand Down
10 changes: 0 additions & 10 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5632,7 +5632,6 @@ SwiftASTContext::GetTypeInfo(opaque_compiler_type_t type,
case swift::TypeKind::Error:
case swift::TypeKind::InOut:
case swift::TypeKind::Module:
case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::Placeholder:
Expand Down Expand Up @@ -5815,7 +5814,6 @@ lldb::TypeClass SwiftASTContext::GetTypeClass(opaque_compiler_type_t type) {
case swift::TypeKind::ProtocolComposition:
case swift::TypeKind::Metatype:
case swift::TypeKind::Module:
case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -6275,7 +6273,6 @@ lldb::Encoding SwiftASTContext::GetEncoding(opaque_compiler_type_t type,
case swift::TypeKind::BuiltinFloat:
return lldb::eEncodingIEEE754; // TODO: detect if an integer is unsigned

case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -6414,7 +6411,6 @@ uint32_t SwiftASTContext::GetNumChildren(opaque_compiler_type_t type,

case swift::TypeKind::ExistentialMetatype:
case swift::TypeKind::Metatype:
case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -6550,7 +6546,6 @@ uint32_t SwiftASTContext::GetNumFields(opaque_compiler_type_t type,
case swift::TypeKind::Metatype:
return 0;

case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -6847,7 +6842,6 @@ CompilerType SwiftASTContext::GetFieldAtIndex(opaque_compiler_type_t type,
case swift::TypeKind::Metatype:
break;

case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -6923,7 +6917,6 @@ uint32_t SwiftASTContext::GetNumPointeeChildren(opaque_compiler_type_t type) {
case swift::TypeKind::Class:
case swift::TypeKind::Protocol:
case swift::TypeKind::Metatype:
case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -7276,7 +7269,6 @@ CompilerType SwiftASTContext::GetChildCompilerTypeAtIndex(
case swift::TypeKind::Metatype:
break;

case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -7511,7 +7503,6 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
case swift::TypeKind::Metatype:
break;

case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down Expand Up @@ -7768,7 +7759,6 @@ bool SwiftASTContext::DumpTypeValue(
case swift::TypeKind::BuiltinNativeObject:
case swift::TypeKind::BuiltinUnsafeValueBuffer:
case swift::TypeKind::BuiltinBridgeObject:
case swift::TypeKind::NestedArchetype:
case swift::TypeKind::OpaqueTypeArchetype:
case swift::TypeKind::OpenedArchetype:
case swift::TypeKind::PrimaryArchetype:
Expand Down