DebugInfo: Rename generic unit references to "TheU" instead of TheCU now that they might be type units instead of compile units.

CR feedback from Eric Christopher on r196139.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-12-02 22:09:48 +00:00
parent 7d318bd116
commit 451fa97c8c
3 changed files with 65 additions and 65 deletions

View File

@ -341,26 +341,26 @@ static bool SectionSort(const MCSection *A, const MCSection *B) {
// TODO: Determine whether or not we should add names for programs // TODO: Determine whether or not we should add names for programs
// that do not have a DW_AT_name or DW_AT_linkage_name field - this // that do not have a DW_AT_name or DW_AT_linkage_name field - this
// is only slightly different than the lookup of non-standard ObjC names. // is only slightly different than the lookup of non-standard ObjC names.
static void addSubprogramNames(Unit *TheCU, DISubprogram SP, DIE *Die) { static void addSubprogramNames(Unit *TheU, DISubprogram SP, DIE *Die) {
if (!SP.isDefinition()) if (!SP.isDefinition())
return; return;
TheCU->addAccelName(SP.getName(), Die); TheU->addAccelName(SP.getName(), Die);
// If the linkage name is different than the name, go ahead and output // If the linkage name is different than the name, go ahead and output
// that as well into the name table. // that as well into the name table.
if (SP.getLinkageName() != "" && SP.getName() != SP.getLinkageName()) if (SP.getLinkageName() != "" && SP.getName() != SP.getLinkageName())
TheCU->addAccelName(SP.getLinkageName(), Die); TheU->addAccelName(SP.getLinkageName(), Die);
// If this is an Objective-C selector name add it to the ObjC accelerator // If this is an Objective-C selector name add it to the ObjC accelerator
// too. // too.
if (isObjCClass(SP.getName())) { if (isObjCClass(SP.getName())) {
StringRef Class, Category; StringRef Class, Category;
getObjCClassCategory(SP.getName(), Class, Category); getObjCClassCategory(SP.getName(), Class, Category);
TheCU->addAccelObjC(Class, Die); TheU->addAccelObjC(Class, Die);
if (Category != "") if (Category != "")
TheCU->addAccelObjC(Category, Die); TheU->addAccelObjC(Category, Die);
// Also add the base method name to the name table. // Also add the base method name to the name table.
TheCU->addAccelName(getObjCMethodName(SP.getName()), Die); TheU->addAccelName(getObjCMethodName(SP.getName()), Die);
} }
} }
@ -390,7 +390,8 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, DISubprogram SP) {
// concrete DIE twice. // concrete DIE twice.
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) { if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
// Pick up abstract subprogram DIE. // Pick up abstract subprogram DIE.
SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getCUDie()); SPDie =
SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getUnitDie());
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
} else { } else {
DISubprogram SPDecl = SP.getFunctionDeclaration(); DISubprogram SPDecl = SP.getFunctionDeclaration();
@ -421,8 +422,8 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, DISubprogram SP) {
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg);
} }
DIE *SPDeclDie = SPDie; DIE *SPDeclDie = SPDie;
SPDie = SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram,
SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getCUDie()); *SPCU->getUnitDie());
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie);
} }
} }
@ -1066,28 +1067,27 @@ void DwarfDebug::finalizeModuleInfo() {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
// Emit DW_AT_containing_type attribute to connect types with their // Emit DW_AT_containing_type attribute to connect types with their
// vtable holding type. // vtable holding type.
TheCU->constructContainingTypeDIEs(); TheU->constructContainingTypeDIEs();
// If we're splitting the dwarf out now that we've got the entire // If we're splitting the dwarf out now that we've got the entire
// CU then construct a skeleton CU based upon it. // CU then construct a skeleton CU based upon it.
if (useSplitDwarf() && if (useSplitDwarf() &&
TheCU->getCUDie()->getTag() == dwarf::DW_TAG_compile_unit) { TheU->getUnitDie()->getTag() == dwarf::DW_TAG_compile_unit) {
uint64_t ID = 0; uint64_t ID = 0;
if (GenerateCUHash) { if (GenerateCUHash) {
DIEHash CUHash; DIEHash CUHash;
ID = CUHash.computeCUSignature(*TheCU->getCUDie()); ID = CUHash.computeCUSignature(*TheU->getUnitDie());
} }
// This should be a unique identifier when we want to build .dwp files. // This should be a unique identifier when we want to build .dwp files.
TheCU->addUInt(TheCU->getCUDie(), dwarf::DW_AT_GNU_dwo_id, TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID); dwarf::DW_FORM_data8, ID);
// Now construct the skeleton CU associated. // Now construct the skeleton CU associated.
CompileUnit *SkCU = CompileUnit *SkCU = constructSkeletonCU(static_cast<CompileUnit *>(TheU));
constructSkeletonCU(static_cast<CompileUnit *>(TheCU));
// This should be a unique identifier when we want to build .dwp files. // This should be a unique identifier when we want to build .dwp files.
SkCU->addUInt(SkCU->getCUDie(), dwarf::DW_AT_GNU_dwo_id, SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID); dwarf::DW_FORM_data8, ID);
} }
} }
@ -1965,7 +1965,7 @@ void DwarfUnits::computeSizeAndOffsets() {
// EndOffset here is CU-relative, after laying out // EndOffset here is CU-relative, after laying out
// all of the CU DIE. // all of the CU DIE.
unsigned EndOffset = computeSizeAndOffset((*I)->getCUDie(), Offset); unsigned EndOffset = computeSizeAndOffset((*I)->getUnitDie(), Offset);
SecOffset += EndOffset; SecOffset += EndOffset;
} }
} }
@ -2134,22 +2134,22 @@ void DwarfUnits::emitUnits(DwarfDebug *DD, const MCSection *USection,
Asm->OutStreamer.SwitchSection(USection); Asm->OutStreamer.SwitchSection(USection);
for (SmallVectorImpl<Unit *>::iterator I = CUs.begin(), E = CUs.end(); I != E; for (SmallVectorImpl<Unit *>::iterator I = CUs.begin(), E = CUs.end(); I != E;
++I) { ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
DIE *Die = TheCU->getCUDie(); DIE *Die = TheU->getUnitDie();
// Emit the compile units header. // Emit the compile units header.
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(USection->getLabelBeginName(), Asm->OutStreamer.EmitLabel(
TheCU->getUniqueID())); Asm->GetTempSymbol(USection->getLabelBeginName(), TheU->getUniqueID()));
// Emit size of content not including length itself // Emit size of content not including length itself
Asm->OutStreamer.AddComment("Length of Unit"); Asm->OutStreamer.AddComment("Length of Unit");
Asm->EmitInt32(TheCU->getHeaderSize() + Die->getSize()); Asm->EmitInt32(TheU->getHeaderSize() + Die->getSize());
TheCU->emitHeader(ASection, ASectionSym); TheU->emitHeader(ASection, ASectionSym);
DD->emitDIE(Die, Abbreviations); DD->emitDIE(Die, Abbreviations);
Asm->OutStreamer.EmitLabel( Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol(USection->getLabelEndName(), TheCU->getUniqueID())); Asm->GetTempSymbol(USection->getLabelEndName(), TheU->getUniqueID()));
} }
} }
@ -2232,8 +2232,8 @@ void DwarfDebug::emitAccelNames() {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelNames(); const StringMap<std::vector<const DIE *> > &Names = TheU->getAccelNames();
for (StringMap<std::vector<const DIE *> >::const_iterator for (StringMap<std::vector<const DIE *> >::const_iterator
GI = Names.begin(), GI = Names.begin(),
GE = Names.end(); GE = Names.end();
@ -2265,8 +2265,8 @@ void DwarfDebug::emitAccelObjC() {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelObjC(); const StringMap<std::vector<const DIE *> > &Names = TheU->getAccelObjC();
for (StringMap<std::vector<const DIE *> >::const_iterator for (StringMap<std::vector<const DIE *> >::const_iterator
GI = Names.begin(), GI = Names.begin(),
GE = Names.end(); GE = Names.end();
@ -2297,9 +2297,9 @@ void DwarfDebug::emitAccelNamespaces() {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
const StringMap<std::vector<const DIE *> > &Names = const StringMap<std::vector<const DIE *> > &Names =
TheCU->getAccelNamespace(); TheU->getAccelNamespace();
for (StringMap<std::vector<const DIE *> >::const_iterator for (StringMap<std::vector<const DIE *> >::const_iterator
GI = Names.begin(), GI = Names.begin(),
GE = Names.end(); GE = Names.end();
@ -2336,9 +2336,9 @@ void DwarfDebug::emitAccelTypes() {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names = const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names =
TheCU->getAccelTypes(); TheU->getAccelTypes();
for (StringMap< for (StringMap<
std::vector<std::pair<const DIE *, unsigned> > >::const_iterator std::vector<std::pair<const DIE *, unsigned> > >::const_iterator
GI = Names.begin(), GI = Names.begin(),
@ -2433,8 +2433,8 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
unsigned ID = TheCU->getUniqueID(); unsigned ID = TheU->getUniqueID();
// Start the dwarf pubnames section. // Start the dwarf pubnames section.
Asm->OutStreamer.SwitchSection(PSec); Asm->OutStreamer.SwitchSection(PSec);
@ -2442,7 +2442,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
// Emit a label so we can reference the beginning of this pubname section. // Emit a label so we can reference the beginning of this pubname section.
if (GnuStyle) if (GnuStyle)
Asm->OutStreamer.EmitLabel( Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol("gnu_pubnames", TheCU->getUniqueID())); Asm->GetTempSymbol("gnu_pubnames", TheU->getUniqueID()));
// Emit the header. // Emit the header.
Asm->OutStreamer.AddComment("Length of Public Names Info"); Asm->OutStreamer.AddComment("Length of Public Names Info");
@ -2464,7 +2464,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
4); 4);
// Emit the pubnames for this compilation unit. // Emit the pubnames for this compilation unit.
const StringMap<const DIE *> &Globals = TheCU->getGlobalNames(); const StringMap<const DIE *> &Globals = TheU->getGlobalNames();
for (StringMap<const DIE *>::const_iterator GI = Globals.begin(), for (StringMap<const DIE *>::const_iterator GI = Globals.begin(),
GE = Globals.end(); GE = Globals.end();
GI != GE; ++GI) { GI != GE; ++GI) {
@ -2475,7 +2475,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
Asm->EmitInt32(Entity->getOffset()); Asm->EmitInt32(Entity->getOffset());
if (GnuStyle) { if (GnuStyle) {
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity); dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
Asm->OutStreamer.AddComment( Asm->OutStreamer.AddComment(
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " + Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
dwarf::GDBIndexEntryLinkageString(Desc.Linkage)); dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
@ -2502,23 +2502,23 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(), for (SmallVectorImpl<Unit *>::const_iterator I = getUnits().begin(),
E = getUnits().end(); E = getUnits().end();
I != E; ++I) { I != E; ++I) {
Unit *TheCU = *I; Unit *TheU = *I;
// Start the dwarf pubtypes section. // Start the dwarf pubtypes section.
Asm->OutStreamer.SwitchSection(PSec); Asm->OutStreamer.SwitchSection(PSec);
// Emit a label so we can reference the beginning of this pubtype section. // Emit a label so we can reference the beginning of this pubtype section.
if (GnuStyle) if (GnuStyle)
Asm->OutStreamer.EmitLabel( Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol("gnu_pubtypes", TheCU->getUniqueID())); Asm->GetTempSymbol("gnu_pubtypes", TheU->getUniqueID()));
// Emit the header. // Emit the header.
Asm->OutStreamer.AddComment("Length of Public Types Info"); Asm->OutStreamer.AddComment("Length of Public Types Info");
Asm->EmitLabelDifference( Asm->EmitLabelDifference(
Asm->GetTempSymbol("pubtypes_end", TheCU->getUniqueID()), Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID()),
Asm->GetTempSymbol("pubtypes_begin", TheCU->getUniqueID()), 4); Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID()), 4);
Asm->OutStreamer.EmitLabel( Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol("pubtypes_begin", TheCU->getUniqueID())); Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID()));
if (Asm->isVerbose()) if (Asm->isVerbose())
Asm->OutStreamer.AddComment("DWARF Version"); Asm->OutStreamer.AddComment("DWARF Version");
@ -2526,16 +2526,16 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info"); Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
Asm->EmitSectionOffset( Asm->EmitSectionOffset(
Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()),
DwarfInfoSectionSym); DwarfInfoSectionSym);
Asm->OutStreamer.AddComment("Compilation Unit Length"); Asm->OutStreamer.AddComment("Compilation Unit Length");
Asm->EmitLabelDifference( Asm->EmitLabelDifference(
Asm->GetTempSymbol(ISec->getLabelEndName(), TheCU->getUniqueID()), Asm->GetTempSymbol(ISec->getLabelEndName(), TheU->getUniqueID()),
Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), 4); Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()), 4);
// Emit the pubtypes. // Emit the pubtypes.
const StringMap<const DIE *> &Globals = TheCU->getGlobalTypes(); const StringMap<const DIE *> &Globals = TheU->getGlobalTypes();
for (StringMap<const DIE *>::const_iterator GI = Globals.begin(), for (StringMap<const DIE *>::const_iterator GI = Globals.begin(),
GE = Globals.end(); GE = Globals.end();
GI != GE; ++GI) { GI != GE; ++GI) {
@ -2547,7 +2547,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
Asm->EmitInt32(Entity->getOffset()); Asm->EmitInt32(Entity->getOffset());
if (GnuStyle) { if (GnuStyle) {
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity); dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
Asm->OutStreamer.AddComment( Asm->OutStreamer.AddComment(
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " + Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
dwarf::GDBIndexEntryLinkageString(Desc.Linkage)); dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
@ -2564,7 +2564,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
Asm->OutStreamer.AddComment("End Mark"); Asm->OutStreamer.AddComment("End Mark");
Asm->EmitInt32(0); Asm->EmitInt32(0);
Asm->OutStreamer.EmitLabel( Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol("pubtypes_end", TheCU->getUniqueID())); Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID()));
} }
} }

View File

@ -37,10 +37,10 @@ static cl::opt<bool> GenerateTypeUnits("generate-type-units", cl::Hidden,
cl::desc("Generate DWARF4 type units."), cl::desc("Generate DWARF4 type units."),
cl::init(false)); cl::init(false));
/// Unit - Compile unit constructor. /// Unit - Unit constructor.
Unit::Unit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A, Unit::Unit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
DwarfDebug *DW, DwarfUnits *DWU) DwarfDebug *DW, DwarfUnits *DWU)
: UniqueID(UID), Node(Node), CUDie(D), DebugInfoOffset(0), Asm(A), DD(DW), : UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW),
DU(DWU), IndexTyDie(0) { DU(DWU), IndexTyDie(0) {
DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1); DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
} }
@ -322,9 +322,9 @@ void Unit::addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIEEntry *Entry) {
const DIE *EntryCU = Entry->getEntry()->getUnitOrNull(); const DIE *EntryCU = Entry->getEntry()->getUnitOrNull();
if (!DieCU) if (!DieCU)
// We assume that Die belongs to this CU, if it is not linked to any CU yet. // We assume that Die belongs to this CU, if it is not linked to any CU yet.
DieCU = getCUDie(); DieCU = getUnitDie();
if (!EntryCU) if (!EntryCU)
EntryCU = getCUDie(); EntryCU = getUnitDie();
Die->addValue(Attribute, EntryCU == DieCU ? dwarf::DW_FORM_ref4 Die->addValue(Attribute, EntryCU == DieCU ? dwarf::DW_FORM_ref4
: dwarf::DW_FORM_ref_addr, : dwarf::DW_FORM_ref_addr,
Entry); Entry);
@ -894,7 +894,7 @@ void Unit::addTemplateParams(DIE &Buffer, DIArray TParams) {
/// getOrCreateContextDIE - Get context owner's DIE. /// getOrCreateContextDIE - Get context owner's DIE.
DIE *Unit::getOrCreateContextDIE(DIScope Context) { DIE *Unit::getOrCreateContextDIE(DIScope Context) {
if (!Context || Context.isFile()) if (!Context || Context.isFile())
return getCUDie(); return getUnitDie();
if (Context.isType()) if (Context.isType())
return getOrCreateTypeDIE(DIType(Context)); return getOrCreateTypeDIE(DIType(Context));
if (Context.isNameSpace()) if (Context.isNameSpace())
@ -1413,7 +1413,7 @@ DIE *Unit::getOrCreateSubprogramDIE(DISubprogram SP) {
DISubprogram SPDecl = SP.getFunctionDeclaration(); DISubprogram SPDecl = SP.getFunctionDeclaration();
if (SPDecl.isSubprogram()) if (SPDecl.isSubprogram())
// Add subprogram definitions to the CU die directly. // Add subprogram definitions to the CU die directly.
ContextDIE = CUDie.get(); ContextDIE = UnitDie.get();
// DW_TAG_inlined_subroutine may refer to this DIE. // DW_TAG_inlined_subroutine may refer to this DIE.
SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP); SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
@ -1616,7 +1616,7 @@ void CompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() && if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() &&
!GVContext.isFile() && !DD->isSubprogramContext(GVContext)) { !GVContext.isFile() && !DD->isSubprogramContext(GVContext)) {
// Create specification DIE. // Create specification DIE.
VariableSpecDIE = createAndAddDIE(dwarf::DW_TAG_variable, *CUDie); VariableSpecDIE = createAndAddDIE(dwarf::DW_TAG_variable, *UnitDie);
addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE); addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);
addBlock(VariableSpecDIE, dwarf::DW_AT_location, Block); addBlock(VariableSpecDIE, dwarf::DW_AT_location, Block);
// A static member's declaration is already flagged as such. // A static member's declaration is already flagged as such.
@ -1712,7 +1712,7 @@ void Unit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIE *IdxTy = getIndexTyDie(); DIE *IdxTy = getIndexTyDie();
if (!IdxTy) { if (!IdxTy) {
// Construct an anonymous type for index type. // Construct an anonymous type for index type.
IdxTy = createAndAddDIE(dwarf::DW_TAG_base_type, *CUDie.get()); IdxTy = createAndAddDIE(dwarf::DW_TAG_base_type, *UnitDie);
addString(IdxTy, dwarf::DW_AT_name, "int"); addString(IdxTy, dwarf::DW_AT_name, "int");
addUInt(IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int32_t)); addUInt(IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int32_t));
addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,

View File

@ -42,10 +42,10 @@ protected:
/// Node - MDNode for the compile unit. /// Node - MDNode for the compile unit.
DICompileUnit Node; DICompileUnit Node;
/// CUDie - Compile unit debug information entry. /// Unit debug information entry.
const OwningPtr<DIE> CUDie; const OwningPtr<DIE> UnitDie;
/// Offset of the CUDie from beginning of debug info section. /// Offset of the UnitDie from beginning of debug info section.
unsigned DebugInfoOffset; unsigned DebugInfoOffset;
/// Asm - Target of Dwarf emission. /// Asm - Target of Dwarf emission.
@ -55,7 +55,7 @@ protected:
DwarfDebug *DD; DwarfDebug *DD;
DwarfUnits *DU; DwarfUnits *DU;
/// IndexTyDie - An anonymous type for index type. Owned by CUDie. /// IndexTyDie - An anonymous type for index type. Owned by UnitDie.
DIE *IndexTyDie; DIE *IndexTyDie;
/// MDNodeToDieMap - Tracks the mapping of unit level debug information /// MDNodeToDieMap - Tracks the mapping of unit level debug information
@ -108,7 +108,7 @@ public:
unsigned getUniqueID() const { return UniqueID; } unsigned getUniqueID() const { return UniqueID; }
virtual uint16_t getLanguage() const = 0; virtual uint16_t getLanguage() const = 0;
DICompileUnit getNode() const { return Node; } DICompileUnit getNode() const { return Node; }
DIE *getCUDie() const { return CUDie.get(); } DIE *getUnitDie() const { return UnitDie.get(); }
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; } const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; } const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
@ -130,7 +130,7 @@ public:
void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; } void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
/// hasContent - Return true if this compile unit has something to write out. /// hasContent - Return true if this compile unit has something to write out.
bool hasContent() const { return !CUDie->getChildren().empty(); } bool hasContent() const { return !UnitDie->getChildren().empty(); }
/// getParentContextString - Get a string containing the language specific /// getParentContextString - Get a string containing the language specific
/// context for a global name. /// context for a global name.
@ -170,7 +170,7 @@ public:
/// addDie - Adds or interns the DIE to the compile unit. /// addDie - Adds or interns the DIE to the compile unit.
/// ///
void addDie(DIE *Buffer) { CUDie->addChild(Buffer); } void addDie(DIE *Buffer) { UnitDie->addChild(Buffer); }
/// addFlag - Add a flag that is true to the DIE. /// addFlag - Add a flag that is true to the DIE.
void addFlag(DIE *Die, dwarf::Attribute Attribute); void addFlag(DIE *Die, dwarf::Attribute Attribute);