public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4462] [PATCH] d-demangle: properly skip anonymous symbols
@ 2021-10-17 22:38 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2021-10-17 22:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fb5b0778586674c31f69d866038a5b5bd9a151ee

commit r12-4462-gfb5b0778586674c31f69d866038a5b5bd9a151ee
Author: Luís Ferreira <contact@lsferreira.net>
Date:   Sun Oct 17 18:34:25 2021 -0400

    [PATCH] d-demangle: properly skip anonymous symbols
    
    libiberty/
            PR d/102618
            * d-demangle.c (dlang_parse_qualified): Handle anonymous
            symbols correctly.
    
            * testsuite/d-demangle-expected: New tests to cover anonymous
            symbols.

Diff:
---
 libiberty/d-demangle.c                  | 14 ++++++++++----
 libiberty/testsuite/d-demangle-expected |  8 ++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 880f2ec85a4..6c7ac5a14fd 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -1650,13 +1650,19 @@ dlang_parse_qualified (string *decl, const char *mangled,
   size_t n = 0;
   do
     {
+      /* Skip over anonymous symbols.  */
+      if (*mangled == '0')
+      {
+	do
+	  mangled++;
+	while (*mangled == '0');
+
+	continue;
+      }
+
       if (n++)
 	string_append (decl, ".");
 
-      /* Skip over anonymous symbols.  */
-      while (*mangled == '0')
-	mangled++;
-
       mangled = dlang_identifier (decl, mangled, info);
 
       /* Consume the encoded arguments.  However if this is not followed by the
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index e1b296ff0b0..47b059c4298 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -1462,3 +1462,11 @@ mod.func().nested!(int).nested()
 --format=dlang
 _D6mangle__T8fun21753VSQv6S21753S1f_DQBj10__lambda71MFNaNbNiNfZvZQCbQp
 mangle.fun21753!(mangle.S21753(mangle.__lambda71())).fun21753
+#
+--format=dlang
+_D8demangle9anonymous0Z
+demangle.anonymous
+#
+--format=dlang
+_D8demangle9anonymous03fooZ
+demangle.anonymous.foo


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-17 22:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-17 22:38 [gcc r12-4462] [PATCH] d-demangle: properly skip anonymous symbols Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).