This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/3] [D] libiberty: Prefix mangled D initializer symbols
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 26 May 2017 18:08:01 +0200
- Subject: [PATCH 3/3] [D] libiberty: Prefix mangled D initializer symbols
- Authentication-results: sourceware.org; auth=none
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