[llvm] r338629 - [DebugInfo/DWARF] [2/4] Type units no longer in a std::deque. NFC

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 13:46:46 PDT 2018


Author: probinson
Date: Wed Aug  1 13:46:46 2018
New Revision: 338629

URL: http://llvm.org/viewvc/llvm-project?rev=338629&view=rev
Log:
[DebugInfo/DWARF] [2/4] Type units no longer in a std::deque. NFC

This is patch 2 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.

Patch 2 takes the existing std::deque<DWARFUnitSection> for type units
and makes it a simple DWARFUnitSection, simplifying the handling of
type units and making it more consistent with compile units.

Differential Revision: https://reviews.llvm.org/D49742

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Wed Aug  1 13:46:46 2018
@@ -58,7 +58,7 @@ enum class ErrorPolicy { Halt, Continue
 /// information parsing. The actual data is supplied through DWARFObj.
 class DWARFContext : public DIContext {
   DWARFUnitSection CUs;
-  std::deque<DWARFUnitSection> TUs;
+  DWARFUnitSection TUs;
   std::unique_ptr<DWARFUnitIndex> CUIndex;
   std::unique_ptr<DWARFGdbIndex> GdbIndex;
   std::unique_ptr<DWARFUnitIndex> TUIndex;
@@ -76,7 +76,7 @@ class DWARFContext : public DIContext {
   std::unique_ptr<AppleAcceleratorTable> AppleObjC;
 
   DWARFUnitSection DWOCUs;
-  std::deque<DWARFUnitSection> DWOTUs;
+  DWARFUnitSection DWOTUs;
   std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
   std::unique_ptr<DWARFDebugLocDWO> LocDWO;
 
@@ -141,7 +141,6 @@ public:
 
   using cu_iterator_range = DWARFUnitSection::iterator_range;
   using tu_iterator_range = DWARFUnitSection::iterator_range;
-  using tu_section_iterator_range = iterator_range<decltype(TUs)::iterator>;
 
   /// Get compile units in this context.
   cu_iterator_range compile_units() {
@@ -150,9 +149,9 @@ public:
   }
 
   /// Get type units in this context.
-  tu_section_iterator_range type_unit_sections() {
+  tu_iterator_range type_units() {
     parseTypeUnits();
-    return tu_section_iterator_range(TUs.begin(), TUs.end());
+    return tu_iterator_range(TUs.begin(), TUs.end());
   }
 
   /// Get compile units in the DWO context.
@@ -162,9 +161,9 @@ public:
   }
 
   /// Get type units in the DWO context.
-  tu_section_iterator_range dwo_type_unit_sections() {
+  tu_iterator_range dwo_type_units() {
     parseDWOTypeUnits();
-    return tu_section_iterator_range(DWOTUs.begin(), DWOTUs.end());
+    return tu_iterator_range(DWOTUs.begin(), DWOTUs.end());
   }
 
   /// Get the number of compile units in this context.

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h Wed Aug  1 13:46:46 2018
@@ -279,7 +279,7 @@ public:
   class SectionParser {
   public:
     using cu_range = DWARFUnitSection::iterator_range;
-    using tu_range = iterator_range<std::deque<DWARFUnitSection>::iterator>;
+    using tu_range = DWARFUnitSection::iterator_range;
     using LineToUnitMap = std::map<uint64_t, DWARFUnit *>;
 
     SectionParser(DWARFDataExtractor &Data, const DWARFContext &C, cu_range CUs,

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h Wed Aug  1 13:46:46 2018
@@ -106,8 +106,8 @@ const DWARFUnitIndex &getDWARFUnitIndex(
 
 /// Describes one section's Units.
 class DWARFUnitSection final : public SmallVector<std::unique_ptr<DWARFUnit>, 1> {
-  bool Parsed = false;
-  std::function<std::unique_ptr<DWARFUnit>(uint32_t)> Parser;
+  std::function<std::unique_ptr<DWARFUnit>(uint32_t, const DWARFSection *)>
+      Parser;
 
 public:
   using UnitVector = SmallVectorImpl<std::unique_ptr<DWARFUnit>>;
@@ -116,16 +116,18 @@ public:
 
   DWARFUnit *getUnitForOffset(uint32_t Offset) const;
   DWARFUnit *getUnitForIndexEntry(const DWARFUnitIndex::Entry &E);
-  void parse(DWARFContext &C, const DWARFSection &Section,
-             DWARFSectionKind SectionKind);
-  void parseDWO(DWARFContext &C, const DWARFSection &DWOSection,
-                DWARFSectionKind SectionKind, bool Lazy = false);
+  void addUnitsForSection(DWARFContext &C, const DWARFSection &Section,
+                          DWARFSectionKind SectionKind);
+  void addUnitsForDWOSection(DWARFContext &C, const DWARFSection &DWOSection,
+                             DWARFSectionKind SectionKind, bool Lazy = false);
+
 private:
-  void parseImpl(DWARFContext &Context, const DWARFObject &Obj,
-                 const DWARFSection &Section, const DWARFDebugAbbrev *DA,
-                 const DWARFSection *RS, StringRef SS, const DWARFSection &SOS,
-                 const DWARFSection *AOS, const DWARFSection &LS, bool LE,
-                 bool IsDWO, bool Lazy, DWARFSectionKind SectionKind);
+  void addUnitsImpl(DWARFContext &Context, const DWARFObject &Obj,
+                    const DWARFSection &Section, const DWARFDebugAbbrev *DA,
+                    const DWARFSection *RS, StringRef SS,
+                    const DWARFSection &SOS, const DWARFSection *AOS,
+                    const DWARFSection &LS, bool LE, bool IsDWO, bool Lazy,
+                    DWARFSectionKind SectionKind);
 };
 
 /// Represents base address of the CU.

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Wed Aug  1 13:46:46 2018
@@ -100,14 +100,12 @@ using ContributionCollection =
 // sort them by their starting offsets and remove duplicates.
 static ContributionCollection
 collectContributionData(DWARFContext::cu_iterator_range CUs,
-                        DWARFContext::tu_section_iterator_range TUSs) {
+                        DWARFContext::tu_iterator_range TUs) {
   ContributionCollection Contributions;
   for (const auto &CU : CUs)
     Contributions.push_back(CU->getStringOffsetsTableContribution());
-  for (const auto &TUS : TUSs)
-    for (const auto &TU : TUS)
-      Contributions.push_back(TU->getStringOffsetsTableContribution());
-
+  for (const auto &TU : TUs)
+    Contributions.push_back(TU->getStringOffsetsTableContribution());
   // Sort the contributions so that any invalid ones are placed at
   // the start of the contributions vector. This way they are reported
   // first.
@@ -136,9 +134,9 @@ collectContributionData(DWARFContext::cu
 static void dumpDWARFv5StringOffsetsSection(
     raw_ostream &OS, StringRef SectionName, const DWARFObject &Obj,
     const DWARFSection &StringOffsetsSection, StringRef StringSection,
-    DWARFContext::cu_iterator_range CUs,
-    DWARFContext::tu_section_iterator_range TUSs, bool LittleEndian) {
-  auto Contributions = collectContributionData(CUs, TUSs);
+    DWARFContext::cu_iterator_range CUs, DWARFContext::tu_iterator_range TUs,
+    bool LittleEndian) {
+  auto Contributions = collectContributionData(CUs, TUs);
   DWARFDataExtractor StrOffsetExt(Obj, StringOffsetsSection, LittleEndian, 0);
   DataExtractor StrData(StringSection, LittleEndian, 0);
   uint64_t SectionSize = StringOffsetsSection.Data.size();
@@ -215,18 +213,19 @@ static void dumpDWARFv5StringOffsetsSect
 // a header containing size and version number. Alternatively, it may be a
 // monolithic series of string offsets, as generated by the pre-DWARF v5
 // implementation of split DWARF.
-static void dumpStringOffsetsSection(
-    raw_ostream &OS, StringRef SectionName, const DWARFObject &Obj,
-    const DWARFSection &StringOffsetsSection, StringRef StringSection,
-    DWARFContext::cu_iterator_range CUs,
-    DWARFContext::tu_section_iterator_range TUSs, bool LittleEndian,
-    unsigned MaxVersion) {
+static void dumpStringOffsetsSection(raw_ostream &OS, StringRef SectionName,
+                                     const DWARFObject &Obj,
+                                     const DWARFSection &StringOffsetsSection,
+                                     StringRef StringSection,
+                                     DWARFContext::cu_iterator_range CUs,
+                                     DWARFContext::tu_iterator_range TUs,
+                                     bool LittleEndian, unsigned MaxVersion) {
   // If we have at least one (compile or type) unit with DWARF v5 or greater,
   // we assume that the section is formatted like a DWARF v5 string offsets
   // section.
   if (MaxVersion >= 5)
     dumpDWARFv5StringOffsetsSection(OS, SectionName, Obj, StringOffsetsSection,
-                                    StringSection, CUs, TUSs, LittleEndian);
+                                    StringSection, CUs, TUs, LittleEndian);
   else {
     DataExtractor strOffsetExt(StringOffsetsSection.Data, LittleEndian, 0);
     uint32_t offset = 0;
@@ -356,23 +355,21 @@ void DWARFContext::dump(
   dumpDebugInfo(ExplicitDWO, ".debug_info.dwo", DObj->getInfoDWOSection(),
                 dwo_compile_units());
 
-  auto dumpDebugType = [&](const char *Name,
-                           tu_section_iterator_range TUSections) {
+  auto dumpDebugType = [&](const char *Name, tu_iterator_range TUs) {
     OS << '\n' << Name << " contents:\n";
     DumpOffset = DumpOffsets[DIDT_ID_DebugTypes];
-    for (const auto &TUS : TUSections)
-      for (const auto &TU : TUS)
-        if (DumpOffset)
-          TU->getDIEForOffset(*DumpOffset)
-              .dump(OS, 0, DumpOpts.noImplicitRecursion());
-        else
-          TU->dump(OS, DumpOpts);
+    for (const auto &TU : TUs)
+      if (DumpOffset)
+        TU->getDIEForOffset(*DumpOffset)
+            .dump(OS, 0, DumpOpts.noImplicitRecursion());
+      else
+        TU->dump(OS, DumpOpts);
   };
   if ((DumpType & DIDT_DebugTypes)) {
     if (Explicit || getNumTypeUnits())
-      dumpDebugType(".debug_types", type_unit_sections());
+      dumpDebugType(".debug_types", type_units());
     if (ExplicitDWO || getNumDWOTypeUnits())
-      dumpDebugType(".debug_types.dwo", dwo_type_unit_sections());
+      dumpDebugType(".debug_types.dwo", dwo_type_units());
   }
 
   if (shouldDump(Explicit, ".debug_loc", DIDT_ID_DebugLoc,
@@ -430,7 +427,7 @@ void DWARFContext::dump(
     DWARFDataExtractor LineData(*DObj, DObj->getLineSection(), isLittleEndian(),
                                 0);
     DWARFDebugLine::SectionParser Parser(LineData, *this, compile_units(),
-                                         type_unit_sections());
+                                         type_units());
     DumpLineSection(Parser, DumpOpts);
   }
 
@@ -439,7 +436,7 @@ void DWARFContext::dump(
     DWARFDataExtractor LineData(*DObj, DObj->getLineDWOSection(),
                                 isLittleEndian(), 0);
     DWARFDebugLine::SectionParser Parser(LineData, *this, dwo_compile_units(),
-                                         dwo_type_unit_sections());
+                                         dwo_type_units());
     DumpLineSection(Parser, DumpOpts);
   }
 
@@ -547,16 +544,16 @@ void DWARFContext::dump(
 
   if (shouldDump(Explicit, ".debug_str_offsets", DIDT_ID_DebugStrOffsets,
                  DObj->getStringOffsetSection().Data))
-    dumpStringOffsetsSection(
-        OS, "debug_str_offsets", *DObj, DObj->getStringOffsetSection(),
-        DObj->getStringSection(), compile_units(), type_unit_sections(),
-        isLittleEndian(), getMaxVersion());
+    dumpStringOffsetsSection(OS, "debug_str_offsets", *DObj,
+                             DObj->getStringOffsetSection(),
+                             DObj->getStringSection(), compile_units(),
+                             type_units(), isLittleEndian(), getMaxVersion());
   if (shouldDump(ExplicitDWO, ".debug_str_offsets.dwo", DIDT_ID_DebugStrOffsets,
                  DObj->getStringOffsetDWOSection().Data))
     dumpStringOffsetsSection(
         OS, "debug_str_offsets.dwo", *DObj, DObj->getStringOffsetDWOSection(),
-        DObj->getStringDWOSection(), dwo_compile_units(),
-        dwo_type_unit_sections(), isLittleEndian(), getMaxVersion());
+        DObj->getStringDWOSection(), dwo_compile_units(), dwo_type_units(),
+        isLittleEndian(), getMaxVersion());
 
   if (shouldDump(Explicit, ".gnu_index", DIDT_ID_GdbIndex,
                  DObj->getGdbIndexSection())) {
@@ -584,7 +581,9 @@ void DWARFContext::dump(
 }
 
 DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
-  DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), DW_SECT_INFO, true);
+  if (DWOCUs.empty())
+    DWOCUs.addUnitsForDWOSection(*this, DObj->getInfoDWOSection(), DW_SECT_INFO,
+                                 true);
 
   if (const auto &CUI = getCUIndex()) {
     if (const auto *R = CUI.getFromHash(Hash))
@@ -844,28 +843,30 @@ Expected<const DWARFDebugLine::LineTable
 }
 
 void DWARFContext::parseCompileUnits() {
-  CUs.parse(*this, DObj->getInfoSection(), DW_SECT_INFO);
+  if (!CUs.empty())
+    return;
+  CUs.addUnitsForSection(*this, DObj->getInfoSection(), DW_SECT_INFO);
 }
 
 void DWARFContext::parseTypeUnits() {
   if (!TUs.empty())
     return;
   DObj->forEachTypesSections([&](const DWARFSection &S) {
-    TUs.emplace_back();
-    TUs.back().parse(*this, S, DW_SECT_TYPES);
+    TUs.addUnitsForSection(*this, S, DW_SECT_TYPES);
   });
 }
 
 void DWARFContext::parseDWOCompileUnits() {
-  DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), DW_SECT_INFO);
+  if (!DWOCUs.empty())
+    return;
+  DWOCUs.addUnitsForDWOSection(*this, DObj->getInfoDWOSection(), DW_SECT_INFO);
 }
 
 void DWARFContext::parseDWOTypeUnits() {
   if (!DWOTUs.empty())
     return;
   DObj->forEachTypesDWOSections([&](const DWARFSection &S) {
-    DWOTUs.emplace_back();
-    DWOTUs.back().parseDWO(*this, S, DW_SECT_TYPES);
+    DWOTUs.addUnitsForDWOSection(*this, S, DW_SECT_TYPES);
   });
 }
 

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Wed Aug  1 13:46:46 2018
@@ -1047,17 +1047,16 @@ bool DWARFDebugLine::LineTable::getFileL
 // line-table section.
 static DWARFDebugLine::SectionParser::LineToUnitMap
 buildLineToUnitMap(DWARFDebugLine::SectionParser::cu_range CUs,
-                   DWARFDebugLine::SectionParser::tu_range TUSections) {
+                   DWARFDebugLine::SectionParser::tu_range TUs) {
   DWARFDebugLine::SectionParser::LineToUnitMap LineToUnit;
   for (const auto &CU : CUs)
     if (auto CUDIE = CU->getUnitDIE())
       if (auto StmtOffset = toSectionOffset(CUDIE.find(DW_AT_stmt_list)))
         LineToUnit.insert(std::make_pair(*StmtOffset, &*CU));
-  for (const auto &TUS : TUSections)
-    for (const auto &TU : TUS)
-      if (auto TUDIE = TU->getUnitDIE())
-        if (auto StmtOffset = toSectionOffset(TUDIE.find(DW_AT_stmt_list)))
-          LineToUnit.insert(std::make_pair(*StmtOffset, &*TU));
+  for (const auto &TU : TUs)
+    if (auto TUDIE = TU->getUnitDIE())
+      if (auto StmtOffset = toSectionOffset(TUDIE.find(DW_AT_stmt_list)))
+        LineToUnit.insert(std::make_pair(*StmtOffset, &*TU));
   return LineToUnit;
 }
 

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Wed Aug  1 13:46:46 2018
@@ -33,40 +33,43 @@
 using namespace llvm;
 using namespace dwarf;
 
-void DWARFUnitSection::parse(DWARFContext &C, const DWARFSection &Section,
-                             DWARFSectionKind SectionKind) {
+void DWARFUnitSection::addUnitsForSection(DWARFContext &C,
+                                          const DWARFSection &Section,
+                                          DWARFSectionKind SectionKind) {
   const DWARFObject &D = C.getDWARFObj();
-  parseImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangeSection(),
-            D.getStringSection(), D.getStringOffsetSection(),
-            &D.getAddrSection(), D.getLineSection(), D.isLittleEndian(), false,
-            false, SectionKind);
+  addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangeSection(),
+               D.getStringSection(), D.getStringOffsetSection(),
+               &D.getAddrSection(), D.getLineSection(), D.isLittleEndian(),
+               false, false, SectionKind);
 }
 
-void DWARFUnitSection::parseDWO(DWARFContext &C,
-                                const DWARFSection &DWOSection,
-                                DWARFSectionKind SectionKind, bool Lazy) {
+void DWARFUnitSection::addUnitsForDWOSection(DWARFContext &C,
+                                             const DWARFSection &DWOSection,
+                                             DWARFSectionKind SectionKind,
+                                             bool Lazy) {
   const DWARFObject &D = C.getDWARFObj();
-  parseImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangeDWOSection(),
-            D.getStringDWOSection(), D.getStringOffsetDWOSection(),
-            &D.getAddrSection(), D.getLineDWOSection(), C.isLittleEndian(),
-            true, Lazy, SectionKind);
+  addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangeDWOSection(),
+               D.getStringDWOSection(), D.getStringOffsetDWOSection(),
+               &D.getAddrSection(), D.getLineDWOSection(), C.isLittleEndian(),
+               true, Lazy, SectionKind);
 }
 
-void DWARFUnitSection::parseImpl(DWARFContext &Context, const DWARFObject &Obj,
-               const DWARFSection &Section, const DWARFDebugAbbrev *DA,
-               const DWARFSection *RS, StringRef SS, const DWARFSection &SOS,
-               const DWARFSection *AOS, const DWARFSection &LS, bool LE,
-               bool IsDWO, bool Lazy, DWARFSectionKind SectionKind) {
-  if (Parsed)
-    return;
+void DWARFUnitSection::addUnitsImpl(
+    DWARFContext &Context, const DWARFObject &Obj, const DWARFSection &Section,
+    const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
+    const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS,
+    bool LE, bool IsDWO, bool Lazy, DWARFSectionKind SectionKind) {
   DWARFDataExtractor Data(Obj, Section, LE, 0);
   // Lazy initialization of Parser, now that we have all section info.
   if (!Parser) {
     const DWARFUnitIndex *Index = nullptr;
     if (IsDWO)
       Index = &getDWARFUnitIndex(Context, SectionKind);
-    Parser = [=, &Context, &Section, &SOS,
-      &LS](uint32_t Offset) -> std::unique_ptr<DWARFUnit> {
+    Parser = [=, &Context, &Obj, &Section, &SOS, &LS](
+                 uint32_t Offset,
+                 const DWARFSection *CurSection) -> std::unique_ptr<DWARFUnit> {
+      const DWARFSection &InfoSection = CurSection ? *CurSection : Section;
+      DWARFDataExtractor Data(Obj, InfoSection, LE, 0);
       if (!Data.isValidOffset(Offset))
         return nullptr;
       DWARFUnitHeader Header;
@@ -74,13 +77,13 @@ void DWARFUnitSection::parseImpl(DWARFCo
         return nullptr;
       std::unique_ptr<DWARFUnit> U;
       if (Header.isTypeUnit())
-        U = llvm::make_unique<DWARFTypeUnit>(
-          Context, Section, Header, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
-          *this);
+        U = llvm::make_unique<DWARFTypeUnit>(Context, InfoSection, Header, DA,
+                                             RS, SS, SOS, AOS, LS, LE, IsDWO,
+                                             *this);
       else
-        U = llvm::make_unique<DWARFCompileUnit>(
-          Context, Section, Header, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
-          *this);
+        U = llvm::make_unique<DWARFCompileUnit>(Context, InfoSection, Header,
+                                                DA, RS, SS, SOS, AOS, LS, LE,
+                                                IsDWO, *this);
       return U;
     };
   }
@@ -93,13 +96,12 @@ void DWARFUnitSection::parseImpl(DWARFCo
       ++I;
       continue;
     }
-    auto U = Parser(Offset);
+    auto U = Parser(Offset, &Section);
     if (!U)
       break;
     Offset = U->getNextUnitOffset();
     I = std::next(this->insert(I, std::move(U)));
   }
-  Parsed = true;
 }
 
 DWARFUnit *DWARFUnitSection::getUnitForOffset(uint32_t Offset) const {
@@ -132,7 +134,7 @@ DWARFUnitSection::getUnitForIndexEntry(c
   if (!Parser)
     return nullptr;
 
-  auto U = Parser(Offset);
+  auto U = Parser(Offset, nullptr);
   if (!U)
     U = nullptr;
 

Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp?rev=338629&r1=338628&r2=338629&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp Wed Aug  1 13:46:46 2018
@@ -130,7 +130,7 @@ struct CommonFixture {
   std::function<void(Error)> RecordUnrecoverable;
 
   SmallVector<std::unique_ptr<DWARFUnit>, 2> CUs;
-  std::deque<DWARFUnitSection> TUs;
+  SmallVector<std::unique_ptr<DWARFUnit>, 2> TUs;
 };
 
 // Fixtures must derive from "Test", but parameterised fixtures from




More information about the llvm-commits mailing list