aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:26:04 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:26:04 -0400
commit5d14b6e5d6525ce462c30501644922a10f8682eb (patch)
tree0f1ce729b9393dc161bbcc4fc70f5b7b0a3ff335 /gdb
parent3d967001ecd3b325fc39d7f53ebf7054d1ecd503 (diff)
downloadgdb-5d14b6e5d6525ce462c30501644922a10f8682eb.zip
gdb-5d14b6e5d6525ce462c30501644922a10f8682eb.tar.gz
gdb-5d14b6e5d6525ce462c30501644922a10f8682eb.tar.bz2
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
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/ada-lang.c12
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/c-typeprint.c6
-rw-r--r--gdb/coffread.c8
-rw-r--r--gdb/ctfread.c8
-rw-r--r--gdb/dwarf2/read.c18
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/gdbtypes.c30
-rw-r--r--gdb/gdbtypes.h18
-rw-r--r--gdb/gnu-v3-abi.c12
-rw-r--r--gdb/iq2000-tdep.c2
-rw-r--r--gdb/mdebugread.c8
-rw-r--r--gdb/rust-lang.c4
-rw-r--r--gdb/stabsread.c14
-rw-r--r--gdb/valops.c8
16 files changed, 90 insertions, 71 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38f9fad..7d3bcfc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
+ * 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.
+
+2020-06-08 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (TYPE_INDEX_TYPE): Remove. Change all call sites
to use type::index_type instead.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4f6c6b4..20c27c4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1432,7 +1432,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
if (raw_type)
- TYPE_FIELD_TYPE (index_desc_type, i) = raw_type;
+ index_desc_type->field (i).set_type (raw_type);
}
}
@@ -8088,7 +8088,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
record size. */
ada_ensure_varsize_limit (field_type);
- TYPE_FIELD_TYPE (rtype, f) = field_type;
+ rtype->field (f).set_type (field_type);
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
/* The multiplication can potentially overflow. But because
the field length has been size-checked just above, and
@@ -8111,7 +8111,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
structure, the typedef is the only clue which allows us
to distinguish between the two options. Stripping it
would prevent us from printing this field appropriately. */
- TYPE_FIELD_TYPE (rtype, f) = TYPE_FIELD_TYPE (type, f);
+ rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f));
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
if (TYPE_FIELD_BITSIZE (type, f) > 0)
fld_bit_len =
@@ -8173,7 +8173,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
}
else
{
- TYPE_FIELD_TYPE (rtype, variant_field) = branch_type;
+ rtype->field (variant_field).set_type (branch_type);
TYPE_FIELD_NAME (rtype, variant_field) = "S";
fld_bit_len =
TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) *
@@ -8289,7 +8289,7 @@ template_to_static_fixed_type (struct type *type0)
TYPE_FIXED_INSTANCE (type) = 1;
TYPE_LENGTH (type) = 0;
}
- TYPE_FIELD_TYPE (type, f) = new_type;
+ type->field (f).set_type (new_type);
TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (type0, f);
}
}
@@ -8358,7 +8358,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
}
else
{
- TYPE_FIELD_TYPE (rtype, variant_field) = branch_type;
+ rtype->field (variant_field).set_type (branch_type);
TYPE_FIELD_NAME (rtype, variant_field) = "S";
TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 33bf652..0c4c300 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -286,7 +286,7 @@ buildsym_compunit::finish_block_internal
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++;
}
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 35cfd21..2636a53 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -302,7 +302,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
if (FIELD_ARTIFICIAL (arg))
continue;
- c_print_type (arg.type, "", stream, 0, 0, flags);
+ c_print_type (arg.type (), "", stream, 0, 0, flags);
if (i == nargs && varargs)
fprintf_filtered (stream, ", ...");
@@ -327,8 +327,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
struct type *domain;
gdb_assert (nargs > 0);
- gdb_assert (args[0].type->code () == TYPE_CODE_PTR);
- domain = TYPE_TARGET_TYPE (args[0].type);
+ gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
+ domain = TYPE_TARGET_TYPE (args[0].type ());
if (TYPE_CONST (domain))
fprintf_filtered (stream, " const");
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 8b1f040..1592dc6 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2008,8 +2008,8 @@ coff_read_struct_type (int index, int length, int lastsym,
/* Save the data. */
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
- FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
- &sub_aux, objfile);
+ list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
+ objfile));
SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
FIELD_BITSIZE (list->field) = 0;
nfields++;
@@ -2024,8 +2024,8 @@ coff_read_struct_type (int index, int length, int lastsym,
/* Save the data. */
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
- FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
- &sub_aux, objfile);
+ list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
+ objfile));
SET_FIELD_BITPOS (list->field, ms->c_value);
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
nfields++;
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 57a3763..e296b13 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -379,7 +379,7 @@ ctf_add_member_cb (const char *name,
if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
process_struct_members (ccp, tid, t);
- FIELD_TYPE (*fp) = t;
+ fp->set_type (t);
SET_FIELD_BITPOS (*fp, offset / TARGET_CHAR_BIT);
FIELD_BITSIZE (*fp) = get_bitsize (ccp->fp, tid, kind);
@@ -401,7 +401,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
fp = &new_field.field;
FIELD_NAME (*fp) = name;
- FIELD_TYPE (*fp) = NULL;
+ fp->set_type (NULL);
SET_FIELD_ENUMVAL (*fp, enum_value);
FIELD_BITSIZE (*fp) = 0;
@@ -1152,9 +1152,9 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
{
atyp = get_tid_type (ccp->of, argv[iparam]);
if (atyp)
- TYPE_FIELD_TYPE (ftype, iparam) = atyp;
+ ftype->field (iparam).set_type (atyp);
else
- TYPE_FIELD_TYPE (ftype, iparam) = void_type;
+ ftype->field (iparam).set_type (void_type);
}
sym = new_symbol (ccp, ftype, tid);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 477c382..52feff0 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9504,7 +9504,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
/* Put the discriminant at index 0. */
- TYPE_FIELD_TYPE (type, 0) = field_type;
+ type->field (0).set_type (field_type);
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
SET_FIELD_BITPOS (type->field (0), bit_offset);
@@ -9523,7 +9523,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
name);
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
dataless_name);
- TYPE_FIELD_TYPE (type, 2) = dataless_type;
+ type->field (2).set_type (dataless_type);
/* NAME points into the original discriminant name, which
already has the correct lifetime. */
TYPE_FIELD_NAME (type, 2) = name;
@@ -14539,7 +14539,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
/* Data member other than a C++ static data member. */
/* Get type of field. */
- fp->type = die_type (die, cu);
+ fp->set_type (die_type (die, cu));
SET_FIELD_BITPOS (*fp, 0);
@@ -14593,7 +14593,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
the bit field must be inferred from the type
attribute of the data member containing the
bit field. */
- anonymous_size = TYPE_LENGTH (fp->type);
+ anonymous_size = TYPE_LENGTH (fp->type ());
}
SET_FIELD_BITPOS (*fp,
(FIELD_BITPOS (*fp)
@@ -14659,7 +14659,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
/* The name is already allocated along with this objfile, so we don't
need to duplicate it for the type. */
SET_FIELD_PHYSNAME (*fp, physname ? physname : "");
- FIELD_TYPE (*fp) = die_type (die, cu);
+ fp->set_type (die_type (die, cu));
FIELD_NAME (*fp) = fieldname;
}
else if (die->tag == DW_TAG_inheritance)
@@ -14667,8 +14667,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
/* C++ base class field. */
handle_data_member_location (die, cu, fp);
FIELD_BITSIZE (*fp) = 0;
- FIELD_TYPE (*fp) = die_type (die, cu);
- FIELD_NAME (*fp) = fp->type->name ();
+ fp->set_type (die_type (die, cu));
+ FIELD_NAME (*fp) = fp->type ()->name ();
}
else
gdb_assert_not_reached ("missing case in dwarf2_add_field");
@@ -17227,7 +17227,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
/* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
even if we error out during the parameters reading below. */
for (iparams = 0; iparams < nparams; iparams++)
- TYPE_FIELD_TYPE (ftype, iparams) = void_type;
+ ftype->field (iparams).set_type (void_type);
iparams = 0;
child_die = die->child;
@@ -17284,7 +17284,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
arg_type, 0);
}
- TYPE_FIELD_TYPE (ftype, iparams) = arg_type;
+ ftype->field (iparams).set_type (arg_type);
iparams++;
}
child_die = child_die->sibling;
diff --git a/gdb/eval.c b/gdb/eval.c
index 6759d22..61f5ba7 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -686,7 +686,7 @@ fake_method::fake_method (type_instance_flags flags,
((struct field *) xzalloc (sizeof (struct field) * num_types));
while (num_types-- > 0)
- TYPE_FIELD_TYPE (type, num_types) = param_types[num_types];
+ type->field (num_types).set_type (param_types[num_types]);
}
fake_method::~fake_method ()
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b2afb18..58aae9f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -566,7 +566,7 @@ lookup_function_type_with_arguments (struct type *type,
fn->set_fields
((struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
for (i = 0; i < nparams; ++i)
- TYPE_FIELD_TYPE (fn, i) = param_types[i];
+ fn->field (i).set_type (param_types[i]);
return fn;
}
@@ -1405,7 +1405,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
if (low_bound >= 0)
TYPE_UNSIGNED (result_type) = 1;
}
- TYPE_FIELD_TYPE (result_type, 0) = domain_type;
+ result_type->field (0).set_type (domain_type);
return result_type;
}
@@ -2263,7 +2263,7 @@ resolve_dynamic_union (struct type *type,
t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
addr_stack, 0);
- TYPE_FIELD_TYPE (resolved_type, i) = t;
+ resolved_type->field (i).set_type (t);
if (TYPE_LENGTH (t) > max_len)
max_len = TYPE_LENGTH (t);
}
@@ -2511,9 +2511,9 @@ resolve_dynamic_struct (struct type *type,
+ (TYPE_FIELD_BITPOS (resolved_type, i) / TARGET_CHAR_BIT));
pinfo.next = addr_stack;
- TYPE_FIELD_TYPE (resolved_type, i)
- = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
- &pinfo, 0);
+ resolved_type->field (i).set_type
+ (resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
+ &pinfo, 0));
gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
== FIELD_LOC_KIND_BITPOS);
@@ -3011,7 +3011,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
argcount = 0;
else
{
- argtypes[0].type = lookup_pointer_type (type);
+ argtypes[0].set_type (lookup_pointer_type (type));
argcount = 1;
}
@@ -3027,8 +3027,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
if (strncmp (argtypetext, "...", p - argtypetext) != 0
&& strncmp (argtypetext, "void", p - argtypetext) != 0)
{
- argtypes[argcount].type =
- safe_parse_type (gdbarch, argtypetext, p - argtypetext);
+ argtypes[argcount].set_type
+ (safe_parse_type (gdbarch, argtypetext, p - argtypetext));
argcount += 1;
}
argtypetext = p + 1;
@@ -4712,7 +4712,7 @@ print_args (struct field *args, int nargs, int spaces)
{
printfi_filtered (spaces, "[%d] name '%s'\n", i,
args[i].name != NULL ? args[i].name : "<NULL>");
- recursive_dump_type (args[i].type, spaces + 2);
+ recursive_dump_type (args[i].type (), spaces + 2);
}
}
}
@@ -5321,9 +5321,9 @@ copy_type_recursive (struct objfile *objfile,
TYPE_FIELD_ARTIFICIAL (type, i);
TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
if (TYPE_FIELD_TYPE (type, i))
- TYPE_FIELD_TYPE (new_type, i)
- = copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
- copied_types);
+ new_type->field (i).set_type
+ (copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
+ copied_types));
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
xstrdup (TYPE_FIELD_NAME (type, i));
@@ -5596,7 +5596,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
gdb_assert (name != NULL);
TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
- TYPE_FIELD_TYPE (type, field_nr) = field_type;
+ type->field (field_nr).set_type (field_type);
SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
type->set_num_fields (type->num_fields () + 1);
@@ -5647,7 +5647,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
t->num_fields ()));
f = &t->field (t->num_fields () - 1);
memset (f, 0, sizeof f[0]);
- FIELD_TYPE (f[0]) = field;
+ f[0].set_type (field);
FIELD_NAME (f[0]) = name;
return f;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ffb8a61..af55875 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -635,6 +635,16 @@ union field_location
struct field
{
+ struct type *type () const
+ {
+ return this->m_type;
+ }
+
+ void set_type (struct type *type)
+ {
+ this->m_type = type;
+ }
+
union field_location loc;
/* * For a function or member type, this is 1 if the argument is
@@ -660,7 +670,7 @@ struct field
- In a function or member type, type of this argument.
- In an array type, the domain-type of the array. */
- struct type *type;
+ struct type *m_type;
/* * Name of field, value or argument.
NULL for range bounds, array domains, and member function
@@ -935,12 +945,12 @@ struct type
type *index_type () const
{
- return this->field (0).type;
+ return this->field (0).type ();
}
void set_index_type (type *index_type)
{
- this->field (0).type = index_type;
+ this->field (0).set_type (index_type);
}
/* * Return the dynamic property of the requested KIND from this type's
@@ -1600,7 +1610,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define FIELD_TYPE(thisfld) ((thisfld).type)
+#define FIELD_TYPE(thisfld) ((thisfld).type ())
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 255cfd1..8209d1b 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -135,28 +135,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
/* ptrdiff_t vcall_and_vbase_offsets[0]; */
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
- FIELD_TYPE (*field) = lookup_array_range_type (ptrdiff_type, 0, -1);
+ field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* ptrdiff_t offset_to_top; */
FIELD_NAME (*field) = "offset_to_top";
- FIELD_TYPE (*field) = ptrdiff_type;
+ field->set_type (ptrdiff_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* void *type_info; */
FIELD_NAME (*field) = "type_info";
- FIELD_TYPE (*field) = void_ptr_type;
+ field->set_type (void_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* void (*virtual_functions[0]) (); */
FIELD_NAME (*field) = "virtual_functions";
- FIELD_TYPE (*field) = lookup_array_range_type (ptr_to_void_fn_type, 0, -1);
+ field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
@@ -1039,14 +1039,14 @@ build_std_type_info_type (struct gdbarch *arch)
/* The vtable. */
FIELD_NAME (*field) = "_vptr.type_info";
- FIELD_TYPE (*field) = void_ptr_type;
+ field->set_type (void_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
/* The name. */
FIELD_NAME (*field) = "__name";
- FIELD_TYPE (*field) = char_ptr_type;
+ field->set_type (char_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
offset += TYPE_LENGTH (FIELD_TYPE (*field));
field++;
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index b35b45e..cd53ec7 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -607,7 +607,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
if (type->num_fields () != 1)
return 1;
/* Get field type. */
- ftype = type->field (0).type;
+ ftype = type->field (0).type ();
/* The field type must have size 8, otherwise pass by address. */
if (TYPE_LENGTH (ftype) != 8)
return 1;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 20fdd40..07613a5 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -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;
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 7fe6d3d..20bfbd6 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -988,7 +988,7 @@ rust_composite_type (struct type *original,
bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
FIELD_NAME (*field) = field1;
- FIELD_TYPE (*field) = type1;
+ field->set_type (type1);
++i;
}
if (field2 != NULL)
@@ -1008,7 +1008,7 @@ rust_composite_type (struct type *original,
SET_FIELD_BITPOS (*field, bitpos);
FIELD_NAME (*field) = field2;
- FIELD_TYPE (*field) = type2;
+ field->set_type (type2);
++i;
}
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 179a0fb..6d581ba 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1007,7 +1007,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
FIXME: Do we need a new builtin_promoted_int_arg ? */
if (ptype->code () == TYPE_CODE_VOID)
ptype = objfile_type (objfile)->builtin_int;
- TYPE_FIELD_TYPE (ftype, nparams) = ptype;
+ ftype->field (nparams).set_type (ptype);
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
ftype->set_num_fields (nparams);
@@ -1849,7 +1849,7 @@ again:
when we read it, so the list is reversed. Build the
fields array right-to-left. */
for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
- TYPE_FIELD_TYPE (func_type, i) = t->type;
+ func_type->field (i).set_type (t->type);
}
func_type->set_num_fields (num_args);
TYPE_PROTOTYPED (func_type) = 1;
@@ -2788,7 +2788,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
invalid_cpp_abbrev_complaint (*pp);
return 0;
}
- fip->list->field.type = read_type (pp, objfile);
+ fip->list->field.set_type (read_type (pp, objfile));
if (**pp == ',')
(*pp)++; /* Skip the comma. */
else
@@ -2840,7 +2840,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
fip->list->visibility = VISIBILITY_PUBLIC;
}
- fip->list->field.type = read_type (pp, objfile);
+ fip->list->field.set_type (read_type (pp, objfile));
if (**pp == ':')
{
p = ++(*pp);
@@ -3161,8 +3161,8 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
base class. Read it, and remember it's type name as this
field's name. */
- newobj->field.type = read_type (pp, objfile);
- newobj->field.name = newobj->field.type->name ();
+ newobj->field.set_type (read_type (pp, objfile));
+ newobj->field.name = newobj->field.type ()->name ();
/* Skip trailing ';' and bump count of number of fields seen. */
if (**pp == ';')
@@ -4242,7 +4242,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
rval = XCNEWVEC (struct field, n);
for (i = 0; i < n; i++)
- rval[i].type = types[i];
+ rval[i].set_type (types[i]);
*nargsp = n;
return rval;
}
diff --git a/gdb/valops.c b/gdb/valops.c
index 2bc58ca..eb7fd6e 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1707,7 +1707,7 @@ typecmp (int staticp, int varargs, int nargs,
t2 ++;
for (i = 0;
- (i < nargs) && t1[i].type->code () != TYPE_CODE_VOID;
+ (i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID;
i++)
{
struct type *tt1, *tt2;
@@ -1715,7 +1715,7 @@ typecmp (int staticp, int varargs, int nargs,
if (!t2[i])
return i + 1;
- tt1 = check_typedef (t1[i].type);
+ tt1 = check_typedef (t1[i].type ());
tt2 = check_typedef (value_type (t2[i]));
if (TYPE_IS_REFERENCE (tt1)
@@ -1754,7 +1754,7 @@ typecmp (int staticp, int varargs, int nargs,
/* We should be doing much hairier argument matching (see
section 13.2 of the ARM), but as a quick kludge, just check
for the same type code. */
- if (t1[i].type->code () != value_type (t2[i])->code ())
+ if (t1[i].type ()->code () != value_type (t2[i])->code ())
return i + 1;
}
if (varargs || t2[i] == NULL)
@@ -2967,7 +2967,7 @@ find_oload_champ (gdb::array_view<value *> args,
for (jj = 0; jj < nparms; jj++)
{
type *t = (methods != NULL
- ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type)
+ ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
: TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
jj));
parm_types.push_back (t);