Skip to content

[lldb] Adapt Swift plugin to new alias debug info #10235

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
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 @@ -706,7 +706,7 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) {
HEALTH_LOG("{0}: unimplemented type info in {1}", type.GetMangledTypeName(),
function);
#ifndef NDEBUG
llvm::dbgs() << function << ": unimplemented type info in"
llvm::dbgs() << function << ": unimplemented type info in "
<< type.GetMangledTypeName() << "\n";
if (ModuleList::GetGlobalModuleListProperties().GetSwiftValidateTypeSystem())
assert(false && "not implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
preferred_name = name;
compiler_type = m_swift_typesystem.GetTypeFromMangledTypename(
ConstString(typedef_name));
} else {
// Otherwise ignore the typedef name and resolve the pointee.
if (TypeSP desugared_type = get_type(die)) {
preferred_name = name;
compiler_type = desugared_type->GetForwardCompilerType();
}
}
}

Expand Down
15 changes: 12 additions & 3 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2397,9 +2397,18 @@ TypeSystemSwiftTypeRef::FindTypeInModule(opaque_compiler_type_t opaque_type) {
return {};
// DW_AT_linkage_name is not part of the accelerator table, so
// we need to search by decl context.

TypeQuery query(*context, TypeQueryOptions::e_find_one |
TypeQueryOptions::e_module_search);
auto options =
TypeQueryOptions::e_find_one | TypeQueryOptions::e_module_search;

// FIXME: It would be nice to not need this.
if (context->size() == 2 &&
context->front().kind == CompilerContextKind::Module &&
context->front().name == "Builtin") {
// LLVM cannot nest basic types inside a module.
context->erase(context->begin());
options = TypeQueryOptions::e_find_one;
}
TypeQuery query(*context, options);
query.SetLanguages(TypeSystemSwift::GetSupportedLanguagesForTypes());

TypeResults results;
Expand Down