[cfe-commits] r141970 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Benjamin Kramer
benny.kra at googlemail.com
Fri Oct 14 11:45:16 PDT 2011
Author: d0k
Date: Fri Oct 14 13:45:16 2011
New Revision: 141970
URL: http://llvm.org/viewvc/llvm-project?rev=141970&view=rev
Log:
Simplify code to avoid a useless string copy.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=141970&r1=141969&r2=141970&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct 14 13:45:16 2011
@@ -156,12 +156,10 @@
/// getSelectorName - Return selector name. This is used for debugging
/// info.
StringRef CGDebugInfo::getSelectorName(Selector S) {
- llvm::SmallString<256> SName;
- llvm::raw_svector_ostream OS(SName);
- OS << S.getAsString();
- char *StrPtr = DebugInfoNames.Allocate<char>(OS.tell());
- memcpy(StrPtr, SName.begin(), OS.tell());
- return StringRef(StrPtr, OS.tell());
+ const std::string &SName = S.getAsString();
+ char *StrPtr = DebugInfoNames.Allocate<char>(SName.size());
+ memcpy(StrPtr, SName.data(), SName.size());
+ return StringRef(StrPtr, SName.size());
}
/// getClassName - Get class name including template argument list.
More information about the cfe-commits
mailing list