From 451fa97c8c74837ef2eab10f79e7145ad25e260d Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 2 Dec 2013 22:09:48 +0000 Subject: 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 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 100 +++++++++++++++++----------------- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 16 +++--- lib/CodeGen/AsmPrinter/DwarfUnit.h | 14 ++--- 3 files changed, 65 insertions(+), 65 deletions(-) (limited to 'lib') diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 3e71735d61..cd7cf7bf5b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -341,26 +341,26 @@ static bool SectionSort(const MCSection *A, const MCSection *B) { // 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 // 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()) return; - TheCU->addAccelName(SP.getName(), Die); + TheU->addAccelName(SP.getName(), Die); // If the linkage name is different than the name, go ahead and output // that as well into the name table. 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 // too. if (isObjCClass(SP.getName())) { StringRef Class, Category; getObjCClassCategory(SP.getName(), Class, Category); - TheCU->addAccelObjC(Class, Die); + TheU->addAccelObjC(Class, Die); if (Category != "") - TheCU->addAccelObjC(Category, Die); + TheU->addAccelObjC(Category, Die); // 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. if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) { // 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); } else { DISubprogram SPDecl = SP.getFunctionDeclaration(); @@ -421,8 +422,8 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, DISubprogram SP) { SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); } DIE *SPDeclDie = SPDie; - SPDie = - SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU->getCUDie()); + SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram, + *SPCU->getUnitDie()); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie); } } @@ -1066,28 +1067,27 @@ void DwarfDebug::finalizeModuleInfo() { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; + Unit *TheU = *I; // Emit DW_AT_containing_type attribute to connect types with their // vtable holding type. - TheCU->constructContainingTypeDIEs(); + TheU->constructContainingTypeDIEs(); // If we're splitting the dwarf out now that we've got the entire // CU then construct a skeleton CU based upon it. if (useSplitDwarf() && - TheCU->getCUDie()->getTag() == dwarf::DW_TAG_compile_unit) { + TheU->getUnitDie()->getTag() == dwarf::DW_TAG_compile_unit) { uint64_t ID = 0; if (GenerateCUHash) { 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. - TheCU->addUInt(TheCU->getCUDie(), dwarf::DW_AT_GNU_dwo_id, - dwarf::DW_FORM_data8, ID); + TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id, + dwarf::DW_FORM_data8, ID); // Now construct the skeleton CU associated. - CompileUnit *SkCU = - constructSkeletonCU(static_cast(TheCU)); + CompileUnit *SkCU = constructSkeletonCU(static_cast(TheU)); // 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); } } @@ -1965,7 +1965,7 @@ void DwarfUnits::computeSizeAndOffsets() { // EndOffset here is CU-relative, after laying out // all of the CU DIE. - unsigned EndOffset = computeSizeAndOffset((*I)->getCUDie(), Offset); + unsigned EndOffset = computeSizeAndOffset((*I)->getUnitDie(), Offset); SecOffset += EndOffset; } } @@ -2134,22 +2134,22 @@ void DwarfUnits::emitUnits(DwarfDebug *DD, const MCSection *USection, Asm->OutStreamer.SwitchSection(USection); for (SmallVectorImpl::iterator I = CUs.begin(), E = CUs.end(); I != E; ++I) { - Unit *TheCU = *I; - DIE *Die = TheCU->getCUDie(); + Unit *TheU = *I; + DIE *Die = TheU->getUnitDie(); // Emit the compile units header. - Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(USection->getLabelBeginName(), - TheCU->getUniqueID())); + Asm->OutStreamer.EmitLabel( + Asm->GetTempSymbol(USection->getLabelBeginName(), TheU->getUniqueID())); // Emit size of content not including length itself 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); Asm->OutStreamer.EmitLabel( - Asm->GetTempSymbol(USection->getLabelEndName(), TheCU->getUniqueID())); + Asm->GetTempSymbol(USection->getLabelEndName(), TheU->getUniqueID())); } } @@ -2232,8 +2232,8 @@ void DwarfDebug::emitAccelNames() { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; - const StringMap > &Names = TheCU->getAccelNames(); + Unit *TheU = *I; + const StringMap > &Names = TheU->getAccelNames(); for (StringMap >::const_iterator GI = Names.begin(), GE = Names.end(); @@ -2265,8 +2265,8 @@ void DwarfDebug::emitAccelObjC() { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; - const StringMap > &Names = TheCU->getAccelObjC(); + Unit *TheU = *I; + const StringMap > &Names = TheU->getAccelObjC(); for (StringMap >::const_iterator GI = Names.begin(), GE = Names.end(); @@ -2297,9 +2297,9 @@ void DwarfDebug::emitAccelNamespaces() { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; + Unit *TheU = *I; const StringMap > &Names = - TheCU->getAccelNamespace(); + TheU->getAccelNamespace(); for (StringMap >::const_iterator GI = Names.begin(), GE = Names.end(); @@ -2336,9 +2336,9 @@ void DwarfDebug::emitAccelTypes() { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; + Unit *TheU = *I; const StringMap > > &Names = - TheCU->getAccelTypes(); + TheU->getAccelTypes(); for (StringMap< std::vector > >::const_iterator GI = Names.begin(), @@ -2433,8 +2433,8 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; - unsigned ID = TheCU->getUniqueID(); + Unit *TheU = *I; + unsigned ID = TheU->getUniqueID(); // Start the dwarf pubnames section. 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. if (GnuStyle) Asm->OutStreamer.EmitLabel( - Asm->GetTempSymbol("gnu_pubnames", TheCU->getUniqueID())); + Asm->GetTempSymbol("gnu_pubnames", TheU->getUniqueID())); // Emit the header. Asm->OutStreamer.AddComment("Length of Public Names Info"); @@ -2464,7 +2464,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) { 4); // Emit the pubnames for this compilation unit. - const StringMap &Globals = TheCU->getGlobalNames(); + const StringMap &Globals = TheU->getGlobalNames(); for (StringMap::const_iterator GI = Globals.begin(), GE = Globals.end(); GI != GE; ++GI) { @@ -2475,7 +2475,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) { Asm->EmitInt32(Entity->getOffset()); if (GnuStyle) { - dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity); + dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity); Asm->OutStreamer.AddComment( Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " + dwarf::GDBIndexEntryLinkageString(Desc.Linkage)); @@ -2502,23 +2502,23 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) { for (SmallVectorImpl::const_iterator I = getUnits().begin(), E = getUnits().end(); I != E; ++I) { - Unit *TheCU = *I; + Unit *TheU = *I; // Start the dwarf pubtypes section. Asm->OutStreamer.SwitchSection(PSec); // Emit a label so we can reference the beginning of this pubtype section. if (GnuStyle) Asm->OutStreamer.EmitLabel( - Asm->GetTempSymbol("gnu_pubtypes", TheCU->getUniqueID())); + Asm->GetTempSymbol("gnu_pubtypes", TheU->getUniqueID())); // Emit the header. Asm->OutStreamer.AddComment("Length of Public Types Info"); Asm->EmitLabelDifference( - Asm->GetTempSymbol("pubtypes_end", TheCU->getUniqueID()), - Asm->GetTempSymbol("pubtypes_begin", TheCU->getUniqueID()), 4); + Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID()), + Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID()), 4); Asm->OutStreamer.EmitLabel( - Asm->GetTempSymbol("pubtypes_begin", TheCU->getUniqueID())); + Asm->GetTempSymbol("pubtypes_begin", TheU->getUniqueID())); if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DWARF Version"); @@ -2526,16 +2526,16 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) { Asm->OutStreamer.AddComment("Offset of Compilation Unit Info"); Asm->EmitSectionOffset( - Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), + Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()), DwarfInfoSectionSym); Asm->OutStreamer.AddComment("Compilation Unit Length"); Asm->EmitLabelDifference( - Asm->GetTempSymbol(ISec->getLabelEndName(), TheCU->getUniqueID()), - Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), 4); + Asm->GetTempSymbol(ISec->getLabelEndName(), TheU->getUniqueID()), + Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()), 4); // Emit the pubtypes. - const StringMap &Globals = TheCU->getGlobalTypes(); + const StringMap &Globals = TheU->getGlobalTypes(); for (StringMap::const_iterator GI = Globals.begin(), GE = Globals.end(); GI != GE; ++GI) { @@ -2547,7 +2547,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) { Asm->EmitInt32(Entity->getOffset()); if (GnuStyle) { - dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity); + dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity); Asm->OutStreamer.AddComment( Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " + dwarf::GDBIndexEntryLinkageString(Desc.Linkage)); @@ -2564,7 +2564,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) { Asm->OutStreamer.AddComment("End Mark"); Asm->EmitInt32(0); Asm->OutStreamer.EmitLabel( - Asm->GetTempSymbol("pubtypes_end", TheCU->getUniqueID())); + Asm->GetTempSymbol("pubtypes_end", TheU->getUniqueID())); } } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index f235c5b1d3..c13930e4a6 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -37,10 +37,10 @@ static cl::opt GenerateTypeUnits("generate-type-units", cl::Hidden, cl::desc("Generate DWARF4 type units."), cl::init(false)); -/// Unit - Compile unit constructor. +/// Unit - Unit constructor. Unit::Unit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A, 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) { 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(); if (!DieCU) // We assume that Die belongs to this CU, if it is not linked to any CU yet. - DieCU = getCUDie(); + DieCU = getUnitDie(); if (!EntryCU) - EntryCU = getCUDie(); + EntryCU = getUnitDie(); Die->addValue(Attribute, EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr, Entry); @@ -894,7 +894,7 @@ void Unit::addTemplateParams(DIE &Buffer, DIArray TParams) { /// getOrCreateContextDIE - Get context owner's DIE. DIE *Unit::getOrCreateContextDIE(DIScope Context) { if (!Context || Context.isFile()) - return getCUDie(); + return getUnitDie(); if (Context.isType()) return getOrCreateTypeDIE(DIType(Context)); if (Context.isNameSpace()) @@ -1413,7 +1413,7 @@ DIE *Unit::getOrCreateSubprogramDIE(DISubprogram SP) { DISubprogram SPDecl = SP.getFunctionDeclaration(); if (SPDecl.isSubprogram()) // Add subprogram definitions to the CU die directly. - ContextDIE = CUDie.get(); + ContextDIE = UnitDie.get(); // DW_TAG_inlined_subroutine may refer to this DIE. SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP); @@ -1616,7 +1616,7 @@ void CompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) { if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() && !GVContext.isFile() && !DD->isSubprogramContext(GVContext)) { // Create specification DIE. - VariableSpecDIE = createAndAddDIE(dwarf::DW_TAG_variable, *CUDie); + VariableSpecDIE = createAndAddDIE(dwarf::DW_TAG_variable, *UnitDie); addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE); addBlock(VariableSpecDIE, dwarf::DW_AT_location, Block); // A static member's declaration is already flagged as such. @@ -1712,7 +1712,7 @@ void Unit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) { DIE *IdxTy = getIndexTyDie(); if (!IdxTy) { // 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"); addUInt(IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int32_t)); addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index 080e21384a..0ee1aade64 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -42,10 +42,10 @@ protected: /// Node - MDNode for the compile unit. DICompileUnit Node; - /// CUDie - Compile unit debug information entry. - const OwningPtr CUDie; + /// Unit debug information entry. + const OwningPtr UnitDie; - /// Offset of the CUDie from beginning of debug info section. + /// Offset of the UnitDie from beginning of debug info section. unsigned DebugInfoOffset; /// Asm - Target of Dwarf emission. @@ -55,7 +55,7 @@ protected: DwarfDebug *DD; DwarfUnits *DU; - /// IndexTyDie - An anonymous type for index type. Owned by CUDie. + /// IndexTyDie - An anonymous type for index type. Owned by UnitDie. DIE *IndexTyDie; /// MDNodeToDieMap - Tracks the mapping of unit level debug information @@ -108,7 +108,7 @@ public: unsigned getUniqueID() const { return UniqueID; } virtual uint16_t getLanguage() const = 0; DICompileUnit getNode() const { return Node; } - DIE *getCUDie() const { return CUDie.get(); } + DIE *getUnitDie() const { return UnitDie.get(); } const StringMap &getGlobalNames() const { return GlobalNames; } const StringMap &getGlobalTypes() const { return GlobalTypes; } @@ -130,7 +130,7 @@ public: void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; } /// 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 /// context for a global name. @@ -170,7 +170,7 @@ public: /// 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. void addFlag(DIE *Die, dwarf::Attribute Attribute); -- cgit v1.2.3