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

@@ -219,7 +219,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
/* * FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
#define TYPE_VARARGS(t) (TYPE_MAIN_TYPE (t)->flag_varargs)
#define TYPE_VARARGS(t) ((t)->has_varargs ())
/* * Identify a vector type. Gcc is handling this by adding an extra
attribute to the array type. We slurp that in as a new flag of a
@@ -828,7 +828,7 @@ struct main_type
unsigned int m_flag_stub : 1;
unsigned int m_flag_target_stub : 1;
unsigned int m_flag_prototyped : 1;
unsigned int flag_varargs : 1;
unsigned int m_flag_varargs : 1;
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
unsigned int flag_gnu_ifunc : 1;
@@ -1108,6 +1108,16 @@ struct type
this->main_type->m_flag_prototyped = is_prototyped;
}
bool has_varargs () const
{
return this->main_type->m_flag_varargs;
}
void set_has_varargs (bool has_varargs)
{
this->main_type->m_flag_varargs = has_varargs;
}
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;