From 877963a35a0405576fc805d5b5087619e14e9f5f Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 31 Jan 2020 14:45:35 +0100 Subject: [PATCH] [lldb/DWARF] Delete some dead code in SymbolFileDWARF - m_debug_loc(lists) are unused since the relevant logic was moved to DWARFContext. - const versions of DebugInfo(), DebugAbbrev() are not used, and they are dangerous to use as they do not initialize the relevant objects. --- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 22 ++-------------------- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 18 ------------------ 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 51d05b8..c5fe08a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -406,9 +406,8 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectFileSP objfile_sp, // contain the .o file index/ID m_debug_map_module_wp(), m_debug_map_symfile(nullptr), m_context(m_objfile_sp->GetModule()->GetSectionList(), dwo_section_list), - m_data_debug_loc(), m_abbr(), m_info(), m_fetched_external_modules(false), - m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate), - m_unique_ast_type_map() {} + m_fetched_external_modules(false), + m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate) {} SymbolFileDWARF::~SymbolFileDWARF() {} @@ -561,15 +560,6 @@ uint32_t SymbolFileDWARF::CalculateAbilities() { return abilities; } -const DWARFDataExtractor & -SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type, - DWARFDataSegment &data_segment) { - llvm::call_once(data_segment.m_flag, [this, sect_type, &data_segment] { - this->LoadSectionData(sect_type, std::ref(data_segment.m_data)); - }); - return data_segment.m_data; -} - void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type, DWARFDataExtractor &data) { ModuleSP module_sp(m_objfile_sp->GetModule()); @@ -606,10 +596,6 @@ DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() { return m_abbr.get(); } -const DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() const { - return m_abbr.get(); -} - DWARFDebugInfo *SymbolFileDWARF::DebugInfo() { if (m_info == nullptr) { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); @@ -621,10 +607,6 @@ DWARFDebugInfo *SymbolFileDWARF::DebugInfo() { return m_info.get(); } -const DWARFDebugInfo *SymbolFileDWARF::DebugInfo() const { - return m_info.get(); -} - DWARFUnit * SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) { if (!comp_unit) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 1e6b518..556be1e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -222,12 +222,8 @@ public: DWARFDebugAbbrev *DebugAbbrev(); - const DWARFDebugAbbrev *DebugAbbrev() const; - DWARFDebugInfo *DebugInfo(); - const DWARFDebugInfo *DebugInfo() const; - DWARFDebugRanges *GetDebugRanges(); static bool SupportedVersion(uint16_t version); @@ -316,17 +312,8 @@ protected: typedef llvm::DenseMap ClangTypeToDIE; - struct DWARFDataSegment { - llvm::once_flag m_flag; - lldb_private::DWARFDataExtractor m_data; - }; - DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF); - const lldb_private::DWARFDataExtractor & - GetCachedSectionData(lldb::SectionType sect_type, - DWARFDataSegment &data_segment); - virtual void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data); @@ -483,11 +470,6 @@ protected: lldb_private::DWARFContext m_context; - DWARFDataSegment m_data_debug_loc; - DWARFDataSegment m_data_debug_loclists; - - // The unique pointer items below are generated on demand if and when someone - // accesses them through a non const version of this class. std::unique_ptr m_abbr; std::unique_ptr m_info; std::unique_ptr m_global_aranges_up; -- 2.7.4