diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-08-30 11:49:48 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-30 22:05:46 -0400 |
commit | d3fd12dfc52cf4cbb910830e3ff60dca111f7468 (patch) | |
tree | 14cff3a0dfb01d130942e5e2999ca541cef6c280 /gdb/stabsread.c | |
parent | cdfbeec4139a3dc53ce7a061604dea8d8c76f974 (diff) | |
download | fsf-binutils-gdb-d3fd12dfc52cf4cbb910830e3ff60dca111f7468.zip fsf-binutils-gdb-d3fd12dfc52cf4cbb910830e3ff60dca111f7468.tar.gz fsf-binutils-gdb-d3fd12dfc52cf4cbb910830e3ff60dca111f7468.tar.bz2 |
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
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r-- | gdb/stabsread.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 72cb351..765fec4 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1225,8 +1225,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--) if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0) - TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) = - TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name (); + SYMBOL_TYPE (sym)->field (j).set_name + (TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name ()); } if (SYMBOL_TYPE (sym)->name () == NULL) @@ -2712,8 +2712,8 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp, { name = ""; } - fip->list->field.name = obconcat (&objfile->objfile_obstack, - vptr_name, name, (char *) NULL); + fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + vptr_name, name, (char *) NULL)); break; case 'b': /* $vb -- a virtual bsomethingorother */ @@ -2725,15 +2725,15 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp, symnum); name = "FOO"; } - fip->list->field.name = obconcat (&objfile->objfile_obstack, vb_name, - name, (char *) NULL); + fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + vb_name, name, (char *) NULL)); break; default: invalid_cpp_abbrev_complaint (*pp); - fip->list->field.name = obconcat (&objfile->objfile_obstack, - "INVALID_CPLUSPLUS_ABBREV", - (char *) NULL); + fip->list->field.set_name (obconcat (&objfile->objfile_obstack, + "INVALID_CPLUSPLUS_ABBREV", + (char *) NULL)); break; } @@ -2782,8 +2782,8 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, { struct gdbarch *gdbarch = objfile->arch (); - fip->list->field.name - = obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp); + fip->list->field.set_name + (obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp)); *pp = p + 1; /* This means we have a visibility for a field coming. */ @@ -3120,7 +3120,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp, field's name. */ newobj->field.set_type (read_type (pp, objfile)); - newobj->field.name = newobj->field.type ()->name (); + newobj->field.set_name (newobj->field.type ()->name ()); /* Skip trailing ';' and bump count of number of fields seen. */ if (**pp == ';') @@ -3638,7 +3638,7 @@ read_enum_type (const char **pp, struct type *type, 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)); TYPE_FIELD_BITSIZE (type, n) = 0; } |