DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
DwarfCompileUnit *NewCU = new DwarfCompileUnit(
- CU->getUniqueID(), Die, CU->getNode(), Asm, this, &SkeletonHolder);
+ CU->getUniqueID(), Die, CU->getCUNode(), Asm, this, &SkeletonHolder);
NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
DwarfInfoSectionSym);
NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name,
- CU->getNode().getSplitDebugFilename());
+ CU->getCUNode().getSplitDebugFilename());
// Relocate to the beginning of the addr_base section, else 0 for the
// beginning of the one for this compile unit.
OffSec, StrSym);
}
-void DwarfDebug::addDwarfTypeUnitType(uint16_t Language, StringRef Identifier,
- DIE *RefDie, DICompositeType CTy) {
+void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
+ StringRef Identifier, DIE *RefDie,
+ DICompositeType CTy) {
const DwarfTypeUnit *&TU = DwarfTypeUnits[CTy];
if (!TU) {
DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit);
DwarfTypeUnit *NewTU =
- new DwarfTypeUnit(InfoHolder.getUnits().size(), UnitDie, Language, Asm,
+ new DwarfTypeUnit(InfoHolder.getUnits().size(), UnitDie, CUNode, Asm,
this, &InfoHolder);
TU = NewTU;
InfoHolder.addUnit(NewTU);
NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
- Language);
+ CUNode.getLanguage());
DIE *Die = NewTU->createTypeDIE(CTy);
/// \brief Add a DIE to the set of types that we're going to pull into
/// type units.
- void addDwarfTypeUnitType(uint16_t Language, StringRef Identifier, DIE *Die,
- DICompositeType CTy);
+ void addDwarfTypeUnitType(DICompileUnit CUNode, StringRef Identifier,
+ DIE *Die, DICompositeType CTy);
/// \brief Add a label so that arange data can be generated for it.
void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
/// Unit - Unit constructor.
DwarfUnit::DwarfUnit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU)
- : UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW),
- DU(DWU), IndexTyDie(0), Section(0), Skeleton(0) {
+ : UniqueID(UID), CUNode(Node), UnitDie(D), DebugInfoOffset(0), Asm(A),
+ DD(DW), DU(DWU), IndexTyDie(0), Section(0), Skeleton(0) {
DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
}
insertDIE(Node, D);
}
-DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, uint16_t Language,
+DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode,
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
- : DwarfUnit(UID, D, DICompileUnit(), A, DW, DWU), Language(Language) {}
+ : DwarfUnit(UID, D, CUNode, A, DW, DWU) {}
/// ~Unit - Destructor for compile unit.
DwarfUnit::~DwarfUnit() {
DICompositeType CTy(Ty);
if (GenerateDwarfTypeUnits && !Ty.isForwardDecl())
if (MDString *TypeId = CTy.getIdentifier()) {
- DD->addDwarfTypeUnitType(getLanguage(), TypeId->getString(), TyDIE,
- CTy);
+ DD->addDwarfTypeUnitType(getCUNode(), TypeId->getString(), TyDIE, CTy);
// Skip updating the accellerator tables since this is not the full type
return TyDIE;
}
unsigned UniqueID;
/// Node - MDNode for the compile unit.
- DICompileUnit Node;
+ DICompileUnit CUNode;
/// Unit debug information entry.
const OwningPtr<DIE> UnitDie;
// Accessors.
unsigned getUniqueID() const { return UniqueID; }
- virtual uint16_t getLanguage() const = 0;
- DICompileUnit getNode() const { return Node; }
+ uint16_t getLanguage() const { return CUNode.getLanguage(); }
+ DICompileUnit getCUNode() const { return CUNode; }
DIE *getUnitDie() const { return UnitDie.get(); }
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
/// addLabelAddress - Add a dwarf label attribute data and value using
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
-
- uint16_t getLanguage() const LLVM_OVERRIDE { return getNode().getLanguage(); }
};
class DwarfTypeUnit : public DwarfUnit {
private:
- uint16_t Language;
uint64_t TypeSignature;
const DIE *Ty;
public:
- DwarfTypeUnit(unsigned UID, DIE *D, uint16_t Language, AsmPrinter *A,
+ DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
virtual ~DwarfTypeUnit() LLVM_OVERRIDE;
uint64_t getTypeSignature() const { return TypeSignature; }
void setType(const DIE *Ty) { this->Ty = Ty; }
- uint16_t getLanguage() const LLVM_OVERRIDE { return Language; }
/// Emit the header for this unit, not including the initial length field.
void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym) const
LLVM_OVERRIDE;