diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 44485c4bcf7..a6d2b17e3bd 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -247,8 +247,8 @@ unsigned DwarfUnits::getStringPoolIndex(StringRef Str) { return Entry.second; } -unsigned DwarfUnits::getAddrPoolIndex(MCSymbol *Sym) { - std::pair &Entry = AddressPool[Sym]; +unsigned DwarfUnits::getAddrPoolIndex(const MCSymbol *Sym) { + std::pair &Entry = AddressPool[Sym]; if (Entry.first) return Entry.second; Entry.second = NextAddrPoolNumber++; @@ -2358,11 +2358,13 @@ void DwarfUnits::emitAddresses(const MCSection *AddrSection) { // Get all of the string pool entries and put them in an array by their ID so // we can sort them. - SmallVector* >, 64> Entries; + SmallVector *>, 64> + Entries; - for (DenseMap >::iterator - I = AddressPool.begin(), E = AddressPool.end(); + for (DenseMap >::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 MCSection *AddrSection) { 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()); } diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 6cc792b3731..4a395a336d3 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -197,7 +197,8 @@ typedef StringMap, // A Symbol->pair mapping of addresses used by indirect // references. -typedef DenseMap > AddrPool; +typedef DenseMap > + 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; }