diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 0b789fd0c7c..0518dbf3747 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -54,7 +54,6 @@ #include "AppleDWARFIndex.h" #include "DWARFASTParser.h" #include "DWARFASTParserClang.h" -#include "DWARFDIECollection.h" #include "DWARFDebugAbbrev.h" #include "DWARFDebugAranges.h" #include "DWARFDebugInfo.h" @@ -861,22 +860,20 @@ lldb::LanguageType SymbolFileDWARF::ParseLanguage(CompileUnit &comp_unit) { size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) { ASSERT_MODULE_LOCK(this); - size_t functions_added = 0; DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); - if (dwarf_cu) { - DWARFDIECollection function_dies; - const size_t num_functions = - dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies); - size_t func_idx; - for (func_idx = 0; func_idx < num_functions; ++func_idx) { - DWARFDIE die = function_dies.GetDIEAtIndex(func_idx); - if (comp_unit.FindFunctionByUID(die.GetID()).get() == NULL) { - if (ParseFunction(comp_unit, die)) - ++functions_added; - } - } - // FixupTypes(); + if (!dwarf_cu) + return 0; + + size_t functions_added = 0; + std::vector<DWARFDIE> function_dies; + dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies); + for (const DWARFDIE &die : function_dies) { + if (comp_unit.FindFunctionByUID(die.GetID())) + continue; + if (ParseFunction(comp_unit, die)) + ++functions_added; } + // FixupTypes(); return functions_added; } @@ -2807,8 +2804,8 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, if (die1 == die2) return true; - DWARFDIECollection decl_ctx_1; - DWARFDIECollection decl_ctx_2; + std::vector<DWARFDIE> decl_ctx_1; + std::vector<DWARFDIE> decl_ctx_2; // The declaration DIE stack is a stack of the declaration context DIEs all // the way back to the compile unit. If a type "T" is declared inside a class // "B", and class "B" is declared inside a class "A" and class "A" is in a @@ -2824,11 +2821,11 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, // back to the compiler unit. // First lets grab the decl contexts for both DIEs - die1.GetDeclContextDIEs(decl_ctx_1); - die2.GetDeclContextDIEs(decl_ctx_2); + decl_ctx_1 = die1.GetDeclContextDIEs(); + decl_ctx_2 = die2.GetDeclContextDIEs(); // Make sure the context arrays have the same size, otherwise we are done - const size_t count1 = decl_ctx_1.Size(); - const size_t count2 = decl_ctx_2.Size(); + const size_t count1 = decl_ctx_1.size(); + const size_t count2 = decl_ctx_2.size(); if (count1 != count2) return false; @@ -2838,8 +2835,8 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, DWARFDIE decl_ctx_die2; size_t i; for (i = 0; i < count1; i++) { - decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i); - decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i); + decl_ctx_die1 = decl_ctx_1[i]; + decl_ctx_die2 = decl_ctx_2[i]; if (decl_ctx_die1.Tag() != decl_ctx_die2.Tag()) return false; } @@ -2849,7 +2846,7 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then // something went wrong in the DWARFDIE::GetDeclContextDIEs() // function. - dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag(); + dw_tag_t cu_tag = decl_ctx_1[count1 - 1].Tag(); UNUSED_IF_ASSERT_DISABLED(cu_tag); assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit); @@ -2857,8 +2854,8 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, // Always skip the compile unit when comparing by only iterating up to "count // - 1". Here we compare the names as we go. for (i = 0; i < count1 - 1; i++) { - decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i); - decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i); + decl_ctx_die1 = decl_ctx_1[i]; + decl_ctx_die2 = decl_ctx_2[i]; const char *name1 = decl_ctx_die1.GetName(); const char *name2 = decl_ctx_die2.GetName(); // If the string was from a DW_FORM_strp, then the pointer will often be |