From 62f5b591f4f3b995f2eb1dec416a8731e5e408d8 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 14 May 2019 12:44:40 +0000 Subject: DWARF/NFC: Centralize DIERef conversions apple and manual indexing code were creating a DIERef in a bunch of places. Though the code itself is not much, it is also easy to simplify by factoring out the DIERef creation. In HashedNameToDIE I create a conversion operator from DIEInfo to DIERef, and in ManualDWARFIndex I just create the DIERef in a global variable up-front. This also reduces the diff in follow-up patches which change how DIERefs are constructed. llvm-svn: 360669 --- .../Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp') diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index de4cce83999..f955fee1758 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -13,8 +13,7 @@ void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray &die_info_array, DIEArray &die_offsets) { const size_t count = die_info_array.size(); for (size_t i = 0; i < count; ++i) - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); } void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray &die_info_array, @@ -33,8 +32,7 @@ void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray &die_info_array, tag == DW_TAG_structure_type || tag == DW_TAG_class_type; } if (tag_matches) - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); } } } @@ -58,8 +56,7 @@ void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray &die_info_array, tag == DW_TAG_structure_type || tag == DW_TAG_class_type; } if (tag_matches) - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); } } } @@ -77,8 +74,7 @@ void DWARFMappedHash::ExtractClassOrStructDIEArray( // We found the one true definition for this class, so only return // that die_offsets.clear(); - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); return; } else { // Put the one true definition as the first entry so it matches first @@ -86,8 +82,7 @@ void DWARFMappedHash::ExtractClassOrStructDIEArray( die_info_array[i].offset); } } else { - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); } } } @@ -99,8 +94,7 @@ void DWARFMappedHash::ExtractTypesFromDIEArray( const size_t count = die_info_array.size(); for (size_t i = 0; i < count; ++i) { if ((die_info_array[i].type_flags & type_flag_mask) == type_flag_value) - die_offsets.emplace_back(die_info_array[i].cu_offset, - die_info_array[i].offset); + die_offsets.emplace_back(die_info_array[i]); } } -- cgit v1.2.3