From d3fd12dfc52cf4cbb910830e3ff60dca111f7468 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 30 Aug 2021 11:49:48 -0400 Subject: gdb: add field::name / field::set_name Add the `name` and `set_name` methods on `struct field`, in order to remove `FIELD_NAME` and `TYPE_FIELD_NAME` macros. In this patch, the macros are changed to use `field::name`, so all the call sites that are used to set the field's name are changed to use `field::set_name`. The next patch will remove the macros completely. Note that because of the name clash between the existing field named `name` and the new method, I renamed the field `m_name`. It is not private per-se, because we can't make `struct field` a non-POD yet, but it should be considered private anyway (not accessed outside `struct field`). Change-Id: If16ddbca4e0c39d0ff9da420bb5cdebe5b9b0896 --- gdb/coffread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gdb/coffread.c') diff --git a/gdb/coffread.c b/gdb/coffread.c index 0135363..30cf819 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -2008,7 +2008,8 @@ coff_read_struct_type (int index, int length, int lastsym, list = newobj; /* Save the data. */ - list->field.name = obstack_strdup (&objfile->objfile_obstack, name); + list->field.set_name (obstack_strdup (&objfile->objfile_obstack, + name)); list->field.set_type (decode_type (ms, ms->c_type, &sub_aux, objfile)); SET_FIELD_BITPOS (list->field, 8 * ms->c_value); @@ -2024,7 +2025,8 @@ coff_read_struct_type (int index, int length, int lastsym, list = newobj; /* Save the data. */ - list->field.name = obstack_strdup (&objfile->objfile_obstack, name); + list->field.set_name (obstack_strdup (&objfile->objfile_obstack, + name)); list->field.set_type (decode_type (ms, ms->c_type, &sub_aux, objfile)); SET_FIELD_BITPOS (list->field, ms->c_value); @@ -2142,7 +2144,7 @@ coff_read_enum_type (int index, int length, int lastsym, struct symbol *xsym = syms->symbol[j]; SYMBOL_TYPE (xsym) = type; - TYPE_FIELD_NAME (type, n) = xsym->linkage_name (); + type->field (n).set_name (xsym->linkage_name ()); SET_FIELD_ENUMVAL (type->field (n), SYMBOL_VALUE (xsym)); if (SYMBOL_VALUE (xsym) < 0) unsigned_enum = 0; -- cgit v1.1