[llvm] r195290 - Constify the DIEs used for pubname and pubtype tables. Propagate

Eric Christopher echristo at gmail.com
Wed Nov 20 16:48:22 PST 2013


Author: echristo
Date: Wed Nov 20 18:48:22 2013
New Revision: 195290

URL: http://llvm.org/viewvc/llvm-project?rev=195290&view=rev
Log:
Constify the DIEs used for pubname and pubtype tables. Propagate
through findAttribute etc.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=195290&r1=195289&r2=195290&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed Nov 20 18:48:22 2013
@@ -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<DIEValue *> &Values = getValues();
   const DIEAbbrev &Abbrevs = getAbbrev();
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=195290&r1=195289&r2=195290&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Wed Nov 20 18:48:22 2013
@@ -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;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=195290&r1=195289&r2=195290&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Wed Nov 20 18:48:22 2013
@@ -66,11 +66,11 @@ class CompileUnit {
 
   /// GlobalNames - A map of globally visible named entities for this unit.
   ///
-  StringMap<DIE *> GlobalNames;
+  StringMap<const DIE *> GlobalNames;
 
   /// GlobalTypes - A map of globally visible types for this unit.
   ///
-  StringMap<DIE *> GlobalTypes;
+  StringMap<const DIE *> 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<DIE *> &getGlobalNames() const { return GlobalNames; }
-  const StringMap<DIE *> &getGlobalTypes() const { return GlobalTypes; }
+  const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
+  const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
 
   const StringMap<std::vector<const DIE *> > &getAccelNames() const {
     return AccelNames;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=195290&r1=195289&r2=195290&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Nov 20 18:48:22 2013
@@ -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
                              4);
 
     // Emit the pubnames for this compilation unit.
-    const StringMap<DIE *> &Globals = TheCU->getGlobalNames();
-    for (StringMap<DIE *>::const_iterator GI = Globals.begin(),
-                                          GE = Globals.end();
+    const StringMap<const DIE *> &Globals = TheCU->getGlobalNames();
+    for (StringMap<const DIE *>::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
         Asm->GetTempSymbol(ISec->getLabelBeginName(), TheCU->getUniqueID()), 4);
 
     // Emit the pubtypes.
-    const StringMap<DIE *> &Globals = TheCU->getGlobalTypes();
-    for (StringMap<DIE *>::const_iterator GI = Globals.begin(),
-                                          GE = Globals.end();
+    const StringMap<const DIE *> &Globals = TheCU->getGlobalTypes();
+    for (StringMap<const DIE *>::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");





More information about the llvm-commits mailing list