[Lldb-commits] [lldb] r362783 - DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 7 02:43:47 PDT 2019
Author: labath
Date: Fri Jun 7 02:43:47 2019
New Revision: 362783
URL: http://llvm.org/viewvc/llvm-project?rev=362783&view=rev
Log:
DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit
Summary:
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.
Reviewers: clayborg, JDevlieghere
Subscribers: aprantl, jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D62943
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=362783&r1=362782&r2=362783&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jun 7 02:43:47 2019
@@ -608,15 +608,7 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
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() {
More information about the lldb-commits
mailing list