Skip to content

Commit c91fab5

Browse files
committed
Revert "[llvm-cxxfilt] Added the option --no-params (#75348)"
This reverts commit 71f8ea3. Test doesn't pass on mac. See comments on #75348.
1 parent 1fa18fe commit c91fab5

File tree

9 files changed

+21
-87
lines changed

9 files changed

+21
-87
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
27942794
Node *parseClassEnumType();
27952795
Node *parseQualifiedType();
27962796

2797-
Node *parseEncoding(bool ParseParams = true);
2797+
Node *parseEncoding();
27982798
bool parseCallOffset();
27992799
Node *parseSpecialName();
28002800

@@ -2911,7 +2911,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
29112911
Node *parseDestructorName();
29122912

29132913
/// Top-level entry point into the parser.
2914-
Node *parse(bool ParseParams = true);
2914+
Node *parse();
29152915
};
29162916

29172917
const char* parse_discriminator(const char* first, const char* last);
@@ -5405,7 +5405,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() {
54055405
// ::= <data name>
54065406
// ::= <special-name>
54075407
template <typename Derived, typename Alloc>
5408-
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding(bool ParseParams) {
5408+
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
54095409
// The template parameters of an encoding are unrelated to those of the
54105410
// enclosing context.
54115411
SaveTemplateParams SaveTemplateParamsScope(this);
@@ -5431,16 +5431,6 @@ Node *AbstractManglingParser<Derived, Alloc>::parseEncoding(bool ParseParams) {
54315431
if (IsEndOfEncoding())
54325432
return Name;
54335433

5434-
// ParseParams may be false at the top level only, when called from parse().
5435-
// For example in the mangled name _Z3fooILZ3BarEET_f, ParseParams may be
5436-
// false when demangling 3fooILZ3BarEET_f but is always true when demangling
5437-
// 3Bar.
5438-
if (!ParseParams) {
5439-
while (consume())
5440-
;
5441-
return Name;
5442-
}
5443-
54445434
Node *Attrs = nullptr;
54455435
if (consumeIf("Ua9enable_ifI")) {
54465436
size_t BeforeArgs = Names.size();
@@ -5905,9 +5895,9 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
59055895
// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+
59065896
// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+
59075897
template <typename Derived, typename Alloc>
5908-
Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
5898+
Node *AbstractManglingParser<Derived, Alloc>::parse() {
59095899
if (consumeIf("_Z") || consumeIf("__Z")) {
5910-
Node *Encoding = getDerived().parseEncoding(ParseParams);
5900+
Node *Encoding = getDerived().parseEncoding();
59115901
if (Encoding == nullptr)
59125902
return nullptr;
59135903
if (look() == '.') {
@@ -5921,7 +5911,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
59215911
}
59225912

59235913
if (consumeIf("___Z") || consumeIf("____Z")) {
5924-
Node *Encoding = getDerived().parseEncoding(ParseParams);
5914+
Node *Encoding = getDerived().parseEncoding();
59255915
if (Encoding == nullptr || !consumeIf("_block_invoke"))
59265916
return nullptr;
59275917
bool RequireNumber = consumeIf('_');

llvm/docs/CommandGuide/llvm-cxxfilt.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ OPTIONS
4848

4949
Print a summary of command line options.
5050

51-
.. option:: --no-params, -p
52-
53-
Do not demangle function parameters or return types.
54-
5551
.. option:: --no-strip-underscore, -n
5652

5753
Do not strip a leading underscore. This is the default for all platforms

llvm/include/llvm/Demangle/Demangle.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum : int {
3232
/// Returns a non-NULL pointer to a NUL-terminated C style string
3333
/// that should be explicitly freed, if successful. Otherwise, may return
3434
/// nullptr if mangled_name is not a valid mangling or is nullptr.
35-
char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true);
35+
char *itaniumDemangle(std::string_view mangled_name);
3636

3737
enum MSDemangleFlags {
3838
MSDF_None = 0,
@@ -68,8 +68,7 @@ char *dlangDemangle(std::string_view MangledName);
6868
std::string demangle(std::string_view MangledName);
6969

7070
bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
71-
bool CanHaveLeadingDot = true,
72-
bool ParseParams = true);
71+
bool CanHaveLeadingDot = true);
7372

7473
/// "Partial" demangler. This supports demangling a string into an AST
7574
/// (typically an intermediate stage in itaniumDemangle) and querying certain

llvm/include/llvm/Demangle/ItaniumDemangle.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
27932793
Node *parseClassEnumType();
27942794
Node *parseQualifiedType();
27952795

2796-
Node *parseEncoding(bool ParseParams = true);
2796+
Node *parseEncoding();
27972797
bool parseCallOffset();
27982798
Node *parseSpecialName();
27992799

@@ -2910,7 +2910,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
29102910
Node *parseDestructorName();
29112911

29122912
/// Top-level entry point into the parser.
2913-
Node *parse(bool ParseParams = true);
2913+
Node *parse();
29142914
};
29152915

29162916
const char* parse_discriminator(const char* first, const char* last);
@@ -5404,7 +5404,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() {
54045404
// ::= <data name>
54055405
// ::= <special-name>
54065406
template <typename Derived, typename Alloc>
5407-
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding(bool ParseParams) {
5407+
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
54085408
// The template parameters of an encoding are unrelated to those of the
54095409
// enclosing context.
54105410
SaveTemplateParams SaveTemplateParamsScope(this);
@@ -5430,16 +5430,6 @@ Node *AbstractManglingParser<Derived, Alloc>::parseEncoding(bool ParseParams) {
54305430
if (IsEndOfEncoding())
54315431
return Name;
54325432

5433-
// ParseParams may be false at the top level only, when called from parse().
5434-
// For example in the mangled name _Z3fooILZ3BarEET_f, ParseParams may be
5435-
// false when demangling 3fooILZ3BarEET_f but is always true when demangling
5436-
// 3Bar.
5437-
if (!ParseParams) {
5438-
while (consume())
5439-
;
5440-
return Name;
5441-
}
5442-
54435433
Node *Attrs = nullptr;
54445434
if (consumeIf("Ua9enable_ifI")) {
54455435
size_t BeforeArgs = Names.size();
@@ -5904,9 +5894,9 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
59045894
// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+
59055895
// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+
59065896
template <typename Derived, typename Alloc>
5907-
Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
5897+
Node *AbstractManglingParser<Derived, Alloc>::parse() {
59085898
if (consumeIf("_Z") || consumeIf("__Z")) {
5909-
Node *Encoding = getDerived().parseEncoding(ParseParams);
5899+
Node *Encoding = getDerived().parseEncoding();
59105900
if (Encoding == nullptr)
59115901
return nullptr;
59125902
if (look() == '.') {
@@ -5920,7 +5910,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
59205910
}
59215911

59225912
if (consumeIf("___Z") || consumeIf("____Z")) {
5923-
Node *Encoding = getDerived().parseEncoding(ParseParams);
5913+
Node *Encoding = getDerived().parseEncoding();
59245914
if (Encoding == nullptr || !consumeIf("_block_invoke"))
59255915
return nullptr;
59265916
bool RequireNumber = consumeIf('_');

llvm/lib/Demangle/Demangle.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ static bool isRustEncoding(std::string_view S) { return starts_with(S, "_R"); }
4747
static bool isDLangEncoding(std::string_view S) { return starts_with(S, "_D"); }
4848

4949
bool llvm::nonMicrosoftDemangle(std::string_view MangledName,
50-
std::string &Result, bool CanHaveLeadingDot,
51-
bool ParseParams) {
50+
std::string &Result, bool CanHaveLeadingDot) {
5251
char *Demangled = nullptr;
5352

5453
// Do not consider the dot prefix as part of the demangled symbol name.
@@ -58,7 +57,7 @@ bool llvm::nonMicrosoftDemangle(std::string_view MangledName,
5857
}
5958

6059
if (isItaniumEncoding(MangledName))
61-
Demangled = itaniumDemangle(MangledName, ParseParams);
60+
Demangled = itaniumDemangle(MangledName);
6261
else if (isRustEncoding(MangledName))
6362
Demangled = rustDemangle(MangledName);
6463
else if (isDLangEncoding(MangledName))

llvm/lib/Demangle/ItaniumDemangle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ class DefaultAllocator {
366366

367367
using Demangler = itanium_demangle::ManglingParser<DefaultAllocator>;
368368

369-
char *llvm::itaniumDemangle(std::string_view MangledName, bool ParseParams) {
369+
char *llvm::itaniumDemangle(std::string_view MangledName) {
370370
if (MangledName.empty())
371371
return nullptr;
372372

373373
Demangler Parser(MangledName.data(),
374374
MangledName.data() + MangledName.length());
375-
Node *AST = Parser.parse(ParseParams);
375+
Node *AST = Parser.parse();
376376
if (!AST)
377377
return nullptr;
378378

llvm/test/tools/llvm-cxxfilt/no-params.test

Lines changed: 0 additions & 34 deletions
This file was deleted.

llvm/tools/llvm-cxxfilt/Opts.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ multiclass Eq<string name, string help> {
1717
def help : FF<"help", "Display this help">;
1818
defm strip_underscore : BB<"strip-underscore", "Strip the leading underscore", "Don't strip the leading underscore">;
1919
def types : FF<"types", "Attempt to demangle types as well as function names">;
20-
def no_params : FF<"no-params", "Skip function parameters and return types">;
2120
def version : FF<"version", "Display the version">;
2221

2322
defm : Eq<"format", "Specify mangling format. Currently ignored because only 'gnu' is supported">;
@@ -26,5 +25,4 @@ def : F<"s", "Alias for --format">;
2625
def : F<"_", "Alias for --strip-underscore">, Alias<strip_underscore>;
2726
def : F<"h", "Alias for --help">, Alias<help>;
2827
def : F<"n", "Alias for --no-strip-underscore">, Alias<no_strip_underscore>;
29-
def : F<"p", "Alias for --no-params">, Alias<no_params>;
3028
def : F<"t", "Alias for --types">, Alias<types>;

llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class CxxfiltOptTable : public opt::GenericOptTable {
5454
};
5555
} // namespace
5656

57-
static bool ParseParams;
5857
static bool StripUnderscore;
5958
static bool Types;
6059

@@ -75,19 +74,18 @@ static std::string demangle(const std::string &Mangled) {
7574
}
7675

7776
std::string Result;
78-
if (nonMicrosoftDemangle(DecoratedStr, Result, CanHaveLeadingDot,
79-
ParseParams))
77+
if (nonMicrosoftDemangle(DecoratedStr, Result, CanHaveLeadingDot))
8078
return Result;
8179

8280
std::string Prefix;
8381
char *Undecorated = nullptr;
8482

8583
if (Types)
86-
Undecorated = itaniumDemangle(DecoratedStr, ParseParams);
84+
Undecorated = itaniumDemangle(DecoratedStr);
8785

8886
if (!Undecorated && starts_with(DecoratedStr, "__imp_")) {
8987
Prefix = "import thunk for ";
90-
Undecorated = itaniumDemangle(DecoratedStr.substr(6), ParseParams);
88+
Undecorated = itaniumDemangle(DecoratedStr.substr(6));
9189
}
9290

9391
Result = Undecorated ? Prefix + Undecorated : Mangled;
@@ -175,8 +173,6 @@ int llvm_cxxfilt_main(int argc, char **argv, const llvm::ToolContext &) {
175173
else
176174
StripUnderscore = Triple(sys::getProcessTriple()).isOSBinFormatMachO();
177175

178-
ParseParams = !Args.hasArg(OPT_no_params);
179-
180176
Types = Args.hasArg(OPT_types);
181177

182178
std::vector<std::string> Decorated = Args.getAllArgValues(OPT_INPUT);

0 commit comments

Comments
 (0)