Skip to content

Commit 5d31bb6

Browse files
committed
[LLDB] Remove Swift customizations from DWARFDIE
1 parent e48cfe4 commit 5d31bb6

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ DWARFASTParserSwift::ResolveTypeAlias(lldb_private::CompilerType alias) {
9898
std::string alias_name = ts.GetBaseName(alias.GetOpaqueQualType());
9999
for (DWARFDIE child_die : parent_die.children()) {
100100
auto tag = child_die.Tag();
101-
if (tag == DW_TAG_member)
101+
if (tag == llvm::dwarf::DW_TAG_member)
102102
continue;
103103
std::string base_name;
104104
const auto *name =

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

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include "DWARFDebugInfoEntry.h"
1414
#include "DWARFDeclContext.h"
1515
#include "DWARFUnit.h"
16-
#ifdef LLDB_ENABLE_SWIFT
17-
#include "Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.h"
18-
#endif
16+
#include "LogChannelDWARF.h"
1917
#include "lldb/Symbol/Type.h"
2018

2119
#include "llvm/ADT/iterator.h"
@@ -441,25 +439,6 @@ static void GetDeclContextImpl(DWARFDIE die, bool derive_template_names,
441439
}
442440

443441
// Add this DIE's contribution at the end of the chain.
444-
auto push_ctx = [&](CompilerContextKind kind, llvm::StringRef name) {
445-
#ifdef LLDB_ENABLE_SWIFT
446-
// FIXME: This layering violation works around a limitation in
447-
// LLVM that prevents swiftc from emitting both DW_AT_name and
448-
// DW_AT_linkage_name on forward declarations and typedefs.
449-
//
450-
// We should not upstream this but instead fix the Swift compiler.
451-
std::string base_name;
452-
if (!name.empty() && name[0] == '$') {
453-
// We should also check the unit's DW_LANG here.
454-
const char *mangled = ConstString(name).AsCString();
455-
base_name = TypeSystemSwiftTypeRef::GetBaseName(
456-
(lldb::opaque_compiler_type_t)mangled);
457-
if (!base_name.empty())
458-
name = base_name;
459-
}
460-
#endif
461-
context.push_back({kind, ConstString(name)});
462-
};
463442
switch (die.Tag()) {
464443
case DW_TAG_module:
465444
case DW_TAG_namespace:

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,16 @@ TypeSystemSwiftTypeRef::ResolveTypeAlias(swift::Demangle::Demangler &dem,
10401040
};
10411041

10421042
TypeResults results;
1043+
1044+
1045+
std::vector<CompilerContext> decl_context;
1046+
BuildDeclContext(node, decl_context);
1047+
if (decl_context.size() &&
1048+
decl_context[0].kind == CompilerContextKind::Module &&
1049+
decl_context[0].name.GetStringRef().starts_with("__lldb"))
1050+
decl_context.erase(decl_context.begin());
1051+
1052+
// TypeQuery query(decl_context, TypeQueryOptions::e_find_one);
10431053
TypeQuery query(mangled.GetStringRef(), TypeQueryOptions::e_find_one);
10441054
if (!prefer_clang_types) {
10451055
// First check if this type has already been parsed from DWARF.
@@ -1059,7 +1069,6 @@ TypeSystemSwiftTypeRef::ResolveTypeAlias(swift::Demangle::Demangler &dem,
10591069
"Could not resolve type alias {0}: {1}",
10601070
mangled.AsCString());
10611071
}
1062-
10631072
// Do an even more expensive global search.
10641073
target_sp->GetImages().FindTypes(/*search_first=*/nullptr, query,
10651074
results);

0 commit comments

Comments
 (0)