gdb: add type::has_varargs / type::set_has_varargs

Add the `has_varargs` and `set_has_varargs` methods on `struct type`, in
order to remove the `TYPE_VARARGS` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <has_varargs, set_has_varargs>: New methods.
	(TYPE_VARARGS): Use type::has_varargs, change all write call sites to
	use type::set_has_varargs.

Change-Id: I898a1093ae40808b37a7c6fced7f6fa2aae604de
This commit is contained in:
Simon Marchi
2020-09-14 11:08:01 -04:00
parent 7f9f399b34
commit 1d6286ed04
6 changed files with 24 additions and 7 deletions

View File

@ -552,7 +552,7 @@ lookup_function_type_with_arguments (struct type *type,
if (param_types[nparams - 1] == NULL)
{
--nparams;
TYPE_VARARGS (fn) = 1;
fn->set_has_varargs (true);
}
else if (check_typedef (param_types[nparams - 1])->code ()
== TYPE_CODE_VOID)
@ -1556,7 +1556,7 @@ smash_to_method_type (struct type *type, struct type *self_type,
type->set_fields (args);
type->set_num_fields (nargs);
if (varargs)
TYPE_VARARGS (type) = 1;
type->set_has_varargs (true);
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
}