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;
}
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;
}
else if (!t_field_name || *t_field_name == '\0')
{
struct_elt elt
- = lookup_struct_elt (TYPE_FIELD_TYPE (type, i), name, 1);
+ = lookup_struct_elt (type->field (i).type (), name, 1);
if (elt.field != NULL)
{
elt.offset += TYPE_FIELD_BITPOS (type, i);
{
struct_elt elt = lookup_struct_elt (type, name, noerr);
if (elt.field != NULL)
- return FIELD_TYPE (*elt.field);
+ return elt.field->type ();
else
return NULL;
}
if (field_is_static (&type->field (i)))
continue;
/* If the field has dynamic type, then so does TYPE. */
- if (is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
+ if (is_dynamic_type_internal (type->field (i).type (), 0))
return 1;
/* If the field is at a fixed offset, then it is not
dynamic. */
if (field_is_static (&type->field (i)))
continue;
- t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
+ t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
addr_stack, 0);
- TYPE_FIELD_TYPE (resolved_type, i) = t;
- if (TYPE_LENGTH (t) > max_len)
- max_len = TYPE_LENGTH (t);
+ resolved_type->field (i).set_type (t);
+
+ struct type *real_type = check_typedef (t);
+ if (TYPE_LENGTH (real_type) > max_len)
+ max_len = TYPE_LENGTH (real_type);
}
TYPE_LENGTH (resolved_type) = max_len;
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
LONGEST size = bitsize / 8;
if (size == 0)
- size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, idx));
+ size = TYPE_LENGTH (type->field (idx).type ());
gdb_byte bits[sizeof (ULONGEST)];
read_memory (addr, bits, size);
LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx)
% TARGET_CHAR_BIT);
- discr_value = unpack_bits_as_long (TYPE_FIELD_TYPE (type, idx),
+ discr_value = unpack_bits_as_long (type->field (idx).type (),
bits, bitpos, bitsize);
}
}
{
struct dwarf2_property_baton baton;
baton.property_type
- = lookup_pointer_type (TYPE_FIELD_TYPE (resolved_type, i));
+ = lookup_pointer_type (resolved_type->field (i).type ());
baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i);
struct dynamic_prop prop;
error (_("Cannot determine struct field location"
" (invalid location kind)"));
- pinfo.type = check_typedef (TYPE_FIELD_TYPE (resolved_type, i));
+ pinfo.type = check_typedef (resolved_type->field (i).type ());
pinfo.valaddr = addr_stack->valaddr;
pinfo.addr
= (addr_stack->addr
+ (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 (resolved_type->field (i).type (),
+ &pinfo, 0));
gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
== FIELD_LOC_KIND_BITPOS);
if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
else
- new_bit_length += (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_type, i))
- * TARGET_CHAR_BIT);
+ {
+ struct type *real_type
+ = check_typedef (resolved_type->field (i).type ());
+
+ new_bit_length += (TYPE_LENGTH (real_type) * TARGET_CHAR_BIT);
+ }
/* Normally, we would use the position and size of the last field
to determine the size of the enclosing structure. But GCC seems
argcount = 0;
else
{
- argtypes[0].type = lookup_pointer_type (type);
+ argtypes[0].set_type (lookup_pointer_type (type));
argcount = 1;
}
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;
if (!field_is_static (&type->field (i)))
{
number_of_non_static_fields++;
- ULONGEST f_align = type_align (TYPE_FIELD_TYPE (type, i));
+ ULONGEST f_align = type_align (type->field (i).type ());
if (f_align == 0)
{
/* Don't pretend we know something we don't. */
}
/* Are we dealing with a struct with one element? */
else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1)
- return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0));
+ return is_scalar_type_recursive (t->field (0).type ());
else if (t->code () == TYPE_CODE_UNION)
{
int i, n = t->num_fields ();
/* If all elements of the union are scalar, then the union is scalar. */
for (i = 0; i < n; i++)
- if (!is_scalar_type_recursive (TYPE_FIELD_TYPE (t, i)))
+ if (!is_scalar_type_recursive (t->field (i).type ()))
return 0;
return 1;
return false;
for (i = 0; i < a->num_fields (); ++i)
- if (!types_equal (TYPE_FIELD_TYPE (a, i), TYPE_FIELD_TYPE (b, i)))
+ if (!types_equal (a->field (i).type (), b->field (i).type ()))
return false;
return true;
FIELD_LOC_KIND (*field1));
}
- worklist->emplace_back (FIELD_TYPE (*field1), FIELD_TYPE (*field2));
+ worklist->emplace_back (field1->type (), field2->type ());
}
}
{
/* Not in C++ */
case TYPE_CODE_SET:
- return rank_one_type (TYPE_FIELD_TYPE (parm, 0),
- TYPE_FIELD_TYPE (arg, 0), NULL);
+ return rank_one_type (parm->field (0).type (),
+ arg->field (0).type (), NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
{
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);
}
}
}
"[%d] bitpos %s bitsize %d type ",
idx, plongest (TYPE_FIELD_BITPOS (type, idx)),
TYPE_FIELD_BITSIZE (type, idx));
- gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
+ gdb_print_host_address (type->field (idx).type (), gdb_stdout);
printf_filtered (" name '%s' (",
TYPE_FIELD_NAME (type, idx) != NULL
? TYPE_FIELD_NAME (type, idx)
: "<NULL>");
gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
printf_filtered (")\n");
- if (TYPE_FIELD_TYPE (type, idx) != NULL)
+ if (type->field (idx).type () != NULL)
{
- recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
+ recursive_dump_type (type->field (idx).type (), spaces + 4);
}
}
if (type->code () == TYPE_CODE_RANGE)
TYPE_FIELD_ARTIFICIAL (new_type, i) =
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);
+ if (type->field (i).type ())
+ new_type->field (i).set_type
+ (copy_type_recursive (objfile, type->field (i).type (),
+ copied_types));
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
xstrdup (TYPE_FIELD_NAME (type, i));
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);
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;
}
{
SET_FIELD_BITPOS (f[0],
(FIELD_BITPOS (f[-1])
- + (TYPE_LENGTH (FIELD_TYPE (f[-1]))
+ + (TYPE_LENGTH (f[-1].type ())
* TARGET_CHAR_BIT)));
if (alignment)