Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;
Expand All @@ -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) {
Expand Down