aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2019-05-28 13:31:16 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2019-05-28 13:31:16 +0000
commit7daef9aceb80787d9fd64b4e110b175b4d9e5a9e (patch)
treee8ff7e7170740fbcd3cf83d7662f6be7b2bf2ee0 /gcc/d
parent3253d4f0266fb7aa4e70cf6afcfac9b690cfed4a (diff)
downloadgcc-7daef9aceb80787d9fd64b4e110b175b4d9e5a9e.zip
gcc-7daef9aceb80787d9fd64b4e110b175b4d9e5a9e.tar.gz
gcc-7daef9aceb80787d9fd64b4e110b175b4d9e5a9e.tar.bz2
[PATCH] Commonize anon-name generation
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01699.html * tree.h (IDENTIFIER_ANON_P): New. (anon_aggrname_format, anon_aggname_p): Don't declare. (make_anon_name): Declare. * lto-streamer-out.c (DFS::DFS_write_tree_body): Use IDENTIFIER_ANON_P. (hash_tree): Likewise. * tree-streamer-out.c (write_ts_decl_minimal_tree): Likewise. * tree.c (anon_aggrname_p, anon_aggrname_format): Delete. (anon_cnt, make_anon_name): New. gcc/cp/ * cp-tree.h (make_anon_name): Drop declaration. (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P. * cp-lang.c (cxx_dwarf_name): Likewise. * class.c (find_flexarrays): Likewise. * decl.c (name_unnamed_type, xref_tag_1): Likewise. * error.c (dump_aggr_type): Likewise. * pt.c (push_template_decl_real): Likewise. * name-lookup.c (consider_binding_level): Likewise. (anon_cnt, make_anon_name): Delete. gcc/d/ * types.cc (fixup_anonymous_offset): Use IDENTIFIER_ANON_P. (layout_aggregate_members): Use make_anon_name. From-SVN: r271702
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/ChangeLog5
-rw-r--r--gcc/d/types.cc9
2 files changed, 7 insertions, 7 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index b6ac2f8..800dcb0 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-24 Nathan Sidwell <nathan@acm.org>
+
+ * types.cc (fixup_anonymous_offset): Use IDENTIFIER_ANON_P.
+ (layout_aggregate_members): Use make_anon_name.
+
2019-05-16 Martin Sebor <msebor@redhat.com>
* d-builtins.cc (d_init_builtins): Quote keywords, operators,
diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index cdbfbb7..8f0aa37 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -239,7 +239,7 @@ fixup_anonymous_offset (tree fields, tree offset)
/* Traverse all nested anonymous aggregates to update their offset.
Set the anonymous decl offset to its first member. */
tree ftype = TREE_TYPE (fields);
- if (TYPE_NAME (ftype) && anon_aggrname_p (TYPE_IDENTIFIER (ftype)))
+ if (TYPE_NAME (ftype) && IDENTIFIER_ANON_P (TYPE_IDENTIFIER (ftype)))
{
tree vfields = TYPE_FIELDS (ftype);
fixup_anonymous_offset (vfields, offset);
@@ -324,12 +324,7 @@ layout_aggregate_members (Dsymbols *members, tree context, bool inherited_p)
AnonDeclaration *ad = sym->isAnonDeclaration ();
if (ad != NULL)
{
- /* Use a counter to create anonymous type names. */
- static int anon_cnt = 0;
- char buf[32];
- sprintf (buf, anon_aggrname_format (), anon_cnt++);
-
- tree ident = get_identifier (buf);
+ tree ident = make_anon_name ();
tree type = make_node (ad->isunion ? UNION_TYPE : RECORD_TYPE);
ANON_AGGR_TYPE_P (type) = 1;
d_keep (type);