diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-06-19 07:32:39 +0000 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-06-19 07:32:39 +0000 |
| commit | 67b45acefefbbbee48ac08fc5f924758bf2553b7 (patch) | |
| tree | da54e9ecb3b170e3660a091196217787546cbe9c /lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp | |
| parent | 08372eb73bf0a21d8d824084cb15efd0a9ee99bb (diff) | |
| download | bcm5719-llvm-67b45acefefbbbee48ac08fc5f924758bf2553b7.tar.gz bcm5719-llvm-67b45acefefbbbee48ac08fc5f924758bf2553b7.zip | |
DWARF: Make DIERefs always valid
Summary:
This patch makes the DIERef class always valid by default constructor
and operator bool. This allows one to express the validity of a DIERef
in the type system. Places which are working with potentially-invalid
DIERefs have been updated to use Optional<DIERef> instead.
The constructor taking a DWARFFormValue was not needed, as all places
which were constructing a DIERef this way were immediately converting it
into a DWARFDIE or a user_id. This can be done without constructing an
intermediate DIERef.
Reviewers: JDevlieghere, clayborg, aprantl
Subscribers: arphaman, lldb-commits
Differential Revision: https://reviews.llvm.org/D63399
llvm-svn: 363767
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index 2cd7c92f1ca..62b0ad37a9f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -117,13 +117,9 @@ const char *DWARFMappedHash::GetAtomTypeName(uint16_t atom) { return "<invalid>"; } -DWARFMappedHash::DIEInfo::DIEInfo() - : tag(0), type_flags(0), qualified_name_hash(0) {} - -DWARFMappedHash::DIEInfo::DIEInfo(dw_offset_t c, dw_offset_t o, dw_tag_t t, - uint32_t f, uint32_t h) - : die_ref(DIERef::Section::DebugInfo, c, o), tag(t), type_flags(f), - qualified_name_hash(h) {} +DWARFMappedHash::DIEInfo::DIEInfo(dw_offset_t o, dw_tag_t t, uint32_t f, + uint32_t h) + : die_offset(o), tag(t), type_flags(f), qualified_name_hash(h) {} DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset) : die_base_offset(_die_base_offset), atoms(), atom_mask(0), @@ -271,7 +267,7 @@ bool DWARFMappedHash::Header::Read(const lldb_private::DWARFDataExtractor &data, switch (header_data.atoms[i].type) { case eAtomTypeDIEOffset: // DIE offset, check form for encoding - hash_data.die_ref.die_offset = + hash_data.die_offset = DWARFFormValue::IsDataForm(form_value.Form()) ? form_value.Unsigned() : form_value.Reference(header_data.die_base_offset); @@ -294,7 +290,7 @@ bool DWARFMappedHash::Header::Read(const lldb_private::DWARFDataExtractor &data, break; } } - return true; + return hash_data.die_offset != DW_INVALID_OFFSET; } DWARFMappedHash::MemoryTable::MemoryTable( @@ -506,10 +502,10 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsInRange( for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, &hash_data_offset, die_info)) { - if (die_info.die_ref.die_offset == 0) + if (die_info.die_offset == 0) done = true; - if (die_offset_start <= die_info.die_ref.die_offset && - die_info.die_ref.die_offset < die_offset_end) + if (die_offset_start <= die_info.die_offset && + die_info.die_offset < die_offset_end) die_info_array.push_back(die_info); } } |

