[llvm] 0d1d1b3 - [DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const string& -> StringRef (#118056)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 03:25:18 PST 2024


Author: itrofimow
Date: 2024-11-29T11:25:14Z
New Revision: 0d1d1b363d9588c192152cec4f256f3edfea7e48

URL: https://github.com/llvm/llvm-project/commit/0d1d1b363d9588c192152cec4f256f3edfea7e48
DIFF: https://github.com/llvm/llvm-project/commit/0d1d1b363d9588c192152cec4f256f3edfea7e48.diff

LOG: [DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const string& -> StringRef (#118056)

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
    llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

Removed: 
    


################################################################################
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