This is a small fix for Bug 67299, where symbol: `Z1fCf` which would become
`f(float complex)` instead of `f(floatcomplex )`.
I thought this would be the preferred way of printing, because both
`llvm-cxxfilt` and `cpp_filt` both print the the mangled name in this
fashion.

Thanks,
Miguel Saldivar

>From 4ca98c0749bae1389594b31ee7f6ef575aafcd8f Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarc...@gmail.com>
Date: Thu, 17 Oct 2019 16:36:19 -0700
Subject: [PATCH][Demangler] Small fix for complex values

gcc/libiberty/
* cp-demangle.c (d_print_mod): Add a space before printing `complex`
and `imaginary`, as opposed to after.

gcc/libiberty/
* testsuite/demangle-expected: Adjust test.
---
 libiberty/ChangeLog                   | 5 +++++
 libiberty/cp-demangle.c               | 4 ++--
 libiberty/testsuite/demangle-expected | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 97d9767c2ea..62d5527b95b 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-17  Miguel Saldivar  <saldivarc...@gmail.com>
+ * cp-demangle.c (d_print_mod): Add a space before printing `complex`
+ and `imaginary`, as opposed to after.
+ * testsuite/demangle-expected: Adjust test.
+
 2019-10-03  Eduard-Mihai Burtescu  <ed...@lyken.rs>

  * rust-demangle.c (looks_like_rust): Remove.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index aa78c86dd44..bd4dfb785a9 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -5977,10 +5977,10 @@ d_print_mod (struct d_print_info *dpi, int options,
       d_append_string (dpi, "&&");
       return;
     case DEMANGLE_COMPONENT_COMPLEX:
-      d_append_string (dpi, "complex ");
+      d_append_string (dpi, " complex");
       return;
     case DEMANGLE_COMPONENT_IMAGINARY:
-      d_append_string (dpi, "imaginary ");
+      d_append_string (dpi, " imaginary");
       return;
     case DEMANGLE_COMPONENT_PTRMEM_TYPE:
       if (d_last_char (dpi) != '(')
diff --git a/libiberty/testsuite/demangle-expected
b/libiberty/testsuite/demangle-expected
index f21ed00e559..43f003655b2 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof
((*((Y*)(0)))+(*((Y*)(0))))>*)
 #
 --format=gnu-v3
 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
-void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
+void baz<int>(A<sizeof (foo((int)(), (float complex)00000000_00000000))>*)
 #
 --format=gnu-v3
 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
--
2.23.0

Reply via email to