Skip to content

Commit b16b706

Browse files
committed
[lldb] Adapt Swift plugin to new alias debug info
1 parent 40911cc commit b16b706

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) {
706706
HEALTH_LOG("{0}: unimplemented type info in {1}", type.GetMangledTypeName(),
707707
function);
708708
#ifndef NDEBUG
709-
llvm::dbgs() << function << ": unimplemented type info in"
709+
llvm::dbgs() << function << ": unimplemented type info in "
710710
<< type.GetMangledTypeName() << "\n";
711711
if (ModuleList::GetGlobalModuleListProperties().GetSwiftValidateTypeSystem())
712712
assert(false && "not implemented");

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
173173
preferred_name = name;
174174
compiler_type = m_swift_typesystem.GetTypeFromMangledTypename(
175175
ConstString(typedef_name));
176+
} else {
177+
// Otherwise ignore the typedef name and resolve the pointee.
178+
if (TypeSP desugared_type = get_type(die)) {
179+
preferred_name = name;
180+
compiler_type = desugared_type->GetForwardCompilerType();
181+
}
176182
}
177183
}
178184

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,9 +2397,18 @@ TypeSystemSwiftTypeRef::FindTypeInModule(opaque_compiler_type_t opaque_type) {
23972397
return {};
23982398
// DW_AT_linkage_name is not part of the accelerator table, so
23992399
// we need to search by decl context.
2400-
2401-
TypeQuery query(*context, TypeQueryOptions::e_find_one |
2402-
TypeQueryOptions::e_module_search);
2400+
auto options =
2401+
TypeQueryOptions::e_find_one | TypeQueryOptions::e_module_search;
2402+
2403+
// FIXME: It would be nice to not need this.
2404+
if (context->size() == 2 &&
2405+
context->front().kind == CompilerContextKind::Module &&
2406+
context->front().name == "Builtin") {
2407+
// LLVM cannot nest basic types inside a module.
2408+
context->erase(context->begin());
2409+
options = TypeQueryOptions::e_find_one;
2410+
}
2411+
TypeQuery query(*context, options);
24032412
query.SetLanguages(TypeSystemSwift::GetSupportedLanguagesForTypes());
24042413

24052414
TypeResults results;

0 commit comments

Comments
 (0)