gdb: add field::type / field::set_type

Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro.  In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.

Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`.  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`).

gdb/ChangeLog:

	* gdbtypes.h (struct field) <type, set_type>: New methods.
	Rename `type` field to...
	<m_type>: ... this.  Change references throughout to use type or
	set_type methods.
	(FIELD_TYPE): Use field::type.  Change call sites that modify
	the field's type to use field::set_type instead.

Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
This commit is contained in:
Simon Marchi
2020-06-08 15:26:04 -04:00
parent 3d967001ec
commit 5d14b6e5d6
16 changed files with 90 additions and 71 deletions

View File

@@ -1051,7 +1051,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
break;
SET_FIELD_ENUMVAL (*f, tsym.value);
FIELD_TYPE (*f) = t;
f->set_type (t);
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
FIELD_BITSIZE (*f) = 0;
@@ -1198,7 +1198,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
if (SYMBOL_IS_ARGUMENT (sym))
{
TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
iparams++;
}
@@ -1238,8 +1238,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
FIELD_NAME (*f) = name;
SET_FIELD_BITPOS (*f, sh->value);
bitsize = 0;
FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index,
&bitsize, bigend, name);
f->set_type (parse_type (cur_fd, ax, sh->index, &bitsize, bigend,
name));
FIELD_BITSIZE (*f) = bitsize;
}
break;