diff mbox

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

Message ID CABOHX+dH8k9ax=FuHaD=tXQ_EBg6dc1dPJ8raASm6LOufeWfPQ@mail.gmail.com
State New
Headers show

Commit Message

Iain Buclaw May 26, 2017, 4:08 p.m. UTC
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.

---

Comments

Li, Pan2 via Gcc-patches May 26, 2017, 6:20 p.m. UTC | #1
On Fri, May 26, 2017 at 9:08 AM, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> 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.

This is OK.

Thanks.

Ian
Iain Buclaw May 28, 2017, 8:18 a.m. UTC | #2
On 26 May 2017 at 20:20, Ian Lance Taylor <iant@google.com> wrote:
> On Fri, May 26, 2017 at 9:08 AM, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>> 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.
>
> This is OK.
>
> Thanks.
>
> Ian

Thanks, have committed this to trunk.

Regards
Iain
diff mbox

Patch

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