[llvm] r185188 - DebugInfo: constify the AddressPool MCSymbol pointers

David Blaikie dblaikie at gmail.com
Fri Jun 28 11:47:15 PDT 2013


Author: dblaikie
Date: Fri Jun 28 13:47:14 2013
New Revision: 185188

URL: http://llvm.org/viewvc/llvm-project?rev=185188&view=rev
Log:
DebugInfo: constify the AddressPool MCSymbol pointers

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=185188&r1=185187&r2=185188&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 28 13:47:14 2013
@@ -247,8 +247,8 @@ unsigned DwarfUnits::getStringPoolIndex(
   return Entry.second;
 }
 
-unsigned DwarfUnits::getAddrPoolIndex(MCSymbol *Sym) {
-  std::pair<MCSymbol*, unsigned> &Entry = AddressPool[Sym];
+unsigned DwarfUnits::getAddrPoolIndex(const MCSymbol *Sym) {
+  std::pair<const MCSymbol*, unsigned> &Entry = AddressPool[Sym];
   if (Entry.first) return Entry.second;
 
   Entry.second = NextAddrPoolNumber++;
@@ -2358,11 +2358,13 @@ void DwarfUnits::emitAddresses(const MCS
 
   // Get all of the string pool entries and put them in an array by their ID so
   // we can sort them.
-  SmallVector<std::pair<unsigned,
-                        std::pair<MCSymbol*, unsigned>* >, 64> Entries;
+  SmallVector<std::pair<unsigned, std::pair<const MCSymbol *, unsigned> *>, 64>
+      Entries;
 
-  for (DenseMap<MCSymbol*, std::pair<MCSymbol*, unsigned> >::iterator
-         I = AddressPool.begin(), E = AddressPool.end();
+  for (DenseMap<const MCSymbol *,
+                std::pair<const MCSymbol *, unsigned> >::iterator
+           I = AddressPool.begin(),
+           E = AddressPool.end();
        I != E; ++I)
     Entries.push_back(std::make_pair(I->second.second, &(I->second)));
 
@@ -2370,10 +2372,8 @@ void DwarfUnits::emitAddresses(const MCS
 
   for (unsigned i = 0, e = Entries.size(); i != e; ++i) {
     // Emit a label for reference from debug information entries.
-    MCSymbol *Sym = Entries[i].second->first;
-    if (Sym)
-      Asm->EmitLabelReference(Entries[i].second->first,
-                              Asm->getDataLayout().getPointerSize());
+    if (const MCSymbol *Sym = Entries[i].second->first)
+      Asm->EmitLabelReference(Sym, Asm->getDataLayout().getPointerSize());
     else
       Asm->OutStreamer.EmitIntValue(0, Asm->getDataLayout().getPointerSize());
   }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=185188&r1=185187&r2=185188&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Jun 28 13:47:14 2013
@@ -197,7 +197,8 @@ typedef StringMap<std::pair<MCSymbol*, u
 
 // A Symbol->pair<Symbol, unsigned> mapping of addresses used by indirect
 // references.
-typedef DenseMap<MCSymbol *, std::pair<MCSymbol *, unsigned> > AddrPool;
+typedef DenseMap<const MCSymbol *, std::pair<const MCSymbol *, unsigned> >
+    AddrPool;
 
 /// \brief Collects and handles information specific to a particular
 /// collection of units.
@@ -270,7 +271,7 @@ public:
 
   /// \brief Returns the index into the address pool with the given
   /// label/symbol.
-  unsigned getAddrPoolIndex(MCSymbol *);
+  unsigned getAddrPoolIndex(const MCSymbol *);
 
   /// \brief Returns the address pool.
   AddrPool *getAddrPool() { return &AddressPool; }





More information about the llvm-commits mailing list