Skip to content

Commit 0d1d1b3

Browse files
authored
[DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const string& -> StringRef (#118056)
1 parent 7ed36b9 commit 0d1d1b3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ class LLVMSymbolizer {
120120
void pruneCache();
121121

122122
static std::string
123-
DemangleName(const std::string &Name,
124-
const SymbolizableModule *DbiModuleDescriptor);
123+
DemangleName(StringRef Name, const SymbolizableModule *DbiModuleDescriptor);
125124

126125
void setBuildIDFetcher(std::unique_ptr<BuildIDFetcher> Fetcher) {
127126
BIDFetcher = std::move(Fetcher);

llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ StringRef demanglePE32ExternCFunc(StringRef SymbolName) {
747747
} // end anonymous namespace
748748

749749
std::string
750-
LLVMSymbolizer::DemangleName(const std::string &Name,
750+
LLVMSymbolizer::DemangleName(StringRef Name,
751751
const SymbolizableModule *DbiModuleDescriptor) {
752752
std::string Result;
753753
if (nonMicrosoftDemangle(Name, Result))
@@ -761,7 +761,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
761761
MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
762762
MSDF_NoMemberType | MSDF_NoReturnType));
763763
if (status != 0)
764-
return Name;
764+
return std::string{Name};
765765
Result = DemangledName;
766766
free(DemangledName);
767767
return Result;
@@ -775,7 +775,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
775775
return Result;
776776
return DemangledCName;
777777
}
778-
return Name;
778+
return std::string{Name};
779779
}
780780

781781
void LLVMSymbolizer::recordAccess(CachedBinary &Bin) {

0 commit comments

Comments
 (0)