diff options
| author | Frederic Riss <friss@apple.com> | 2014-09-29 13:56:39 +0000 |
|---|---|---|
| committer | Frederic Riss <friss@apple.com> | 2014-09-29 13:56:39 +0000 |
| commit | 312a02e193a2345dad15465570e55d9e5e422030 (patch) | |
| tree | 359aaedb229c30b84402347d046bd00e9615380f /llvm/lib/DebugInfo/DWARFContext.cpp | |
| parent | 9e922e7d246ccd887f62966711b59a2d45227c07 (diff) | |
| download | bcm5719-llvm-312a02e193a2345dad15465570e55d9e5e422030.tar.gz bcm5719-llvm-312a02e193a2345dad15465570e55d9e5e422030.zip | |
Store TypeUnits in a SmallVector<DWARFUnitSection> instead of a single DWARFUnitSection.
There will be multiple TypeUnits in an unlinked object that will be extracted
from different sections. Now that we have DWARFUnitSection that is supposed
to represent an input section, we need a DWARFUnitSection<TypeUnit> per
input .debug_types section.
Once this is done, the interface is homogenous and we can move the Section
parsing code into DWARFUnitSection.
This is a respin of r218513 that got reverted because it broke some builders.
This new version features an explicit move constructor for the DWARFUnitSection
class to workaround compilers unable to generate correct C++11 default
constructors.
Reviewers: samsonov, dblaikie
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5482
llvm-svn: 218606
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFContext.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 62e3b9ccf64..819fc142e50 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -86,15 +86,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { if ((DumpType == DIDT_All || DumpType == DIDT_Types) && getNumTypeUnits()) { OS << "\n.debug_types contents:\n"; - for (const auto &TU : type_units()) - TU->dump(OS); + for (const auto &TUS : type_unit_sections()) + for (const auto &TU : TUS) + TU->dump(OS); } if ((DumpType == DIDT_All || DumpType == DIDT_TypesDwo) && getNumDWOTypeUnits()) { OS << "\n.debug_types.dwo contents:\n"; - for (const auto &DWOTU : dwo_type_units()) - DWOTU->dump(OS); + for (const auto &DWOTUS : dwo_type_unit_sections()) + for (const auto &DWOTU : DWOTUS) + DWOTU->dump(OS); } if (DumpType == DIDT_All || DumpType == DIDT_Loc) { @@ -337,15 +339,17 @@ void DWARFContext::parseTypeUnits() { uint32_t offset = 0; const DataExtractor &DIData = DataExtractor(I.second.Data, isLittleEndian(), 0); + TUs.push_back(DWARFUnitSection<DWARFTypeUnit>()); + auto &TUS = TUs.back(); while (DIData.isValidOffset(offset)) { std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this, getDebugAbbrev(), I.second.Data, getRangeSection(), getStringSection(), StringRef(), getAddrSection(), - &I.second.Relocs, isLittleEndian(), TUs)); + &I.second.Relocs, isLittleEndian(), TUS)); if (!TU->extract(DIData, &offset)) break; - TUs.push_back(std::move(TU)); - offset = TUs.back()->getNextUnitOffset(); + TUS.push_back(std::move(TU)); + offset = TUS.back()->getNextUnitOffset(); } } } @@ -376,15 +380,17 @@ void DWARFContext::parseDWOTypeUnits() { uint32_t offset = 0; const DataExtractor &DIData = DataExtractor(I.second.Data, isLittleEndian(), 0); + DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>()); + auto &TUS = DWOTUs.back(); while (DIData.isValidOffset(offset)) { std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this, getDebugAbbrevDWO(), I.second.Data, getRangeDWOSection(), getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(), - &I.second.Relocs, isLittleEndian(), DWOTUs)); + &I.second.Relocs, isLittleEndian(), TUS)); if (!TU->extract(DIData, &offset)) break; - DWOTUs.push_back(std::move(TU)); - offset = DWOTUs.back()->getNextUnitOffset(); + TUS.push_back(std::move(TU)); + offset = TUS.back()->getNextUnitOffset(); } } } |

