From: Duncan P. N. Exon Smith Date: Sun, 24 May 2015 16:06:08 +0000 (+0000) Subject: AsmPrinter: Refactor DwarfStringPool::getEntry(), NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d2d4e2637e5deaf824545938ab48a2464107d3a;p=oota-llvm.git AsmPrinter: Refactor DwarfStringPool::getEntry(), NFC Move `DwarfStringPool`'s `getEntry()` to the header (and make it a member function) in preparation for calculating symbol offsets on-the-fly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238112 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp index b7a421f5a1b..fc98ed4b784 100644 --- a/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp @@ -12,10 +12,8 @@ using namespace llvm; -static std::pair & -getEntry(AsmPrinter &Asm, - StringMap, BumpPtrAllocator &> &Pool, - StringRef Prefix, StringRef Str) { +std::pair &DwarfStringPool::getEntry(AsmPrinter &Asm, + StringRef Str) { std::pair &Entry = Pool[Str]; if (!Entry.first) { Entry.second = Pool.size() - 1; @@ -24,14 +22,6 @@ getEntry(AsmPrinter &Asm, return Entry; } -MCSymbol *DwarfStringPool::getSymbol(AsmPrinter &Asm, StringRef Str) { - return getEntry(Asm, Pool, Prefix, Str).first; -} - -unsigned DwarfStringPool::getIndex(AsmPrinter &Asm, StringRef Str) { - return getEntry(Asm, Pool, Prefix, Str).second; -} - void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection, MCSection *OffsetSection) { if (Pool.empty()) diff --git a/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/lib/CodeGen/AsmPrinter/DwarfStringPool.h index 9f32b98e2b3..ba0d595c140 100644 --- a/lib/CodeGen/AsmPrinter/DwarfStringPool.h +++ b/lib/CodeGen/AsmPrinter/DwarfStringPool.h @@ -37,13 +37,20 @@ public: /// \brief Returns an entry into the string pool with the given /// string text. - MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str); + MCSymbol *getSymbol(AsmPrinter &Asm, StringRef Str) { + return getEntry(Asm, Str).first; + } /// \brief Returns the index into the string pool with the given /// string text. - unsigned getIndex(AsmPrinter &Asm, StringRef Str); + unsigned getIndex(AsmPrinter &Asm, StringRef Str) { + return getEntry(Asm, Str).second; + } bool empty() const { return Pool.empty(); } + +private: + std::pair &getEntry(AsmPrinter &Asm, StringRef Str); }; } #endif