diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-07-26 18:06:03 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-07-30 12:51:35 +0200 |
commit | 3b52a1086c1358a7694ebe0c7610058c48e93b22 (patch) | |
tree | 85aa296e7485e4b71e8cbefd3e56539877d03dcb /gcc | |
parent | bc5208f7357bfe8e466890a4c856a642cc16920f (diff) | |
download | gcc-3b52a1086c1358a7694ebe0c7610058c48e93b22.zip gcc-3b52a1086c1358a7694ebe0c7610058c48e93b22.tar.gz gcc-3b52a1086c1358a7694ebe0c7610058c48e93b22.tar.bz2 |
d: Use Identifier::idPool to generate anonymous field name.
The self-hosted implementation of the D front-end does not export
Identifier::generateId, so handle name generation inline instead.
gcc/d/ChangeLog:
* d-builtins.cc (build_frontend_type): Use Identifier::idPool to
generate anonymous field name.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/d/d-builtins.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 9db46c0..328711f 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -241,8 +241,8 @@ build_frontend_type (tree type) sdecl->type->merge2 (); /* Add both named and anonymous fields as members of the struct. - Anonymous fields still need a name in D, so call them "__pad%d". */ - int anonfield_id = 0; + Anonymous fields still need a name in D, so call them "__pad%u". */ + unsigned anonfield_id = 0; sdecl->members = new Dsymbols; for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) @@ -259,7 +259,11 @@ build_frontend_type (tree type) Identifier *fident; if (DECL_NAME (field) == NULL_TREE) - fident = Identifier::generateId ("__pad", anonfield_id++); + { + char name[16]; + snprintf (name, sizeof (name), "__pad%u", anonfield_id++); + fident = Identifier::idPool (name); + } else { const char *name = IDENTIFIER_POINTER (DECL_NAME (field)); |