Avoid buffer copies when a Twine already is a StringRef.

llvm-svn: 196301
This commit is contained in:
David Blaikie 2013-12-03 18:18:28 +00:00
parent 9163e8bce6
commit 8e5283ad1d
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) {
SmallString<128> NameSV;
Name.toVector(NameSV);
return GetOrCreateSymbol(NameSV.str());
return GetOrCreateSymbol(Name.toStringRef(NameSV));
}
MCSymbol *MCContext::CreateTempSymbol() {

View File

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