[llvm] r338632 - [DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFC

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


Author: probinson
Date: Wed Aug  1 13:49:44 2018
New Revision: 338632

URL: http://llvm.org/viewvc/llvm-project?rev=338632&view=rev
Log:
[DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFC

This is patch 3 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 3 simply renames DWARFUnitSection to DWARFUnitVector, as the
object-file section of a unit is nearly irrelevant now.

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

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h?rev=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h Wed Aug  1 13:49:44 2018
@@ -22,9 +22,9 @@ public:
                    const DWARFDebugAbbrev *DA, const DWARFSection *RS,
                    StringRef SS, const DWARFSection &SOS,
                    const DWARFSection *AOS, const DWARFSection &LS, bool LE,
-                   bool IsDWO, const DWARFUnitSection &UnitSection)
+                   bool IsDWO, const DWARFUnitVector &UnitVector)
       : DWARFUnit(Context, Section, Header, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
-                  UnitSection) {}
+                  UnitVector) {}
 
   /// VTable anchor.
   ~DWARFCompileUnit() override;

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=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Wed Aug  1 13:49:44 2018
@@ -57,8 +57,8 @@ enum class ErrorPolicy { Halt, Continue
 /// This data structure is the top level entity that deals with dwarf debug
 /// information parsing. The actual data is supplied through DWARFObj.
 class DWARFContext : public DIContext {
-  DWARFUnitSection CUs;
-  DWARFUnitSection TUs;
+  DWARFUnitVector CUs;
+  DWARFUnitVector TUs;
   std::unique_ptr<DWARFUnitIndex> CUIndex;
   std::unique_ptr<DWARFGdbIndex> GdbIndex;
   std::unique_ptr<DWARFUnitIndex> TUIndex;
@@ -75,8 +75,8 @@ class DWARFContext : public DIContext {
   std::unique_ptr<AppleAcceleratorTable> AppleNamespaces;
   std::unique_ptr<AppleAcceleratorTable> AppleObjC;
 
-  DWARFUnitSection DWOCUs;
-  DWARFUnitSection DWOTUs;
+  DWARFUnitVector DWOCUs;
+  DWARFUnitVector DWOTUs;
   std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
   std::unique_ptr<DWARFDebugLocDWO> LocDWO;
 
@@ -139,8 +139,8 @@ public:
 
   bool verify(raw_ostream &OS, DIDumpOptions DumpOpts = {}) override;
 
-  using cu_iterator_range = DWARFUnitSection::iterator_range;
-  using tu_iterator_range = DWARFUnitSection::iterator_range;
+  using cu_iterator_range = DWARFUnitVector::iterator_range;
+  using tu_iterator_range = DWARFUnitVector::iterator_range;
 
   /// Get compile units in this context.
   cu_iterator_range compile_units() {

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=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h Wed Aug  1 13:49:44 2018
@@ -278,8 +278,8 @@ public:
   /// Helper to allow for parsing of an entire .debug_line section in sequence.
   class SectionParser {
   public:
-    using cu_range = DWARFUnitSection::iterator_range;
-    using tu_range = DWARFUnitSection::iterator_range;
+    using cu_range = DWARFUnitVector::iterator_range;
+    using tu_range = DWARFUnitVector::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/DWARFTypeUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h?rev=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h Wed Aug  1 13:49:44 2018
@@ -30,9 +30,9 @@ public:
                 const DWARFDebugAbbrev *DA, const DWARFSection *RS,
                 StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
                 const DWARFSection &LS, bool LE, bool IsDWO,
-                const DWARFUnitSection &UnitSection)
+                const DWARFUnitVector &UnitVector)
       : DWARFUnit(Context, Section, Header, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
-                  UnitSection) {}
+                  UnitVector) {}
 
   uint64_t getTypeHash() const { return getHeader().getTypeHash(); }
   uint32_t getTypeOffset() const { return getHeader().getTypeOffset(); }

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=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h Wed Aug  1 13:49:44 2018
@@ -105,7 +105,7 @@ const DWARFUnitIndex &getDWARFUnitIndex(
                                         DWARFSectionKind Kind);
 
 /// Describes one section's Units.
-class DWARFUnitSection final : public SmallVector<std::unique_ptr<DWARFUnit>, 1> {
+class DWARFUnitVector final : public SmallVector<std::unique_ptr<DWARFUnit>, 1> {
   std::function<std::unique_ptr<DWARFUnit>(uint32_t, const DWARFSection *)>
       Parser;
 
@@ -176,7 +176,7 @@ class DWARFUnit {
   uint32_t AddrOffsetSectionBase = 0;
   bool isLittleEndian;
   bool isDWO;
-  const DWARFUnitSection &UnitSection;
+  const DWARFUnitVector &UnitVector;
 
   /// Start, length, and DWARF format of the unit's contribution to the string
   /// offsets table (DWARF v5).
@@ -233,7 +233,7 @@ public:
             const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
             const DWARFSection &SOS, const DWARFSection *AOS,
             const DWARFSection &LS, bool LE, bool IsDWO,
-            const DWARFUnitSection &UnitSection);
+            const DWARFUnitVector &UnitVector);
 
   virtual ~DWARFUnit();
 
@@ -389,8 +389,8 @@ public:
   void getInlinedChainForAddress(uint64_t Address,
                                  SmallVectorImpl<DWARFDie> &InlinedChain);
 
-  /// getUnitSection - Return the DWARFUnitSection containing this unit.
-  const DWARFUnitSection &getUnitSection() const { return UnitSection; }
+  /// Return the DWARFUnitVector containing this unit.
+  const DWARFUnitVector &getUnitVector() const { return UnitVector; }
 
   /// Returns the number of DIEs in the unit. Parses the unit
   /// if necessary.

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Wed Aug  1 13:49:44 2018
@@ -350,7 +350,7 @@ DWARFDie::findRecursively(ArrayRef<dwarf
 DWARFDie
 DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const {
   if (auto SpecRef = toReference(find(Attr))) {
-    if (auto SpecUnit = U->getUnitSection().getUnitForOffset(*SpecRef))
+    if (auto SpecUnit = U->getUnitVector().getUnitForOffset(*SpecRef))
       return SpecUnit->getDIEForOffset(*SpecRef);
   }
   return DWARFDie();

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Wed Aug  1 13:49:44 2018
@@ -33,9 +33,9 @@
 using namespace llvm;
 using namespace dwarf;
 
-void DWARFUnitSection::addUnitsForSection(DWARFContext &C,
-                                          const DWARFSection &Section,
-                                          DWARFSectionKind SectionKind) {
+void DWARFUnitVector::addUnitsForSection(DWARFContext &C,
+                                         const DWARFSection &Section,
+                                         DWARFSectionKind SectionKind) {
   const DWARFObject &D = C.getDWARFObj();
   addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangeSection(),
                D.getStringSection(), D.getStringOffsetSection(),
@@ -43,10 +43,10 @@ void DWARFUnitSection::addUnitsForSectio
                false, false, SectionKind);
 }
 
-void DWARFUnitSection::addUnitsForDWOSection(DWARFContext &C,
-                                             const DWARFSection &DWOSection,
-                                             DWARFSectionKind SectionKind,
-                                             bool Lazy) {
+void DWARFUnitVector::addUnitsForDWOSection(DWARFContext &C,
+                                            const DWARFSection &DWOSection,
+                                            DWARFSectionKind SectionKind,
+                                            bool Lazy) {
   const DWARFObject &D = C.getDWARFObj();
   addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangeDWOSection(),
                D.getStringDWOSection(), D.getStringOffsetDWOSection(),
@@ -54,7 +54,7 @@ void DWARFUnitSection::addUnitsForDWOSec
                true, Lazy, SectionKind);
 }
 
-void DWARFUnitSection::addUnitsImpl(
+void DWARFUnitVector::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,
@@ -104,7 +104,7 @@ void DWARFUnitSection::addUnitsImpl(
   }
 }
 
-DWARFUnit *DWARFUnitSection::getUnitForOffset(uint32_t Offset) const {
+DWARFUnit *DWARFUnitVector::getUnitForOffset(uint32_t Offset) const {
   auto *CU = std::upper_bound(
     this->begin(), this->end(), Offset,
     [](uint32_t LHS, const std::unique_ptr<DWARFUnit> &RHS) {
@@ -116,7 +116,7 @@ DWARFUnit *DWARFUnitSection::getUnitForO
 }
 
 DWARFUnit *
-DWARFUnitSection::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
+DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
   const auto *CUOff = E.getOffset(DW_SECT_INFO);
   if (!CUOff)
     return nullptr;
@@ -148,11 +148,11 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, c
                      const DWARFDebugAbbrev *DA, const DWARFSection *RS,
                      StringRef SS, const DWARFSection &SOS,
                      const DWARFSection *AOS, const DWARFSection &LS, bool LE,
-                     bool IsDWO, const DWARFUnitSection &UnitSection)
+                     bool IsDWO, const DWARFUnitVector &UnitVector)
     : Context(DC), InfoSection(Section), Header(Header), Abbrev(DA),
       RangeSection(RS), LineSection(LS), StringSection(SS),
       StringOffsetSection(SOS),  AddrOffsetSection(AOS), isLittleEndian(LE),
-      isDWO(IsDWO), UnitSection(UnitSection) {
+      isDWO(IsDWO), UnitVector(UnitVector) {
   clear();
 }
 

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=338632&r1=338631&r2=338632&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Wed Aug  1 13:49:44 2018
@@ -264,7 +264,7 @@ bool DWARFVerifier::handleDebugInfo() {
   bool isUnitDWARF64 = false;
   bool isHeaderChainValid = true;
   bool hasDIE = DebugInfoData.isValidOffset(Offset);
-  DWARFUnitSection UnitSection{};
+  DWARFUnitVector UnitVector{};
   while (hasDIE) {
     OffsetStart = Offset;
     if (!verifyUnitHeader(DebugInfoData, &Offset, UnitIdx, UnitType,
@@ -283,7 +283,7 @@ bool DWARFVerifier::handleDebugInfo() {
             DCtx, DObj.getInfoSection(), Header, DCtx.getDebugAbbrev(),
             &DObj.getRangeSection(), DObj.getStringSection(),
             DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
-            DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitSection));
+            DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitVector));
         break;
       }
       case dwarf::DW_UT_skeleton:
@@ -297,7 +297,7 @@ bool DWARFVerifier::handleDebugInfo() {
             DCtx, DObj.getInfoSection(), Header, DCtx.getDebugAbbrev(),
             &DObj.getRangeSection(), DObj.getStringSection(),
             DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
-            DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitSection));
+            DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitVector));
         break;
       }
       default: { llvm_unreachable("Invalid UnitType."); }




More information about the llvm-commits mailing list