[Lldb-commits] [lldb] 877963a - [lldb/DWARF] Delete some dead code in SymbolFileDWARF

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 31 05:49:33 PST 2020


Author: Pavel Labath
Date: 2020-01-31T14:47:25+01:00
New Revision: 877963a35a0405576fc805d5b5087619e14e9f5f

URL: https://github.com/llvm/llvm-project/commit/877963a35a0405576fc805d5b5087619e14e9f5f
DIFF: https://github.com/llvm/llvm-project/commit/877963a35a0405576fc805d5b5087619e14e9f5f.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 51d05b87a147..c5fe08a8a5aa 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 1e6b518c76ad..556be1e63e6a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -222,12 +222,8 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
 
   DWARFDebugAbbrev *DebugAbbrev();
 
-  const DWARFDebugAbbrev *DebugAbbrev() const;
-
   DWARFDebugInfo *DebugInfo();
 
-  const DWARFDebugInfo *DebugInfo() const;
-
   DWARFDebugRanges *GetDebugRanges();
 
   static bool SupportedVersion(uint16_t version);
@@ -316,17 +312,8 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
   typedef llvm::DenseMap<lldb::opaque_compiler_type_t, lldb::user_id_t>
       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 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
 
   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<DWARFDebugAbbrev> m_abbr;
   std::unique_ptr<DWARFDebugInfo> m_info;
   std::unique_ptr<GlobalVariableMap> m_global_aranges_up;


        


More information about the lldb-commits mailing list