From ba5ab8289ca4c1c81178820419e5533c692e31e6 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 21 Nov 2013 00:48:22 +0000 Subject: [PATCH] Constify the DIEs used for pubname and pubtype tables. Propagate through findAttribute etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195290 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DIE.cpp | 2 +- lib/CodeGen/AsmPrinter/DIE.h | 2 +- lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 8 ++++---- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index c6b765a5f0a..cff00a75ab4 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -133,7 +133,7 @@ const DIE *DIE::getUnitOrNull() const { return NULL; } -DIEValue *DIE::findAttribute(uint16_t Attribute) { +DIEValue *DIE::findAttribute(uint16_t Attribute) const { const SmallVectorImpl &Values = getValues(); const DIEAbbrev &Abbrevs = getAbbrev(); diff --git a/lib/CodeGen/AsmPrinter/DIE.h b/lib/CodeGen/AsmPrinter/DIE.h index e8265153f39..e28ddd38bc4 100644 --- a/lib/CodeGen/AsmPrinter/DIE.h +++ b/lib/CodeGen/AsmPrinter/DIE.h @@ -174,7 +174,7 @@ namespace llvm { /// findAttribute - Find a value in the DIE with the attribute given, /// returns NULL if no such attribute exists. - DIEValue *findAttribute(uint16_t Attribute); + DIEValue *findAttribute(uint16_t Attribute) const; #ifndef NDEBUG void print(raw_ostream &O, unsigned IndentCount = 0) const; diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 3a0c6be0acf..21153862d77 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -66,11 +66,11 @@ class CompileUnit { /// GlobalNames - A map of globally visible named entities for this unit. /// - StringMap GlobalNames; + StringMap GlobalNames; /// GlobalTypes - A map of globally visible types for this unit. /// - StringMap GlobalTypes; + StringMap GlobalTypes; /// AccelNames - A map of names for the name accelerator table. /// @@ -107,8 +107,8 @@ public: uint16_t getLanguage() const { return Language; } DICompileUnit getNode() const { return Node; } DIE *getCUDie() const { return CUDie.get(); } - const StringMap &getGlobalNames() const { return GlobalNames; } - const StringMap &getGlobalTypes() const { return GlobalTypes; } + const StringMap &getGlobalNames() const { return GlobalNames; } + const StringMap &getGlobalTypes() const { return GlobalTypes; } const StringMap > &getAccelNames() const { return AccelNames; diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index dca2196214f..d81e19c07a0 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2379,7 +2379,7 @@ void DwarfDebug::emitAccelTypes() { /// computeIndexValue - Compute the gdb index value for the DIE and CU. static dwarf::PubIndexEntryDescriptor computeIndexValue(CompileUnit *CU, - DIE *Die) { + const DIE *Die) { dwarf::GDBIndexEntryLinkage Linkage = dwarf::GIEL_STATIC; // We could have a specification DIE that has our most of our knowledge, @@ -2461,12 +2461,12 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) { 4); // Emit the pubnames for this compilation unit. - const StringMap &Globals = TheCU->getGlobalNames(); - for (StringMap::const_iterator GI = Globals.begin(), - GE = Globals.end(); + const StringMap &Globals = TheCU->getGlobalNames(); + for (StringMap::const_iterator GI = Globals.begin(), + GE = Globals.end(); GI != GE; ++GI) { const char *Name = GI->getKeyData(); - DIE *Entity = GI->second; + const DIE *Entity = GI->second; Asm->OutStreamer.AddComment("DIE offset"); Asm->EmitInt32(Entity->getOffset()); @@ -2532,12 +2532,12 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) { Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), 4); // Emit the pubtypes. - const StringMap &Globals = TheCU->getGlobalTypes(); - for (StringMap::const_iterator GI = Globals.begin(), - GE = Globals.end(); + const StringMap &Globals = TheCU->getGlobalTypes(); + for (StringMap::const_iterator GI = Globals.begin(), + GE = Globals.end(); GI != GE; ++GI) { const char *Name = GI->getKeyData(); - DIE *Entity = GI->second; + const DIE *Entity = GI->second; if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DIE offset");