[llvm] r196301 - Avoid buffer copies when a Twine already is a StringRef.
David Blaikie
dblaikie at gmail.com
Tue Dec 3 10:18:28 PST 2013
Author: dblaikie
Date: Tue Dec 3 12:18:28 2013
New Revision: 196301
URL: http://llvm.org/viewvc/llvm-project?rev=196301&view=rev
Log:
Avoid buffer copies when a Twine already is a StringRef.
Modified:
llvm/trunk/lib/MC/MCContext.cpp
llvm/trunk/lib/Option/ArgList.cpp
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=196301&r1=196300&r2=196301&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Tue Dec 3 12:18:28 2013
@@ -157,8 +157,7 @@ MCSymbol *MCContext::CreateSymbol(String
MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) {
SmallString<128> NameSV;
- Name.toVector(NameSV);
- return GetOrCreateSymbol(NameSV.str());
+ return GetOrCreateSymbol(Name.toStringRef(NameSV));
}
MCSymbol *MCContext::CreateTempSymbol() {
Modified: llvm/trunk/lib/Option/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/ArgList.cpp?rev=196301&r1=196300&r2=196301&view=diff
==============================================================================
--- llvm/trunk/lib/Option/ArgList.cpp (original)
+++ llvm/trunk/lib/Option/ArgList.cpp Tue Dec 3 12:18:28 2013
@@ -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,
More information about the llvm-commits
mailing list