[llvm] r219261 - [DebugInfo] Pass DWARFSection down to DWARFUnit constructor (NFC).

Alexey Samsonov vonosmas at gmail.com
Tue Oct 7 17:24:41 PDT 2014


Author: samsonov
Date: Tue Oct  7 19:24:41 2014
New Revision: 219261

URL: http://llvm.org/viewvc/llvm-project?rev=219261&view=rev
Log:
[DebugInfo] Pass DWARFSection down to DWARFUnit constructor (NFC).

Keep the actual section contents and the relocation map together.

Modified:
    llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h
    llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h
    llvm/trunk/lib/DebugInfo/DWARFUnit.cpp
    llvm/trunk/lib/DebugInfo/DWARFUnit.h

Modified: llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h?rev=219261&r1=219260&r2=219261&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h Tue Oct  7 19:24:41 2014
@@ -16,11 +16,11 @@ namespace llvm {
 
 class DWARFCompileUnit : public DWARFUnit {
 public:
-  DWARFCompileUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA,
-                   StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
-                   StringRef AOS, const RelocAddrMap *M, bool LE,
+  DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
+                   const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
+                   StringRef SOS, StringRef AOS, bool LE,
                    const DWARFUnitSectionBase &UnitSection)
-    : DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE, UnitSection) {}
+      : DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {}
   void dump(raw_ostream &OS);
   // VTable anchor.
   ~DWARFCompileUnit() override;

Modified: llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h?rev=219261&r1=219260&r2=219261&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h Tue Oct  7 19:24:41 2014
@@ -19,11 +19,11 @@ private:
   uint64_t TypeHash;
   uint32_t TypeOffset;
 public:
-  DWARFTypeUnit(DWARFContext &Context, const DWARFDebugAbbrev *DA,
-                StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
-                StringRef AOS, const RelocAddrMap *M, bool LE,
+  DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
+                const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
+                StringRef SOS, StringRef AOS, bool LE,
                 const DWARFUnitSectionBase &UnitSection)
-    : DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE, UnitSection) {}
+      : DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {}
   uint32_t getHeaderSize() const override {
     return DWARFUnit::getHeaderSize() + 12;
   }

Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.cpp?rev=219261&r1=219260&r2=219261&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFUnit.cpp Tue Oct  7 19:24:41 2014
@@ -30,13 +30,13 @@ void DWARFUnitSectionBase::parseDWO(DWAR
             C.getAddrSection(), C.isLittleEndian());
 }
 
-DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
-                     StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
-                     StringRef AOS, const RelocAddrMap *M, bool LE,
-                     const DWARFUnitSectionBase& UnitSection)
-  : Context(DC), Abbrev(DA), InfoSection(IS), RangeSection(RS),
-    StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),
-    RelocMap(M), isLittleEndian(LE), UnitSection(UnitSection)  {
+DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
+                     const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
+                     StringRef SOS, StringRef AOS, bool LE,
+                     const DWARFUnitSectionBase &UnitSection)
+    : Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS),
+      StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),
+      isLittleEndian(LE), UnitSection(UnitSection) {
   clear();
 }
 

Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.h?rev=219261&r1=219260&r2=219261&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFUnit.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFUnit.h Tue Oct  7 19:24:41 2014
@@ -88,9 +88,8 @@ private:
     DataExtractor Data(Section.Data, LE, 0);
     uint32_t Offset = 0;
     while (Data.isValidOffset(Offset)) {
-      auto U =
-          llvm::make_unique<UnitType>(Context, DA, Section.Data, RS, SS, SOS,
-                                      AOS, &Section.Relocs, LE, *this);
+      auto U = llvm::make_unique<UnitType>(Context, Section, DA, RS, SS, SOS,
+                                           AOS, LE, *this);
       if (!U->extract(Data, &Offset))
         break;
       this->push_back(std::move(U));
@@ -102,16 +101,16 @@ private:
 
 class DWARFUnit {
   DWARFContext &Context;
+  // Section containing this DWARFUnit.
+  const DWARFSection &InfoSection;
 
   const DWARFDebugAbbrev *Abbrev;
-  StringRef InfoSection;
   StringRef RangeSection;
   uint32_t RangeSectionBase;
   StringRef StringSection;
   StringRef StringOffsetSection;
   StringRef AddrOffsetSection;
   uint32_t AddrOffsetSectionBase;
-  const RelocAddrMap *RelocMap;
   bool isLittleEndian;
   const DWARFUnitSectionBase &UnitSection;
 
@@ -140,9 +139,10 @@ protected:
   virtual uint32_t getHeaderSize() const { return 11; }
 
 public:
-  DWARFUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA, StringRef IS,
-            StringRef RS, StringRef SS, StringRef SOS, StringRef AOS,
-            const RelocAddrMap *M, bool LE, const DWARFUnitSectionBase &UnitSection);
+  DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
+            const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
+            StringRef SOS, StringRef AOS, bool LE,
+            const DWARFUnitSectionBase &UnitSection);
 
   virtual ~DWARFUnit();
 
@@ -164,13 +164,13 @@ public:
   bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
 
   DataExtractor getDebugInfoExtractor() const {
-    return DataExtractor(InfoSection, isLittleEndian, AddrSize);
+    return DataExtractor(InfoSection.Data, isLittleEndian, AddrSize);
   }
   DataExtractor getStringExtractor() const {
     return DataExtractor(StringSection, false, 0);
   }
 
-  const RelocAddrMap *getRelocMap() const { return RelocMap; }
+  const RelocAddrMap *getRelocMap() const { return &InfoSection.Relocs; }
 
   bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
 





More information about the llvm-commits mailing list