Skip to content

Commit 877963a

Browse files
committed
[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.
1 parent fd09f12 commit 877963a

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,8 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectFileSP objfile_sp,
406406
// contain the .o file index/ID
407407
m_debug_map_module_wp(), m_debug_map_symfile(nullptr),
408408
m_context(m_objfile_sp->GetModule()->GetSectionList(), dwo_section_list),
409-
m_data_debug_loc(), m_abbr(), m_info(), m_fetched_external_modules(false),
410-
m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate),
411-
m_unique_ast_type_map() {}
409+
m_fetched_external_modules(false),
410+
m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate) {}
412411

413412
SymbolFileDWARF::~SymbolFileDWARF() {}
414413

@@ -561,15 +560,6 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
561560
return abilities;
562561
}
563562

564-
const DWARFDataExtractor &
565-
SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type,
566-
DWARFDataSegment &data_segment) {
567-
llvm::call_once(data_segment.m_flag, [this, sect_type, &data_segment] {
568-
this->LoadSectionData(sect_type, std::ref(data_segment.m_data));
569-
});
570-
return data_segment.m_data;
571-
}
572-
573563
void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type,
574564
DWARFDataExtractor &data) {
575565
ModuleSP module_sp(m_objfile_sp->GetModule());
@@ -606,10 +596,6 @@ DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
606596
return m_abbr.get();
607597
}
608598

609-
const DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() const {
610-
return m_abbr.get();
611-
}
612-
613599
DWARFDebugInfo *SymbolFileDWARF::DebugInfo() {
614600
if (m_info == nullptr) {
615601
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
@@ -621,10 +607,6 @@ DWARFDebugInfo *SymbolFileDWARF::DebugInfo() {
621607
return m_info.get();
622608
}
623609

624-
const DWARFDebugInfo *SymbolFileDWARF::DebugInfo() const {
625-
return m_info.get();
626-
}
627-
628610
DWARFUnit *
629611
SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) {
630612
if (!comp_unit)

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,8 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
222222

223223
DWARFDebugAbbrev *DebugAbbrev();
224224

225-
const DWARFDebugAbbrev *DebugAbbrev() const;
226-
227225
DWARFDebugInfo *DebugInfo();
228226

229-
const DWARFDebugInfo *DebugInfo() const;
230-
231227
DWARFDebugRanges *GetDebugRanges();
232228

233229
static bool SupportedVersion(uint16_t version);
@@ -316,17 +312,8 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
316312
typedef llvm::DenseMap<lldb::opaque_compiler_type_t, lldb::user_id_t>
317313
ClangTypeToDIE;
318314

319-
struct DWARFDataSegment {
320-
llvm::once_flag m_flag;
321-
lldb_private::DWARFDataExtractor m_data;
322-
};
323-
324315
DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
325316

326-
const lldb_private::DWARFDataExtractor &
327-
GetCachedSectionData(lldb::SectionType sect_type,
328-
DWARFDataSegment &data_segment);
329-
330317
virtual void LoadSectionData(lldb::SectionType sect_type,
331318
lldb_private::DWARFDataExtractor &data);
332319

@@ -483,11 +470,6 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
483470

484471
lldb_private::DWARFContext m_context;
485472

486-
DWARFDataSegment m_data_debug_loc;
487-
DWARFDataSegment m_data_debug_loclists;
488-
489-
// The unique pointer items below are generated on demand if and when someone
490-
// accesses them through a non const version of this class.
491473
std::unique_ptr<DWARFDebugAbbrev> m_abbr;
492474
std::unique_ptr<DWARFDebugInfo> m_info;
493475
std::unique_ptr<GlobalVariableMap> m_global_aranges_up;

0 commit comments

Comments
 (0)