зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
bcbca75e94
Коммит
2b5cfbc0b0
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче