Clean up DWARFDebugInfoEntry

llvm-svn: 361962
This commit is contained in:
Fangrui Song 2019-05-29 14:36:11 +00:00
parent 268dfaf153
commit 898aaf1cb8
2 changed files with 0 additions and 106 deletions

View File

@ -1074,13 +1074,6 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
} }
} }
std::vector<DWARFDIE>
DWARFDebugInfoEntry::GetDeclContextDIEs(DWARFUnit *cu) const {
DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this));
return die.GetDeclContextDIEs();
}
void DWARFDebugInfoEntry::GetDWARFDeclContext( void DWARFDebugInfoEntry::GetDWARFDeclContext(
DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const { DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const {
const dw_tag_t tag = Tag(); const dw_tag_t tag = Tag();
@ -1096,14 +1089,6 @@ void DWARFDebugInfoEntry::GetDWARFDeclContext(
} }
} }
bool DWARFDebugInfoEntry::MatchesDWARFDeclContext(
DWARFUnit *cu, const DWARFDeclContext &dwarf_decl_ctx) const {
DWARFDeclContext this_dwarf_decl_ctx;
GetDWARFDeclContext(cu, this_dwarf_decl_ctx);
return this_dwarf_decl_ctx == dwarf_decl_ctx;
}
DWARFDIE DWARFDIE
DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const { DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const {
DWARFAttributes attributes; DWARFAttributes attributes;
@ -1214,7 +1199,6 @@ DWARFDebugInfoEntry::GetQualifiedName(DWARFUnit *cu,
return storage.c_str(); return storage.c_str();
} }
// LookupAddress
bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address, bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
const DWARFUnit *cu, const DWARFUnit *cu,
DWARFDebugInfoEntry **function_die, DWARFDebugInfoEntry **function_die,
@ -1232,13 +1216,9 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
check_children = true; check_children = true;
break; break;
case DW_TAG_entry_point: case DW_TAG_entry_point:
break;
case DW_TAG_enumeration_type: case DW_TAG_enumeration_type:
break;
case DW_TAG_formal_parameter: case DW_TAG_formal_parameter:
break;
case DW_TAG_imported_declaration: case DW_TAG_imported_declaration:
break;
case DW_TAG_label: case DW_TAG_label:
break; break;
case DW_TAG_lexical_block: case DW_TAG_lexical_block:
@ -1246,9 +1226,7 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_member: case DW_TAG_member:
break;
case DW_TAG_pointer_type: case DW_TAG_pointer_type:
break;
case DW_TAG_reference_type: case DW_TAG_reference_type:
break; break;
case DW_TAG_compile_unit: case DW_TAG_compile_unit:
@ -1260,20 +1238,15 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
check_children = true; check_children = true;
break; break;
case DW_TAG_subroutine_type: case DW_TAG_subroutine_type:
break;
case DW_TAG_typedef: case DW_TAG_typedef:
break;
case DW_TAG_union_type: case DW_TAG_union_type:
break;
case DW_TAG_unspecified_parameters: case DW_TAG_unspecified_parameters:
break;
case DW_TAG_variant: case DW_TAG_variant:
break; break;
case DW_TAG_common_block: case DW_TAG_common_block:
check_children = true; check_children = true;
break; break;
case DW_TAG_common_inclusion: case DW_TAG_common_inclusion:
break;
case DW_TAG_inheritance: case DW_TAG_inheritance:
break; break;
case DW_TAG_inlined_subroutine: case DW_TAG_inlined_subroutine:
@ -1284,76 +1257,53 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_ptr_to_member_type: case DW_TAG_ptr_to_member_type:
break;
case DW_TAG_set_type: case DW_TAG_set_type:
break;
case DW_TAG_subrange_type: case DW_TAG_subrange_type:
break;
case DW_TAG_with_stmt: case DW_TAG_with_stmt:
break;
case DW_TAG_access_declaration: case DW_TAG_access_declaration:
break;
case DW_TAG_base_type: case DW_TAG_base_type:
break; break;
case DW_TAG_catch_block: case DW_TAG_catch_block:
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_const_type: case DW_TAG_const_type:
break;
case DW_TAG_constant: case DW_TAG_constant:
break;
case DW_TAG_enumerator: case DW_TAG_enumerator:
break;
case DW_TAG_file_type: case DW_TAG_file_type:
break;
case DW_TAG_friend: case DW_TAG_friend:
break;
case DW_TAG_namelist: case DW_TAG_namelist:
break;
case DW_TAG_namelist_item: case DW_TAG_namelist_item:
break;
case DW_TAG_packed_type: case DW_TAG_packed_type:
break; break;
case DW_TAG_subprogram: case DW_TAG_subprogram:
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_template_type_parameter: case DW_TAG_template_type_parameter:
break;
case DW_TAG_template_value_parameter: case DW_TAG_template_value_parameter:
break;
case DW_TAG_GNU_template_parameter_pack: case DW_TAG_GNU_template_parameter_pack:
break;
case DW_TAG_thrown_type: case DW_TAG_thrown_type:
break; break;
case DW_TAG_try_block: case DW_TAG_try_block:
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_variant_part: case DW_TAG_variant_part:
break;
case DW_TAG_variable: case DW_TAG_variable:
break;
case DW_TAG_volatile_type: case DW_TAG_volatile_type:
break;
case DW_TAG_dwarf_procedure: case DW_TAG_dwarf_procedure:
break;
case DW_TAG_restrict_type: case DW_TAG_restrict_type:
break;
case DW_TAG_interface_type: case DW_TAG_interface_type:
break; break;
case DW_TAG_namespace: case DW_TAG_namespace:
check_children = true; check_children = true;
break; break;
case DW_TAG_imported_module: case DW_TAG_imported_module:
break;
case DW_TAG_unspecified_type: case DW_TAG_unspecified_type:
break; break;
case DW_TAG_partial_unit: case DW_TAG_partial_unit:
match_addr_range = true; match_addr_range = true;
break; break;
case DW_TAG_imported_unit: case DW_TAG_imported_unit:
break;
case DW_TAG_shared_type: case DW_TAG_shared_type:
break;
default: default:
break; break;
} }
@ -1485,11 +1435,6 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(
return nullptr; return nullptr;
} }
bool DWARFDebugInfoEntry::OffsetLessThan(const DWARFDebugInfoEntry &a,
const DWARFDebugInfoEntry &b) {
return a.GetOffset() < b.GetOffset();
}
bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const { bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx && return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
m_sibling_idx == rhs.m_sibling_idx && m_sibling_idx == rhs.m_sibling_idx &&

View File

@ -19,26 +19,6 @@
#include <set> #include <set>
#include <vector> #include <vector>
typedef std::map<const DWARFDebugInfoEntry *, dw_addr_t> DIEToAddressMap;
typedef DIEToAddressMap::iterator DIEToAddressMapIter;
typedef DIEToAddressMap::const_iterator DIEToAddressMapConstIter;
typedef std::map<dw_addr_t, const DWARFDebugInfoEntry *> AddressToDIEMap;
typedef AddressToDIEMap::iterator AddressToDIEMapIter;
typedef AddressToDIEMap::const_iterator AddressToDIEMapConstIter;
typedef std::map<dw_offset_t, dw_offset_t> DIEToDIEMap;
typedef DIEToDIEMap::iterator DIEToDIEMapIter;
typedef DIEToDIEMap::const_iterator DIEToDIEMapConstIter;
typedef std::map<uint32_t, const DWARFDebugInfoEntry *> UInt32ToDIEMap;
typedef UInt32ToDIEMap::iterator UInt32ToDIEMapIter;
typedef UInt32ToDIEMap::const_iterator UInt32ToDIEMapConstIter;
typedef std::multimap<uint32_t, const DWARFDebugInfoEntry *> UInt32ToDIEMMap;
typedef UInt32ToDIEMMap::iterator UInt32ToDIEMMapIter;
typedef UInt32ToDIEMMap::const_iterator UInt32ToDIEMMapConstIter;
class DWARFDeclContext; class DWARFDeclContext;
#define DIE_SIBLING_IDX_BITSIZE 31 #define DIE_SIBLING_IDX_BITSIZE 31
@ -49,10 +29,6 @@ public:
typedef collection::iterator iterator; typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator; typedef collection::const_iterator const_iterator;
typedef std::vector<dw_offset_t> offset_collection;
typedef offset_collection::iterator offset_collection_iterator;
typedef offset_collection::const_iterator offset_collection_const_iterator;
DWARFDebugInfoEntry() DWARFDebugInfoEntry()
: m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0), : m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0),
m_has_children(false), m_abbr_idx(0), m_tag(0) {} m_has_children(false), m_abbr_idx(0), m_tag(0) {}
@ -129,9 +105,6 @@ public:
const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes, const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
std::string &storage) const; std::string &storage) const;
static bool OffsetLessThan(const DWARFDebugInfoEntry &a,
const DWARFDebugInfoEntry &b);
void Dump(const DWARFUnit *cu, lldb_private::Stream &s, void Dump(const DWARFUnit *cu, lldb_private::Stream &s,
uint32_t recurse_depth) const; uint32_t recurse_depth) const;
@ -187,38 +160,14 @@ public:
return HasChildren() ? this + 1 : nullptr; return HasChildren() ? this + 1 : nullptr;
} }
std::vector<DWARFDIE> GetDeclContextDIEs(DWARFUnit *cu) const;
void GetDWARFDeclContext(DWARFUnit *cu, void GetDWARFDeclContext(DWARFUnit *cu,
DWARFDeclContext &dwarf_decl_ctx) const; DWARFDeclContext &dwarf_decl_ctx) const;
bool MatchesDWARFDeclContext(DWARFUnit *cu,
const DWARFDeclContext &dwarf_decl_ctx) const;
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const; DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu, DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
const DWARFAttributes &attributes) const; const DWARFAttributes &attributes) const;
void SetParent(DWARFDebugInfoEntry *parent) {
if (parent) {
// We know we are kept in a vector of contiguous entries, so we know
// our parent will be some index behind "this".
m_parent_idx = this - parent;
} else
m_parent_idx = 0;
}
void SetSibling(DWARFDebugInfoEntry *sibling) {
if (sibling) {
// We know we are kept in a vector of contiguous entries, so we know
// our sibling will be some index after "this".
m_sibling_idx = sibling - this;
sibling->SetParent(GetParent());
} else
m_sibling_idx = 0;
}
void SetSiblingIndex(uint32_t idx) { m_sibling_idx = idx; } void SetSiblingIndex(uint32_t idx) { m_sibling_idx = idx; }
void SetParentIndex(uint32_t idx) { m_parent_idx = idx; } void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
protected: protected: