[DebugInfo] Turn DWARFContext::Section into DWARFSection (NFC).

It would be more convenient to pass DWARFSection into DWARFUnitSection
constructor, instead of passing its components (Data and RelocAddrMap)
as a separate arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-10-07 23:45:11 +00:00
parent 502b4d1e96
commit 99ff4a2dba
2 changed files with 45 additions and 25 deletions

View File

@@ -16,6 +16,7 @@
#include "DWARFDebugLine.h" #include "DWARFDebugLine.h"
#include "DWARFDebugLoc.h" #include "DWARFDebugLoc.h"
#include "DWARFDebugRangeList.h" #include "DWARFDebugRangeList.h"
#include "DWARFSection.h"
#include "DWARFTypeUnit.h" #include "DWARFTypeUnit.h"
#include "llvm/ADT/MapVector.h" #include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@@ -63,11 +64,6 @@ class DWARFContext : public DIContext {
void parseDWOTypeUnits(); void parseDWOTypeUnits();
public: public:
struct Section {
StringRef Data;
RelocAddrMap Relocs;
};
DWARFContext() : DIContext(CK_DWARF) {} DWARFContext() : DIContext(CK_DWARF) {}
static bool classof(const DIContext *DICtx) { static bool classof(const DIContext *DICtx) {
@@ -170,17 +166,15 @@ public:
virtual bool isLittleEndian() const = 0; virtual bool isLittleEndian() const = 0;
virtual uint8_t getAddressSize() const = 0; virtual uint8_t getAddressSize() const = 0;
virtual const Section &getInfoSection() = 0; virtual const DWARFSection &getInfoSection() = 0;
typedef MapVector<object::SectionRef, Section, typedef MapVector<object::SectionRef, DWARFSection,
std::map<object::SectionRef, unsigned> > TypeSectionMap; std::map<object::SectionRef, unsigned>> TypeSectionMap;
virtual const TypeSectionMap &getTypesSections() = 0; virtual const TypeSectionMap &getTypesSections() = 0;
virtual StringRef getAbbrevSection() = 0; virtual StringRef getAbbrevSection() = 0;
virtual const Section &getLocSection() = 0; virtual const DWARFSection &getLocSection() = 0;
virtual const Section &getLocDWOSection() = 0;
virtual StringRef getARangeSection() = 0; virtual StringRef getARangeSection() = 0;
virtual StringRef getDebugFrameSection() = 0; virtual StringRef getDebugFrameSection() = 0;
virtual const Section &getLineSection() = 0; virtual const DWARFSection &getLineSection() = 0;
virtual const Section &getLineDWOSection() = 0;
virtual StringRef getStringSection() = 0; virtual StringRef getStringSection() = 0;
virtual StringRef getRangeSection() = 0; virtual StringRef getRangeSection() = 0;
virtual StringRef getPubNamesSection() = 0; virtual StringRef getPubNamesSection() = 0;
@@ -189,9 +183,11 @@ public:
virtual StringRef getGnuPubTypesSection() = 0; virtual StringRef getGnuPubTypesSection() = 0;
// Sections for DWARF5 split dwarf proposal. // Sections for DWARF5 split dwarf proposal.
virtual const Section &getInfoDWOSection() = 0; virtual const DWARFSection &getInfoDWOSection() = 0;
virtual const TypeSectionMap &getTypesDWOSections() = 0; virtual const TypeSectionMap &getTypesDWOSections() = 0;
virtual StringRef getAbbrevDWOSection() = 0; virtual StringRef getAbbrevDWOSection() = 0;
virtual const DWARFSection &getLineDWOSection() = 0;
virtual const DWARFSection &getLocDWOSection() = 0;
virtual StringRef getStringDWOSection() = 0; virtual StringRef getStringDWOSection() = 0;
virtual StringRef getStringOffsetDWOSection() = 0; virtual StringRef getStringOffsetDWOSection() = 0;
virtual StringRef getRangeDWOSection() = 0; virtual StringRef getRangeDWOSection() = 0;
@@ -216,15 +212,13 @@ class DWARFContextInMemory : public DWARFContext {
virtual void anchor(); virtual void anchor();
bool IsLittleEndian; bool IsLittleEndian;
uint8_t AddressSize; uint8_t AddressSize;
Section InfoSection; DWARFSection InfoSection;
TypeSectionMap TypesSections; TypeSectionMap TypesSections;
StringRef AbbrevSection; StringRef AbbrevSection;
Section LocSection; DWARFSection LocSection;
Section LocDWOSection;
StringRef ARangeSection; StringRef ARangeSection;
StringRef DebugFrameSection; StringRef DebugFrameSection;
Section LineSection; DWARFSection LineSection;
Section LineDWOSection;
StringRef StringSection; StringRef StringSection;
StringRef RangeSection; StringRef RangeSection;
StringRef PubNamesSection; StringRef PubNamesSection;
@@ -233,9 +227,11 @@ class DWARFContextInMemory : public DWARFContext {
StringRef GnuPubTypesSection; StringRef GnuPubTypesSection;
// Sections for DWARF5 split dwarf proposal. // Sections for DWARF5 split dwarf proposal.
Section InfoDWOSection; DWARFSection InfoDWOSection;
TypeSectionMap TypesDWOSections; TypeSectionMap TypesDWOSections;
StringRef AbbrevDWOSection; StringRef AbbrevDWOSection;
DWARFSection LineDWOSection;
DWARFSection LocDWOSection;
StringRef StringDWOSection; StringRef StringDWOSection;
StringRef StringOffsetDWOSection; StringRef StringOffsetDWOSection;
StringRef RangeDWOSection; StringRef RangeDWOSection;
@@ -247,15 +243,13 @@ public:
DWARFContextInMemory(object::ObjectFile &); DWARFContextInMemory(object::ObjectFile &);
bool isLittleEndian() const override { return IsLittleEndian; } bool isLittleEndian() const override { return IsLittleEndian; }
uint8_t getAddressSize() const override { return AddressSize; } uint8_t getAddressSize() const override { return AddressSize; }
const Section &getInfoSection() override { return InfoSection; } const DWARFSection &getInfoSection() override { return InfoSection; }
const TypeSectionMap &getTypesSections() override { return TypesSections; } const TypeSectionMap &getTypesSections() override { return TypesSections; }
StringRef getAbbrevSection() override { return AbbrevSection; } StringRef getAbbrevSection() override { return AbbrevSection; }
const Section &getLocSection() override { return LocSection; } const DWARFSection &getLocSection() override { return LocSection; }
const Section &getLocDWOSection() override { return LocDWOSection; }
StringRef getARangeSection() override { return ARangeSection; } StringRef getARangeSection() override { return ARangeSection; }
StringRef getDebugFrameSection() override { return DebugFrameSection; } StringRef getDebugFrameSection() override { return DebugFrameSection; }
const Section &getLineSection() override { return LineSection; } const DWARFSection &getLineSection() override { return LineSection; }
const Section &getLineDWOSection() override { return LineDWOSection; }
StringRef getStringSection() override { return StringSection; } StringRef getStringSection() override { return StringSection; }
StringRef getRangeSection() override { return RangeSection; } StringRef getRangeSection() override { return RangeSection; }
StringRef getPubNamesSection() override { return PubNamesSection; } StringRef getPubNamesSection() override { return PubNamesSection; }
@@ -264,11 +258,13 @@ public:
StringRef getGnuPubTypesSection() override { return GnuPubTypesSection; } StringRef getGnuPubTypesSection() override { return GnuPubTypesSection; }
// Sections for DWARF5 split dwarf proposal. // Sections for DWARF5 split dwarf proposal.
const Section &getInfoDWOSection() override { return InfoDWOSection; } const DWARFSection &getInfoDWOSection() override { return InfoDWOSection; }
const TypeSectionMap &getTypesDWOSections() override { const TypeSectionMap &getTypesDWOSections() override {
return TypesDWOSections; return TypesDWOSections;
} }
StringRef getAbbrevDWOSection() override { return AbbrevDWOSection; } StringRef getAbbrevDWOSection() override { return AbbrevDWOSection; }
const DWARFSection &getLineDWOSection() override { return LineDWOSection; }
const DWARFSection &getLocDWOSection() override { return LocDWOSection; }
StringRef getStringDWOSection() override { return StringDWOSection; } StringRef getStringDWOSection() override { return StringDWOSection; }
StringRef getStringOffsetDWOSection() override { StringRef getStringOffsetDWOSection() override {
return StringOffsetDWOSection; return StringOffsetDWOSection;

View File

@@ -0,0 +1,24 @@
//===-- DWARFSection.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_DEBUGINFO_DWARFSECTION_H
#define LLVM_LIB_DEBUGINFO_DWARFSECTION_H
#include "DWARFRelocMap.h"
namespace llvm {
struct DWARFSection {
StringRef Data;
RelocAddrMap Relocs;
};
}
#endif