[demangler] Fold expressions of .* and ->*

(Exitingly) a fold expression's operators include .* and ->*, but we
failed to demangle them as we categorize those as MemberExprs, not
BinaryExprs.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D123305
This commit is contained in:
Nathan Sidwell 2022-02-18 11:06:58 -08:00
parent eac22d0754
commit ed2d4da732
3 changed files with 15 additions and 2 deletions

View File

@ -4447,7 +4447,11 @@ Node *AbstractManglingParser<Derived, Alloc>::parseFoldExpr() {
++First;
const auto *Op = parseOperatorEncoding();
if (!Op || Op->getKind() != OperatorInfo::Binary)
if (!Op)
return nullptr;
if (!(Op->getKind() == OperatorInfo::Binary
|| (Op->getKind() == OperatorInfo::Member
&& Op->getName().back() == '*')))
return nullptr;
Node *Pack = getDerived().parseExpr();

View File

@ -29963,6 +29963,8 @@ const char* cases[][2] =
"void Partial<1, 2>::foldr<3, 4>(A<1 + (2 + ((3, 4) + ... + (1 + (2 + ((3, 4) + ...)))))>)"},
{"_ZN7PartialIJLi1ELi2EEE5foldrIJLi3ELi4EEEEv1AIXplplLi1ELi2EfRplT_plplLi1ELi2EflplT_EE",
"void Partial<1, 2>::foldr<3, 4>(A<1 + 2 + ((3, 4) + ... + (1 + 2 + (... + (3, 4))))>)"},
{"_Z1fIXfLpm1x1yEEvv", "void f<(x ->* ... ->* (y...))>()"},
{"_Z1fIXfLds1x1yEEvv", "void f<(x .* ... .* (y...))>()"},
// reference collapsing:
{"_Z1fIR1SEiOT_", "int f<S&>(S&)"},
@ -30173,6 +30175,9 @@ const char* invalid_cases[] =
"_ZN1fIiEEvNTUt_E",
"_ZNDTUt_Ev",
"_Z1fIXfLpt1x1yEEvv",
"_Z1fIXfLdt1x1yEEvv",
"_ZN1fIXawLi0EEEEvv",
"_ZNWUt_3FOOEv",

View File

@ -4447,7 +4447,11 @@ Node *AbstractManglingParser<Derived, Alloc>::parseFoldExpr() {
++First;
const auto *Op = parseOperatorEncoding();
if (!Op || Op->getKind() != OperatorInfo::Binary)
if (!Op)
return nullptr;
if (!(Op->getKind() == OperatorInfo::Binary
|| (Op->getKind() == OperatorInfo::Member
&& Op->getName().back() == '*')))
return nullptr;
Node *Pack = getDerived().parseExpr();