labath created this revision. labath added reviewers: clayborg, JDevlieghere. Herald added subscribers: jdoerfert, aprantl.
The DWARFCompileUnit is set as the "user data" of the lldb compile unit directly in the constructor (see ParseCompileUnit). This means that instead of going through unit indexes, we can just fetch the DWARF unit directly from there. https://reviews.llvm.org/D62943 Files: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -608,15 +608,7 @@ if (!comp_unit) return nullptr; - DWARFDebugInfo *info = DebugInfo(); - if (info) { - // The compile unit ID is the index of the DWARF unit. - DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID()); - if (dwarf_cu && dwarf_cu->GetUserData() == nullptr) - dwarf_cu->SetUserData(comp_unit); - return dwarf_cu; - } - return nullptr; + return static_cast<DWARFUnit *>(comp_unit->GetUserData()); } DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRanges() {
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -608,15 +608,7 @@ if (!comp_unit) return nullptr; - DWARFDebugInfo *info = DebugInfo(); - if (info) { - // The compile unit ID is the index of the DWARF unit. - DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID()); - if (dwarf_cu && dwarf_cu->GetUserData() == nullptr) - dwarf_cu->SetUserData(comp_unit); - return dwarf_cu; - } - return nullptr; + return static_cast<DWARFUnit *>(comp_unit->GetUserData()); } DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRanges() {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits