gdb: remove TYPE_FIELD_ARTIFICIAL

Replace with type::field + field::is_artificial.

Change-Id: Ie3bacae49d9bd02e83e504c1ce01470aba56a081
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi
2023-08-31 11:46:24 -04:00
committed by Simon Marchi
parent 6c0f749351
commit 454977cdc4
11 changed files with 19 additions and 20 deletions

View File

@@ -535,7 +535,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
{ {
struct type *param_type; struct type *param_type;
if (TYPE_FIELD_ARTIFICIAL (type, i) && linkage_name) if (type->field (i).is_artificial () && linkage_name)
continue; continue;
if (printed_any) if (printed_any)
@@ -1102,7 +1102,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
virtual table pointers are not specifically marked in virtual table pointers are not specifically marked in
the debug info, they should be artificial. */ the debug info, they should be artificial. */
if ((i == vptr_fieldno && type == basetype) if ((i == vptr_fieldno && type == basetype)
|| TYPE_FIELD_ARTIFICIAL (type, i)) || type->field (i).is_artificial ())
continue; continue;
if (need_access_label) if (need_access_label)

View File

@@ -651,7 +651,7 @@ cplus_class_num_children (struct type *type, int children[3])
table pointers are not specifically marked in the debug info, table pointers are not specifically marked in the debug info,
they should be artificial. */ they should be artificial. */
if ((type == basetype && i == vptr_fieldno) if ((type == basetype && i == vptr_fieldno)
|| TYPE_FIELD_ARTIFICIAL (type, i)) || type->field (i).is_artificial ())
continue; continue;
if (TYPE_FIELD_PROTECTED (type, i)) if (TYPE_FIELD_PROTECTED (type, i))
@@ -751,7 +751,7 @@ cplus_describe_child (const struct varobj *parent, int index,
while (index >= 0) while (index >= 0)
{ {
if ((type == basetype && type_index == vptr_fieldno) if ((type == basetype && type_index == vptr_fieldno)
|| TYPE_FIELD_ARTIFICIAL (type, type_index)) || type->field (type_index).is_artificial ())
; /* ignore vptr */ ; /* ignore vptr */
else if (match_accessibility (type, type_index, acc)) else if (match_accessibility (type, type_index, acc))
--index; --index;

View File

@@ -584,7 +584,7 @@ compile_cplus_convert_struct_or_union_members
const char *field_name = type->field (i).name (); const char *field_name = type->field (i).name ();
if (TYPE_FIELD_IGNORE (type, i) if (TYPE_FIELD_IGNORE (type, i)
|| TYPE_FIELD_ARTIFICIAL (type, i)) || type->field (i).is_artificial ())
continue; continue;
/* GDB records unnamed/anonymous fields with empty string names. */ /* GDB records unnamed/anonymous fields with empty string names. */
@@ -982,7 +982,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
int artificials = 0; int artificials = 0;
for (int i = 0; i < type->num_fields (); ++i) for (int i = 0; i < type->num_fields (); ++i)
{ {
if (strip_artificial && TYPE_FIELD_ARTIFICIAL (type, i)) if (strip_artificial && type->field (i).is_artificial ())
{ {
--array.n_elements; --array.n_elements;
++artificials; ++artificials;

View File

@@ -7066,7 +7066,7 @@ dwarf2_compute_name (const char *name,
artificial; there is no way to differentiate artificial; there is no way to differentiate
the two cases. */ the two cases. */
if (type->num_fields () > 0 if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0) && type->field (0).is_artificial ()
&& type->field (0).type ()->code () == TYPE_CODE_PTR && type->field (0).type ()->code () == TYPE_CODE_PTR
&& TYPE_CONST (type->field (0).type ()->target_type ())) && TYPE_CONST (type->field (0).type ()->target_type ()))
buf.puts (" const"); buf.puts (" const");
@@ -12239,7 +12239,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
parameter for non-static member functions (which is the this parameter for non-static member functions (which is the this
pointer) as artificial. We obtain this information from pointer) as artificial. We obtain this information from
read_subroutine_type via TYPE_FIELD_ARTIFICIAL. */ read_subroutine_type via TYPE_FIELD_ARTIFICIAL. */
if (nparams == 0 || TYPE_FIELD_ARTIFICIAL (this_type, 0) == 0) if (nparams == 0 || this_type->field (0).is_artificial () == 0)
fnp->voffset = VOFFSET_STATIC; fnp->voffset = VOFFSET_STATIC;
} }
else else
@@ -12328,7 +12328,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
we cannot actually find a base class context for the we cannot actually find a base class context for the
vtable! */ vtable! */
if (this_type->num_fields () == 0 if (this_type->num_fields () == 0
|| !TYPE_FIELD_ARTIFICIAL (this_type, 0)) || !this_type->field (0).is_artificial ())
{ {
complaint (_("cannot determine context for virtual member " complaint (_("cannot determine context for virtual member "
"function \"%s\" (offset %s)"), "function \"%s\" (offset %s)"),
@@ -14723,7 +14723,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
but not in the class specifications (GCC PR 43053). */ but not in the class specifications (GCC PR 43053). */
if (cu->lang () == language_cplus if (cu->lang () == language_cplus
&& !TYPE_CONST (arg_type) && !TYPE_CONST (arg_type)
&& TYPE_FIELD_ARTIFICIAL (ftype, iparams)) && ftype->field (iparams).is_artificial ())
{ {
int is_this = 0; int is_this = 0;
struct dwarf2_cu *arg_cu = cu; struct dwarf2_cu *arg_cu = cu;

View File

@@ -1932,7 +1932,7 @@ fortran_prepare_argument (struct expression *exp,
bool is_artificial = ((arg_num >= func_type->num_fields ()) bool is_artificial = ((arg_num >= func_type->num_fields ())
? true ? true
: TYPE_FIELD_ARTIFICIAL (func_type, arg_num)); : func_type->field (arg_num).is_artificial ());
/* If this is an artificial argument, then either, this is an argument /* If this is an artificial argument, then either, this is an argument
beyond the end of the known arguments, or possibly, there are no known beyond the end of the known arguments, or possibly, there are no known

View File

@@ -5542,7 +5542,7 @@ copy_type_recursive (struct type *type, htab_t copied_types)
for (i = 0; i < nfields; i++) for (i = 0; i < nfields; i++)
{ {
new_type->field (i).set_is_artificial new_type->field (i).set_is_artificial
(TYPE_FIELD_ARTIFICIAL (type, i)); (type->field (i).is_artificial ());
TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
if (type->field (i).type ()) if (type->field (i).type ())
new_type->field (i).set_type new_type->field (i).set_type

View File

@@ -1925,7 +1925,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define TYPE_FIELD_ARTIFICIAL(thistype, n) ((thistype)->field (n).is_artificial ())
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n)) #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0) #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)

View File

@@ -122,7 +122,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
artificial flag of the first parameter ('this' pointer). */ artificial flag of the first parameter ('this' pointer). */
if (type->code () == TYPE_CODE_METHOD if (type->code () == TYPE_CODE_METHOD
&& type->num_fields () > 0 && type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0) && type->field (0).is_artificial ()
&& type->field (0).type ()->code () == TYPE_CODE_PTR) && type->field (0).type ()->code () == TYPE_CODE_PTR)
thiscall = 1; thiscall = 1;

View File

@@ -197,7 +197,7 @@ convert_field (struct type *type, int field)
if (PyObject_SetAttrString (result.get (), "name", arg.get ()) < 0) if (PyObject_SetAttrString (result.get (), "name", arg.get ()) < 0)
return NULL; return NULL;
arg.reset (PyBool_FromLong (TYPE_FIELD_ARTIFICIAL (type, field))); arg.reset (PyBool_FromLong (type->field (field).is_artificial ()));
if (PyObject_SetAttrString (result.get (), "artificial", arg.get ()) < 0) if (PyObject_SetAttrString (result.get (), "artificial", arg.get ()) < 0)
return NULL; return NULL;

View File

@@ -93,7 +93,7 @@ rust_enum_variant (struct type *type)
{ {
/* The active variant is simply the first non-artificial field. */ /* The active variant is simply the first non-artificial field. */
for (int i = 0; i < type->num_fields (); ++i) for (int i = 0; i < type->num_fields (); ++i)
if (!TYPE_FIELD_ARTIFICIAL (type, i)) if (!type->field (i).is_artificial ())
return i; return i;
/* Perhaps we could get here by trying to print an Ada variant /* Perhaps we could get here by trying to print an Ada variant
@@ -724,7 +724,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
{ {
if (type->field (i).is_static ()) if (type->field (i).is_static ())
continue; continue;
if (is_enum && TYPE_FIELD_ARTIFICIAL (type, i)) if (is_enum && type->field (i).is_artificial ())
continue; continue;
fields.push_back (i); fields.push_back (i);
} }
@@ -741,7 +741,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
QUIT; QUIT;
gdb_assert (!type->field (i).is_static ()); gdb_assert (!type->field (i).is_static ());
gdb_assert (! (is_enum && TYPE_FIELD_ARTIFICIAL (type, i))); gdb_assert (! (is_enum && type->field (i).is_artificial ()));
if (flags->print_offsets) if (flags->print_offsets)
podata->update (type, i, stream); podata->update (type, i, stream);

View File

@@ -3464,7 +3464,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
{ {
int start = 0; int start = 0;
if (t1->num_fields () > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0)) if (t1->num_fields () > 0 && t1->field (0).is_artificial ())
++start; ++start;
/* If skipping artificial fields, find the first real field /* If skipping artificial fields, find the first real field
@@ -3472,7 +3472,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
if (skip_artificial) if (skip_artificial)
{ {
while (start < t1->num_fields () while (start < t1->num_fields ()
&& TYPE_FIELD_ARTIFICIAL (t1, start)) && t1->field (start).is_artificial ())
++start; ++start;
} }