diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-14 18:45:16 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-14 18:45:16 +0000 |
commit | 2b5cfbc0b074ef77ccac407533d27778ace4028c (patch) | |
tree | c9b4d084973776f60d73107659b09d476e7c2e4e /lib/CodeGen/CGDebugInfo.cpp | |
parent | bcbca75e94c8eb7073482fa0c5c8940f39f66849 (diff) |
Simplify code to avoid a useless string copy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 5ae4dfe83c..39a9ef788f 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -156,12 +156,10 @@ StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { /// 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. |