[llvm] [DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const string& -> StringRef (PR #118056)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 28 22:39:43 PST 2024
https://github.com/itrofimow created https://github.com/llvm/llvm-project/pull/118056
None
>From 425b30911814ba5b9b72ee2f70bb66d0a79d04bc Mon Sep 17 00:00:00 2001
From: Ivan Trofimov <i.trofimow at yandex.ru>
Date: Fri, 29 Nov 2024 09:37:50 +0300
Subject: [PATCH] [DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const
string& -> StringRef
---
llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h | 3 +--
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 6 +++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
index df2e806259b369..5747ad99d0f133 100644
--- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
+++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
@@ -120,8 +120,7 @@ class LLVMSymbolizer {
void pruneCache();
static std::string
- DemangleName(const std::string &Name,
- const SymbolizableModule *DbiModuleDescriptor);
+ DemangleName(StringRef Name, const SymbolizableModule *DbiModuleDescriptor);
void setBuildIDFetcher(std::unique_ptr<BuildIDFetcher> Fetcher) {
BIDFetcher = std::move(Fetcher);
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 01ccbe886a2bcd..b96f97a159243f 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -747,7 +747,7 @@ StringRef demanglePE32ExternCFunc(StringRef SymbolName) {
} // end anonymous namespace
std::string
-LLVMSymbolizer::DemangleName(const std::string &Name,
+LLVMSymbolizer::DemangleName(StringRef Name,
const SymbolizableModule *DbiModuleDescriptor) {
std::string Result;
if (nonMicrosoftDemangle(Name, Result))
@@ -761,7 +761,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
MSDF_NoMemberType | MSDF_NoReturnType));
if (status != 0)
- return Name;
+ return std::string{Name};
Result = DemangledName;
free(DemangledName);
return Result;
@@ -775,7 +775,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
return Result;
return DemangledCName;
}
- return Name;
+ return std::string{Name};
}
void LLVMSymbolizer::recordAccess(CachedBinary &Bin) {
More information about the llvm-commits
mailing list