public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: Add support for 'in' and 'in ref' storage classes.
@ 2020-08-07 11:32 Iain Buclaw
  2020-08-14  9:42 ` [PING][PATCH] " Iain Buclaw
  2020-08-25 20:40 ` [PATCH] " Jeff Law
  0 siblings, 2 replies; 3+ messages in thread
From: Iain Buclaw @ 2020-08-07 11:32 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch adds support for 'in' as a first-class storage class with its
own mangle symbol, of which also permits 'in ref'.  Previously, 'in' was
an alias to 'const [scope]', which is a type constructor.

The mangle symbol repurposed for this is 'I', which was originally used
by identifier types.  However, while TypeIdentifier is part of the
grammar, it must be resolved to some other entity during the semantic
passes, and so shouldn't appear anywhere in the mangled name.

OK for mainline?

Regards
Iain.

---
libiberty/ChangeLog:

	* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
	parameter storage classes.
	(dlang_type): Remove identifier type.
	* testsuite/d-demangle-expected: Update tests.
---
 libiberty/d-demangle.c                  | 10 +++++++++-
 libiberty/testsuite/d-demangle-expected | 16 ++++++++--------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index f2d6946ecad..2e52eff7617 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -699,6 +699,15 @@ dlang_function_args (string *decl, const char *mangled, struct dlang_info *info)
 
       switch (*mangled)
 	{
+	case 'I': /* in(T) */
+	  mangled++;
+	  string_append (decl, "in ");
+	  if (*mangled == 'K') /* in ref(T) */
+	    {
+	      mangled++;
+	      string_append (decl, "ref ");
+	    }
+	  break;
 	case 'J': /* out(T) */
 	  mangled++;
 	  string_append (decl, "out ");
@@ -826,7 +835,6 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
       mangled = dlang_function_type (decl, mangled, info);
       string_append (decl, "function");
       return mangled;
-    case 'I': /* ident T */
     case 'C': /* class T */
     case 'S': /* struct T */
     case 'E': /* enum T */
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index e3f32e31d7b..ffb317f23d4 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -274,14 +274,6 @@ _D8demangle4testFNhG4dZv
 demangle.test(__vector(double[4]))
 #
 --format=dlang
-_D8demangle4testFI5identZv
-demangle.test(ident)
-#
---format=dlang
-_D8demangle4testFI5ident4testZv
-demangle.test(ident.test)
-#
---format=dlang
 _D8demangle4testFC5classZv
 demangle.test(class)
 #
@@ -314,6 +306,14 @@ _D8demangle4testFT7typedef4testZv
 demangle.test(typedef.test)
 #
 --format=dlang
+_D8demangle4testFIaZv
+demangle.test(in char)
+#
+--format=dlang
+_D8demangle4testFIKaZv
+demangle.test(in ref char)
+#
+--format=dlang
 _D8demangle4testFJaZv
 demangle.test(out char)
 #
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PING][PATCH] libiberty: Add support for 'in' and 'in ref' storage classes.
  2020-08-07 11:32 [PATCH] libiberty: Add support for 'in' and 'in ref' storage classes Iain Buclaw
@ 2020-08-14  9:42 ` Iain Buclaw
  2020-08-25 20:40 ` [PATCH] " Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Iain Buclaw @ 2020-08-14  9:42 UTC (permalink / raw)
  To: gcc-patches

Ping.

Though I will hold back on supporting 'in ref' until it has been formalized.
Current discussions are around what value might it have over 'ref const scope'
(so far, none).

Iain.

