godump.c (go_output_typedef): When outputting a typedef...

gcc/:
        * godump.c (go_output_typedef): When outputting a typedef, refer
	to the underlying type by its name and not its structure.
gcc/testsuite:
        * gcc.misc-tests/godump-1.c: Add test case for typedef before
	struct.

From-SVN: r267958
This commit is contained in:
Nikhil Benesch 2019-01-15 23:54:37 +00:00 committed by Ian Lance Taylor
parent 1abb44f863
commit 5686a6b7a6
4 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2019-01-15 Nikhil Benesch <nikhil.benesch@gmail.com>
* godump.c (go_output_typedef): When outputting a typedef, refer
to the underlying type by its name and not its structure.
2019-01-15 David Malcolm <dmalcolm@redhat.com>
PR c++/88795

View file

@ -1181,7 +1181,7 @@ go_output_typedef (struct godump_container *container, tree decl)
return;
*slot = CONST_CAST (void *, (const void *) type);
if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL,
if (!go_format_type (container, TREE_TYPE (decl), true, false, NULL,
false))
{
fprintf (go_dump_file, "// ");

View file

@ -1,3 +1,8 @@
2019-01-15 Nikhil Benesch <nikhil.benesch@gmail.com>
* gcc.misc-tests/godump-1.c: Add test case for typedef before
struct.
2019-01-15 David Malcolm <dmalcolm@redhat.com>
PR c++/88795

View file

@ -468,6 +468,11 @@ struct { double d; uint8_t : 0; } sd_not_equiv;
typedef struct s_undef_t s_undef_t2;
typedef struct s_fwd *s_fwd_p;
/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd_p \\*_s_fwd$" } } */
struct s_fwd { };
/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd struct \{ \}$" } } */
/*** nested structs ***/
typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn;