[PATCH] D123305: [demangler] Fold expressions of .* and ->*

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 04:43:43 PDT 2022


urnathan updated this revision to Diff 425180.
urnathan added a comment.

rebase & ping?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123305/new/

https://reviews.llvm.org/D123305

Files:
  libcxxabi/src/demangle/ItaniumDemangle.h
  libcxxabi/test/test_demangle.pass.cpp
  llvm/include/llvm/Demangle/ItaniumDemangle.h


Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -4447,7 +4447,11 @@
   ++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();
Index: libcxxabi/test/test_demangle.pass.cpp
===================================================================
--- libcxxabi/test/test_demangle.pass.cpp
+++ libcxxabi/test/test_demangle.pass.cpp
@@ -29962,6 +29962,8 @@
      "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&)"},
@@ -30172,6 +30174,9 @@
     "_ZN1fIiEEvNTUt_E",
     "_ZNDTUt_Ev",
 
+    "_Z1fIXfLpt1x1yEEvv",
+    "_Z1fIXfLdt1x1yEEvv",
+
     "_ZN1fIXawLi0EEEEvv",
 
     "_ZNWUt_3FOOEv",
Index: libcxxabi/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -4447,7 +4447,11 @@
   ++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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123305.425180.patch
Type: text/x-patch
Size: 2070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220426/f4c0a0e3/attachment.bin>


More information about the llvm-commits mailing list