Introduce the DWARFUnitSection abstraction.

A DWARFUnitSection is the collection of Units that have been extracted from
the same debug section.

By embeding a reference to their DWARFUnitSection in each unit, the DIEs
will be able to resolve inter-unit references by interrogating their Unit's
DWARFUnitSection.

This is a minimal patch where the DWARFUnitSection is-a SmallVector of Units,
thus exposing exactly the same interface as before. Followup-up patches might
change from inheritance to composition in order to expose only the wanted
DWARFUnitSection abstraction.

    Differential Revision: http://reviews.llvm.org/D5310

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Frederic Riss
2014-09-15 07:50:27 +00:00
parent b1287f54cf
commit ea3ce67d71
6 changed files with 69 additions and 44 deletions

View File

@@ -28,19 +28,17 @@ namespace llvm {
/// information parsing. The actual data is supplied through pure virtual
/// methods that a concrete implementation provides.
class DWARFContext : public DIContext {
typedef SmallVector<std::unique_ptr<DWARFCompileUnit>, 1> CUVector;
typedef SmallVector<std::unique_ptr<DWARFTypeUnit>, 1> TUVector;
CUVector CUs;
TUVector TUs;
DWARFUnitSection<DWARFCompileUnit> CUs;
DWARFUnitSection<DWARFTypeUnit> TUs;
std::unique_ptr<DWARFDebugAbbrev> Abbrev;
std::unique_ptr<DWARFDebugLoc> Loc;
std::unique_ptr<DWARFDebugAranges> Aranges;
std::unique_ptr<DWARFDebugLine> Line;
std::unique_ptr<DWARFDebugFrame> DebugFrame;
CUVector DWOCUs;
TUVector DWOTUs;
DWARFUnitSection<DWARFCompileUnit> DWOCUs;
DWARFUnitSection<DWARFTypeUnit> DWOTUs;
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
@@ -77,8 +75,8 @@ public:
void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override;
typedef iterator_range<CUVector::iterator> cu_iterator_range;
typedef iterator_range<TUVector::iterator> tu_iterator_range;
typedef DWARFUnitSection<DWARFCompileUnit>::iterator_range cu_iterator_range;
typedef DWARFUnitSection<DWARFTypeUnit>::iterator_range tu_iterator_range;
/// Get compile units in this context.
cu_iterator_range compile_units() {