This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/3] [D] libiberty: Prefix mangled D initializer symbols


This is instead of adding a `.init$' postfix, which gave it a
property-style name.  My rationale being that "initializer for symbol"
is much more informative when inspecting D runtime type information in
gdb, which is the only place where you would encounter references to
this compiler-generated symbol.

---
commit a99454b6c27a2564fe1a40c46b1fb593c664ef20
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Fri May 26 16:44:35 2017 +0200

    libiberty/ChangeLog:
    
    2017-05-26  Iain Buclaw  <ibuclaw@gdcproject.org>
    
            * d-demangle.c (dlang_identifier): Prefix mangled init symbols
            with `initializer for'.
            * testsuite/demangle-expected: Update tests.

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 829050bc0b8..08690de9bd3 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -864,7 +864,8 @@ dlang_identifier (string *decl, const char *mangled,
 	  else if (strncmp (mangled, "__initZ", len+1) == 0)
 	    {
 	      /* The static initialiser for a given symbol.  */
-	      string_append (decl, "init$");
+	      string_prepend (decl, "initializer for ");
+	      string_setlength (decl, string_length (decl) - 1);
 	      mangled += len;
 	      return mangled;
 	    }
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index 7bf8b1725f9..547a2ddec39 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -587,7 +587,7 @@ demangle.test(scope char() scope function)
 #
 --format=dlang
 _D8demangle4test6__initZ
-demangle.test.init$
+initializer for demangle.test
 #
 --format=dlang
 _D8demangle4test6__vtblZ

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]