diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 4da0d56fdcacb4..0c7170c0025e0b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -83,6 +83,10 @@ bool DebugNamesDWARFIndex::ProcessEntry( DWARFDIE die = dwarf.GetDIE(*ref); if (!die) return true; + // Clang erroneously emits index entries for declaration DIEs in case when the + // definition is in a type unit (llvm.org/pr77696). Weed those out. + if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) + return true; return callback(die); }