[llvm] c2709fc - [Demangle] remove unused params of microsoftDemangle
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 15:46:06 PDT 2023
Author: Nick Desaulniers
Date: 2023-04-21T15:37:00-07:00
New Revision: c2709fcb0a5b32e42a35661fab4d5744e11d04c0
URL: https://github.com/llvm/llvm-project/commit/c2709fcb0a5b32e42a35661fab4d5744e11d04c0
DIFF: https://github.com/llvm/llvm-project/commit/c2709fcb0a5b32e42a35661fab4d5744e11d04c0.diff
LOG: [Demangle] remove unused params of microsoftDemangle
No call sites use these parameters, so drop them.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148940
Added:
Modified:
lldb/source/Core/Mangled.cpp
llvm/include/llvm/Demangle/Demangle.h
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/lib/Demangle/Demangle.cpp
llvm/lib/Demangle/MicrosoftDemangle.cpp
llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
llvm/tools/llvm-objdump/COFFDump.cpp
llvm/tools/llvm-undname/llvm-undname.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 29fb35980036a..30c8e1a3330d2 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -108,7 +108,7 @@ void Mangled::SetValue(ConstString name) {
// Local helpers for
diff erent demangling implementations.
static char *GetMSVCDemangledStr(const char *M) {
char *demangled_cstr = llvm::microsoftDemangle(
- M, nullptr, nullptr, nullptr, nullptr,
+ M, nullptr, nullptr,
llvm::MSDemangleFlags(
llvm::MSDF_NoAccessSpecifier | llvm::MSDF_NoCallingConvention |
llvm::MSDF_NoMemberType | llvm::MSDF_NoVariableType));
diff --git a/llvm/include/llvm/Demangle/Demangle.h b/llvm/include/llvm/Demangle/Demangle.h
index 6133d0b95bbfc..855ab1f57512f 100644
--- a/llvm/include/llvm/Demangle/Demangle.h
+++ b/llvm/include/llvm/Demangle/Demangle.h
@@ -46,15 +46,9 @@ enum MSDemangleFlags {
/// success, or nullptr on error.
/// If n_read is non-null and demangling was successful, it receives how many
/// bytes of the input string were consumed.
-/// buf can point to a *n_buf bytes large buffer where the demangled name is
-/// stored. If the buffer is too small, it is grown with realloc(). If buf is
-/// nullptr, then this malloc()s memory for the result.
-/// *n_buf stores the size of buf on input if buf is non-nullptr, and it
-/// receives the size of the demangled string on output if n_buf is not nullptr.
/// status receives one of the demangle_ enum entries above if it's not nullptr.
/// Flags controls various details of the demangled representation.
-char *microsoftDemangle(const char *mangled_name, size_t *n_read, char *buf,
- size_t *n_buf, int *status,
+char *microsoftDemangle(const char *mangled_name, size_t *n_read, int *status,
MSDemangleFlags Flags = MSDF_None);
// Demangles a Rust v0 mangled symbol.
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 499ceae88d563..26e56af402234 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -687,7 +687,7 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
// Only do MSVC C++ demangling on symbols starting with '?'.
int status = 0;
char *DemangledName = microsoftDemangle(
- Name.c_str(), nullptr, nullptr, nullptr, &status,
+ Name.c_str(), nullptr, &status,
MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
MSDF_NoMemberType | MSDF_NoReturnType));
if (status != 0)
diff --git a/llvm/lib/Demangle/Demangle.cpp b/llvm/lib/Demangle/Demangle.cpp
index 9d128424cabf4..68eddde056021 100644
--- a/llvm/lib/Demangle/Demangle.cpp
+++ b/llvm/lib/Demangle/Demangle.cpp
@@ -36,8 +36,7 @@ std::string llvm::demangle(const std::string &MangledName) {
if (S[0] == '_' && nonMicrosoftDemangle(S + 1, Result))
return Result;
- if (char *Demangled =
- microsoftDemangle(S, nullptr, nullptr, nullptr, nullptr)) {
+ if (char *Demangled = microsoftDemangle(S, nullptr, nullptr)) {
Result = Demangled;
std::free(Demangled);
return Result;
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 828350076ba5e..c3713a7dbd3ad 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2398,7 +2398,6 @@ void Demangler::dumpBackReferences() {
}
char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
- char *Buf, size_t *N,
int *Status, MSDemangleFlags Flags) {
Demangler D;
@@ -2423,14 +2422,13 @@ char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
OF = OutputFlags(OF | OF_NoVariableType);
int InternalStatus = demangle_success;
+ char *Buf;
if (D.Error)
InternalStatus = demangle_invalid_mangled_name;
else {
- OutputBuffer OB(Buf, N);
+ OutputBuffer OB;
AST->output(OB, OF);
OB += '\0';
- if (N != nullptr)
- *N = OB.getCurrentPosition();
Buf = OB.getBuffer();
}
diff --git a/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp b/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
index 64dd483789d23..12fb1e41d9de3 100644
--- a/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
+++ b/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp
@@ -14,7 +14,6 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
std::string NullTerminatedString((const char *)Data, Size);
- free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr,
- nullptr, nullptr));
+ free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr));
return 0;
}
diff --git a/llvm/tools/llvm-objdump/COFFDump.cpp b/llvm/tools/llvm-objdump/COFFDump.cpp
index 3bc7d3ce33b06..c608460e39cf3 100644
--- a/llvm/tools/llvm-objdump/COFFDump.cpp
+++ b/llvm/tools/llvm-objdump/COFFDump.cpp
@@ -849,8 +849,7 @@ void objdump::printCOFFSymbolTable(const COFFObjectFile &coff) {
<< Name;
if (Demangle && Name.startswith("?")) {
int Status = -1;
- char *DemangledSymbol =
- microsoftDemangle(Name.data(), nullptr, nullptr, nullptr, &Status);
+ char *DemangledSymbol = microsoftDemangle(Name.data(), nullptr, &Status);
if (Status == 0 && DemangledSymbol) {
outs() << " (" << StringRef(DemangledSymbol) << ")";
diff --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index 674a290f6a3fe..915ae219d7649 100644
--- a/llvm/tools/llvm-undname/llvm-undname.cpp
+++ b/llvm/tools/llvm-undname/llvm-undname.cpp
@@ -75,8 +75,7 @@ static bool msDemangle(const std::string &S) {
Flags = MSDemangleFlags(Flags | MSDF_NoVariableType);
size_t NRead;
- char *ResultBuf =
- microsoftDemangle(S.c_str(), &NRead, nullptr, nullptr, &Status, Flags);
+ char *ResultBuf = microsoftDemangle(S.c_str(), &NRead, &Status, Flags);
if (Status == llvm::demangle_success) {
outs() << ResultBuf << "\n";
outs().flush();
More information about the llvm-commits
mailing list