Skip to content

Commit 028f70d

Browse files
authored
[ItaniumDemangle] Add Named flag to "pm" operator (#136862)
Compilers can generate mangled names such as `_ZN1CpmEi` which we currently fail to demangle. The OperatorInfo table only marked the `pt` operator as being "named", which prevented the others from demangling properly. Removing this logic for the other kinds of member operators isn't causing any tests to fail.
1 parent b233c5f commit 028f70d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3421,7 +3421,7 @@ const typename AbstractManglingParser<
34213421
{"or", OperatorInfo::Binary, false, Node::Prec::Ior, "operator|"},
34223422
{"pL", OperatorInfo::Binary, false, Node::Prec::Assign, "operator+="},
34233423
{"pl", OperatorInfo::Binary, false, Node::Prec::Additive, "operator+"},
3424-
{"pm", OperatorInfo::Member, /*Named*/ false, Node::Prec::PtrMem,
3424+
{"pm", OperatorInfo::Member, /*Named*/ true, Node::Prec::PtrMem,
34253425
"operator->*"},
34263426
{"pp", OperatorInfo::Postfix, false, Node::Prec::Postfix, "operator++"},
34273427
{"ps", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator+"},

libcxxabi/test/test_demangle.pass.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30248,6 +30248,8 @@ const char* cases[][2] = {
3024830248

3024930249
{"_Z3fooPU9__ptrauthILj3ELb1ELj234EEPi", "foo(int* __ptrauth<3u, true, 234u>*)"},
3025030250
{"_Z3fooIPU9__ptrauthILj1ELb0ELj64EEPiEvT_", "void foo<int* __ptrauth<1u, false, 64u>*>(int* __ptrauth<1u, false, 64u>*)"},
30251+
30252+
{"_ZN1CpmEi", "C::operator->*(int)"},
3025130253
// clang-format on
3025230254
};
3025330255

@@ -30293,7 +30295,7 @@ const unsigned NF = sizeof(fp_literal_cases) / sizeof(fp_literal_cases[0]);
3029330295
const unsigned NEF = sizeof(fp_literal_cases[0].expecting) /
3029430296
sizeof(fp_literal_cases[0].expecting[0]);
3029530297

30296-
const char *invalid_cases[] = {
30298+
const char* invalid_cases[] = {
3029730299
// clang-format off
3029830300
"_ZIPPreEncode",
3029930301
"Agentt",
@@ -30351,6 +30353,8 @@ const char *invalid_cases[] = {
3035130353
"_ZGI3Foo",
3035230354
"_ZGIW3Foov",
3035330355
"W1x",
30356+
"_ZN1CdtEi",
30357+
"_ZN1CdsEi",
3035430358
// clang-format on
3035530359
};
3035630360

llvm/include/llvm/Demangle/ItaniumDemangle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3421,7 +3421,7 @@ const typename AbstractManglingParser<
34213421
{"or", OperatorInfo::Binary, false, Node::Prec::Ior, "operator|"},
34223422
{"pL", OperatorInfo::Binary, false, Node::Prec::Assign, "operator+="},
34233423
{"pl", OperatorInfo::Binary, false, Node::Prec::Additive, "operator+"},
3424-
{"pm", OperatorInfo::Member, /*Named*/ false, Node::Prec::PtrMem,
3424+
{"pm", OperatorInfo::Member, /*Named*/ true, Node::Prec::PtrMem,
34253425
"operator->*"},
34263426
{"pp", OperatorInfo::Postfix, false, Node::Prec::Postfix, "operator++"},
34273427
{"ps", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator+"},

0 commit comments

Comments
 (0)