From: Yaron Keren Date: Tue, 17 Mar 2015 18:55:30 +0000 (+0000) Subject: Remove LookupSymbol(StringRef) and optimize LookupSymbol(Twine). X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=6279aae98928a6039b7bf29a26274ae1dc741e0f;p=oota-llvm.git Remove LookupSymbol(StringRef) and optimize LookupSymbol(Twine). Same as MakeArgString in r232465, keep only LookupSymbol(Twine) while making sure it handles the StringRef like cases efficiently using twine::toStringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232517 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 20fad95d3ae..734103d5a67 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -236,7 +236,6 @@ namespace llvm { MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx); /// Get the symbol for \p Name, or null. - MCSymbol *LookupSymbol(StringRef Name) const; MCSymbol *LookupSymbol(const Twine &Name) const; /// getSymbols - Get a reference for the symbol table for clients that diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 608d958fc8e..b0e7cf50d69 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -219,14 +219,10 @@ MCSymbol *MCContext::GetDirectionalLocalSymbol(unsigned LocalLabelVal, return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance); } -MCSymbol *MCContext::LookupSymbol(StringRef Name) const { - return Symbols.lookup(Name); -} - MCSymbol *MCContext::LookupSymbol(const Twine &Name) const { SmallString<128> NameSV; - Name.toVector(NameSV); - return LookupSymbol(NameSV.str()); + StringRef NameRef = Name.toStringRef(NameSV); + return Symbols.lookup(NameRef); } //===----------------------------------------------------------------------===// @@ -249,7 +245,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section, Name += Section; // Do the lookup, if we have a hit, return it. - const MCSectionMachO *&Entry = MachOUniquingMap[Name.str()]; + const MCSectionMachO *&Entry = MachOUniquingMap[Name]; if (Entry) return Entry;