Avoid buffer copies when a Twine already is a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196301 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-12-03 18:18:28 +00:00
parent 822a02fb4c
commit 445cfd70b9
2 changed files with 2 additions and 4 deletions

View File

@ -157,8 +157,7 @@ MCSymbol *MCContext::CreateSymbol(StringRef Name) {
MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) { MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) {
SmallString<128> NameSV; SmallString<128> NameSV;
Name.toVector(NameSV); return GetOrCreateSymbol(Name.toStringRef(NameSV));
return GetOrCreateSymbol(NameSV.str());
} }
MCSymbol *MCContext::CreateTempSymbol() { MCSymbol *MCContext::CreateTempSymbol() {

View File

@ -291,8 +291,7 @@ void ArgList::ClaimAllArgs() const {
const char *ArgList::MakeArgString(const Twine &T) const { const char *ArgList::MakeArgString(const Twine &T) const {
SmallString<256> Str; SmallString<256> Str;
T.toVector(Str); return MakeArgString(T.toStringRef(Str));
return MakeArgString(Str.str());
} }
const char *ArgList::GetOrMakeJoinedArgString(unsigned Index, const char *ArgList::GetOrMakeJoinedArgString(unsigned Index,