On 07/08/2020 13:32, Iain Buclaw wrote:
> Hi,
> 
> This patch adds support for 'in' as a first-class storage class with its
> own mangle symbol, of which also permits 'in ref'.  Previously, 'in' was
> an alias to 'const [scope]', which is a type constructor.
> 
> The mangle symbol repurposed for this is 'I', which was originally used
> by identifier types.  However, while TypeIdentifier is part of the
> grammar, it must be resolved to some other entity during the semantic
> passes, and so shouldn't appear anywhere in the mangled name.
> 
> OK for mainline?
> 
> Regards
> Iain.
> 
> ---
> libiberty/ChangeLog:
> 
> 	* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
> 	parameter storage classes.
> 	(dlang_type): Remove identifier type.
> 	* testsuite/d-demangle-expected: Update tests.
> ---
>  libiberty/d-demangle.c                  | 10 +++++++++-
>  libiberty/testsuite/d-demangle-expected | 16 ++++++++--------
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
> index f2d6946ecad..2e52eff7617 100644
> --- a/libiberty/d-demangle.c
> +++ b/libiberty/d-demangle.c
> @@ -699,6 +699,15 @@ dlang_function_args (string *decl, const char *mangled, struct dlang_info *info)
>  
>        switch (*mangled)
>  	{
> +	case 'I': /* in(T) */
> +	  mangled++;
> +	  string_append (decl, "in ");
> +	  if (*mangled == 'K') /* in ref(T) */
> +	    {
> +	      mangled++;
> +	      string_append (decl, "ref ");
> +	    }
> +	  break;
>  	case 'J': /* out(T) */
>  	  mangled++;
>  	  string_append (decl, "out ");
> @@ -826,7 +835,6 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
>        mangled = dlang_function_type (decl, mangled, info);
>        string_append (decl, "function");
>        return mangled;
> -    case 'I': /* ident T */
>      case 'C': /* class T */
>      case 'S': /* struct T */
>      case 'E': /* enum T */
> diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
> index e3f32e31d7b..ffb317f23d4 100644
> --- a/libiberty/testsuite/d-demangle-expected
> +++ b/libiberty/testsuite/d-demangle-expected
> @@ -274,14 +274,6 @@ _D8demangle4testFNhG4dZv
>  demangle.test(__vector(double[4]))
>  #
>  --format=dlang
> -_D8demangle4testFI5identZv
> -demangle.test(ident)
> -#
> ---format=dlang
> -_D8demangle4testFI5ident4testZv
> -demangle.test(ident.test)
> -#
> ---format=dlang
>  _D8demangle4testFC5classZv
>  demangle.test(class)
>  #
> @@ -314,6 +306,14 @@ _D8demangle4testFT7typedef4testZv
>  demangle.test(typedef.test)
>  #
>  --format=dlang
> +_D8demangle4testFIaZv
> +demangle.test(in char)
> +#
> +--format=dlang
> +_D8demangle4testFIKaZv
> +demangle.test(in ref char)
> +#
> +--format=dlang
>  _D8demangle4testFJaZv
>  demangle.test(out char)
>  #
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libiberty: Add support for 'in' and 'in ref' storage classes.
  2020-08-07 11:32 [PATCH] libiberty: Add support for 'in' and 'in ref' storage classes Iain Buclaw
  2020-08-14  9:42 ` [PING][PATCH] " Iain Buclaw
@ 2020-08-25 20:40 ` Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2020-08-25 20:40 UTC (permalink / raw)
  To: Iain Buclaw, gcc-patches

On Fri, 2020-08-07 at 13:32 +0200, Iain Buclaw via Gcc-patches wrote:
> Hi,
> 
> This patch adds support for 'in' as a first-class storage class with its
> own mangle symbol, of which also permits 'in ref'.  Previously, 'in' was
> an alias to 'const [scope]', which is a type constructor.
> 
> The mangle symbol repurposed for this is 'I', which was originally used
> by identifier types.  However, while TypeIdentifier is part of the
> grammar, it must be resolved to some other entity during the semantic
> passes, and so shouldn't appear anywhere in the mangled name.
> 
> OK for mainline?
> 
> Regards
> Iain.
> 
> ---
> libiberty/ChangeLog:
> 
> 	* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
> 	parameter storage classes.
> 	(dlang_type): Remove identifier type.
> 	* testsuite/d-demangle-expected: Update tests.
OK
jeff
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-25 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 11:32 [PATCH] libiberty: Add support for 'in' and 'in ref' storage classes Iain Buclaw
2020-08-14  9:42 ` [PING][PATCH] " Iain Buclaw
2020-08-25 20:40 ` [PATCH] " 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).