mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
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:
@ -1,3 +1,9 @@
|
|||||||
|
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
* gdbtypes.h (TYPE_PROTOTYPED): Remove, replace all
|
* gdbtypes.h (TYPE_PROTOTYPED): Remove, replace all
|
||||||
|
@ -1142,7 +1142,7 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
|
|||||||
tid = ctf_lookup_by_symbol (ccp->fp, idx);
|
tid = ctf_lookup_by_symbol (ccp->fp, idx);
|
||||||
ftype = get_tid_type (ccp->of, tid);
|
ftype = get_tid_type (ccp->of, tid);
|
||||||
if (finfo.ctc_flags & CTF_FUNC_VARARG)
|
if (finfo.ctc_flags & CTF_FUNC_VARARG)
|
||||||
TYPE_VARARGS (ftype) = 1;
|
ftype->set_has_varargs (true);
|
||||||
ftype->set_num_fields (argc);
|
ftype->set_num_fields (argc);
|
||||||
|
|
||||||
/* If argc is 0, it has a "void" type. */
|
/* If argc is 0, it has a "void" type. */
|
||||||
|
@ -17707,7 +17707,8 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
if (child_die->tag == DW_TAG_formal_parameter)
|
if (child_die->tag == DW_TAG_formal_parameter)
|
||||||
nparams++;
|
nparams++;
|
||||||
else if (child_die->tag == DW_TAG_unspecified_parameters)
|
else if (child_die->tag == DW_TAG_unspecified_parameters)
|
||||||
TYPE_VARARGS (ftype) = 1;
|
ftype->set_has_varargs (true);
|
||||||
|
|
||||||
child_die = child_die->sibling;
|
child_die = child_die->sibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ fake_method::fake_method (type_instance_flags flags,
|
|||||||
if (param_types[num_types - 1] == NULL)
|
if (param_types[num_types - 1] == NULL)
|
||||||
{
|
{
|
||||||
--num_types;
|
--num_types;
|
||||||
TYPE_VARARGS (type) = 1;
|
type->set_has_varargs (true);
|
||||||
}
|
}
|
||||||
else if (check_typedef (param_types[num_types - 1])->code ()
|
else if (check_typedef (param_types[num_types - 1])->code ()
|
||||||
== TYPE_CODE_VOID)
|
== TYPE_CODE_VOID)
|
||||||
|
@ -552,7 +552,7 @@ lookup_function_type_with_arguments (struct type *type,
|
|||||||
if (param_types[nparams - 1] == NULL)
|
if (param_types[nparams - 1] == NULL)
|
||||||
{
|
{
|
||||||
--nparams;
|
--nparams;
|
||||||
TYPE_VARARGS (fn) = 1;
|
fn->set_has_varargs (true);
|
||||||
}
|
}
|
||||||
else if (check_typedef (param_types[nparams - 1])->code ()
|
else if (check_typedef (param_types[nparams - 1])->code ()
|
||||||
== TYPE_CODE_VOID)
|
== TYPE_CODE_VOID)
|
||||||
@ -1556,7 +1556,7 @@ smash_to_method_type (struct type *type, struct type *self_type,
|
|||||||
type->set_fields (args);
|
type->set_fields (args);
|
||||||
type->set_num_fields (nargs);
|
type->set_num_fields (nargs);
|
||||||
if (varargs)
|
if (varargs)
|
||||||
TYPE_VARARGS (type) = 1;
|
type->set_has_varargs (true);
|
||||||
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
|
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
/* * FIXME drow/2002-06-03: Only used for methods, but applies as well
|
||||||
to functions. */
|
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
|
/* * 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
|
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_stub : 1;
|
||||||
unsigned int m_flag_target_stub : 1;
|
unsigned int m_flag_target_stub : 1;
|
||||||
unsigned int m_flag_prototyped : 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_vector : 1;
|
||||||
unsigned int flag_stub_supported : 1;
|
unsigned int flag_stub_supported : 1;
|
||||||
unsigned int flag_gnu_ifunc : 1;
|
unsigned int flag_gnu_ifunc : 1;
|
||||||
@ -1108,6 +1108,16 @@ struct type
|
|||||||
this->main_type->m_flag_prototyped = is_prototyped;
|
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
|
/* * Return the dynamic property of the requested KIND from this type's
|
||||||
list of dynamic properties. */
|
list of dynamic properties. */
|
||||||
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
||||||
|
Reference in New Issue
Block a user