Skip to content

Commit 3901846

Browse files
committed
[lldb] Fix mangled name being overwritten on type with DW_AT_specification
The order of the attributes wasn't deterministic, and it just happened that the DW_AT_linkage_name of the specifier type used to always come last. Now the algorithm for parsing attributes has changed and made deterministic, and the current algorithm will parse the attributes of the specifier TAG first, and specified last. Make sure to not overwrite the mangled name of a specified type. rdar://158634690
1 parent a2f55fd commit 3901846

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
103103
break;
104104
case llvm::dwarf::DW_AT_linkage_name:
105105
case llvm::dwarf::DW_AT_MIPS_linkage_name: {
106-
mangled_name.SetCString(form_value.AsCString());
106+
// This could be a type with DW_AT_specification, in which case,
107+
// don't overwrite the mangled name if it's already set (the
108+
// order of the attributes is deterministic, and the "specifier"
109+
// attributes will always come before the specified).
110+
if (mangled_name.IsEmpty())
111+
mangled_name.SetCString(form_value.AsCString());
107112
auto HasSpecificationOf = [&](){
108113
if (has_specification_of)
109114
return true;

0 commit comments

Comments
 (0)