[llvm] 028f70d - [ItaniumDemangle] Add Named flag to "pm" operator (#136862)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 12:56:11 PDT 2025
Author: Michael Buch
Date: 2025-05-12T15:56:07-04:00
New Revision: 028f70d2524be56bb5d191ec3d7022b40bc4859b
URL: https://github.com/llvm/llvm-project/commit/028f70d2524be56bb5d191ec3d7022b40bc4859b
DIFF: https://github.com/llvm/llvm-project/commit/028f70d2524be56bb5d191ec3d7022b40bc4859b.diff
LOG: [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.
Added:
Modified:
libcxxabi/src/demangle/ItaniumDemangle.h
libcxxabi/test/test_demangle.pass.cpp
llvm/include/llvm/Demangle/ItaniumDemangle.h
Removed:
################################################################################
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index 5baafd2ae0d0b..6acefeea8484b 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -3421,7 +3421,7 @@ const typename AbstractManglingParser<
{"or", OperatorInfo::Binary, false, Node::Prec::Ior, "operator|"},
{"pL", OperatorInfo::Binary, false, Node::Prec::Assign, "operator+="},
{"pl", OperatorInfo::Binary, false, Node::Prec::Additive, "operator+"},
- {"pm", OperatorInfo::Member, /*Named*/ false, Node::Prec::PtrMem,
+ {"pm", OperatorInfo::Member, /*Named*/ true, Node::Prec::PtrMem,
"operator->*"},
{"pp", OperatorInfo::Postfix, false, Node::Prec::Postfix, "operator++"},
{"ps", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator+"},
diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp
index 343885da3017a..8e85f53f08a8c 100644
--- a/libcxxabi/test/test_demangle.pass.cpp
+++ b/libcxxabi/test/test_demangle.pass.cpp
@@ -30248,6 +30248,8 @@ const char* cases[][2] = {
{"_Z3fooPU9__ptrauthILj3ELb1ELj234EEPi", "foo(int* __ptrauth<3u, true, 234u>*)"},
{"_Z3fooIPU9__ptrauthILj1ELb0ELj64EEPiEvT_", "void foo<int* __ptrauth<1u, false, 64u>*>(int* __ptrauth<1u, false, 64u>*)"},
+
+ {"_ZN1CpmEi", "C::operator->*(int)"},
// clang-format on
};
@@ -30293,7 +30295,7 @@ const unsigned NF = sizeof(fp_literal_cases) / sizeof(fp_literal_cases[0]);
const unsigned NEF = sizeof(fp_literal_cases[0].expecting) /
sizeof(fp_literal_cases[0].expecting[0]);
-const char *invalid_cases[] = {
+const char* invalid_cases[] = {
// clang-format off
"_ZIPPreEncode",
"Agentt",
@@ -30351,6 +30353,8 @@ const char *invalid_cases[] = {
"_ZGI3Foo",
"_ZGIW3Foov",
"W1x",
+ "_ZN1CdtEi",
+ "_ZN1CdsEi",
// clang-format on
};
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 67d6152c747dd..295c12ab24916 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -3421,7 +3421,7 @@ const typename AbstractManglingParser<
{"or", OperatorInfo::Binary, false, Node::Prec::Ior, "operator|"},
{"pL", OperatorInfo::Binary, false, Node::Prec::Assign, "operator+="},
{"pl", OperatorInfo::Binary, false, Node::Prec::Additive, "operator+"},
- {"pm", OperatorInfo::Member, /*Named*/ false, Node::Prec::PtrMem,
+ {"pm", OperatorInfo::Member, /*Named*/ true, Node::Prec::PtrMem,
"operator->*"},
{"pp", OperatorInfo::Postfix, false, Node::Prec::Postfix, "operator++"},
{"ps", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator+"},
More information about the llvm-commits
mailing list