diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-05-12 20:56:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-12 15:56:07 -0400 |
commit | 028f70d2524be56bb5d191ec3d7022b40bc4859b (patch) | |
tree | 44b1c22ef5f77f0c7b1895dace6175766d4c2065 | |
parent | b233c5fbe0af0daab426e8c9b1949c45d04749a5 (diff) | |
download | llvm-028f70d2524be56bb5d191ec3d7022b40bc4859b.zip llvm-028f70d2524be56bb5d191ec3d7022b40bc4859b.tar.gz llvm-028f70d2524be56bb5d191ec3d7022b40bc4859b.tar.bz2 |
[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.
-rw-r--r-- | libcxxabi/src/demangle/ItaniumDemangle.h | 2 | ||||
-rw-r--r-- | libcxxabi/test/test_demangle.pass.cpp | 6 | ||||
-rw-r--r-- | llvm/include/llvm/Demangle/ItaniumDemangle.h | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h index 5baafd2..6acefee 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 343885d..8e85f53 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 67d6152..295c12a 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+"}, |