|| t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind");
- if (TYPE_NAME (t1) != NULL
- && TYPE_NAME (t2) != NULL
- && !strcmp (TYPE_NAME (t1), TYPE_NAME (t2)))
+ if (t1->name () != NULL
+ && t2->name () != NULL
+ && !strcmp (t1->name (), t2->name ()))
return NULL;
/* Upcasting: look in the type of the source to see if it contains the
type of the target as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */
- if (TYPE_NAME (t1) != NULL)
+ if (t1->name () != NULL)
{
- v = search_struct_field (TYPE_NAME (t1),
+ v = search_struct_field (t1->name (),
v2, t2, 1);
if (v)
return v;
/* Downcasting: look in the type of the target to see if it contains the
type of the source as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */
- if (TYPE_NAME (t2) != NULL)
+ if (t2->name () != NULL)
{
/* Try downcasting using the run-time type of the value. */
int full, using_enc;
/* We might be trying to cast to the outermost enclosing
type, in which case search_struct_field won't work. */
- if (TYPE_NAME (real_type) != NULL
- && !strcmp (TYPE_NAME (real_type), TYPE_NAME (t1)))
+ if (real_type->name () != NULL
+ && !strcmp (real_type->name (), t1->name ()))
return v;
- v = search_struct_field (TYPE_NAME (t2), v, real_type, 1);
+ v = search_struct_field (t2->name (), v, real_type, 1);
if (v)
return v;
}
/* Try downcasting using information from the destination type
T2. This wouldn't work properly for classes with virtual
bases, but those were handled above. */
- v = search_struct_field (TYPE_NAME (t2),
+ v = search_struct_field (t2->name (),
value_zero (t1, not_lval), t1, 1);
if (v)
{
if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
{
- struct type *range_type = TYPE_INDEX_TYPE (type);
+ struct type *range_type = type->index_type ();
int val_length = TYPE_LENGTH (type2);
LONGEST low_bound, high_bound, new_length;
if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
&& (code2 == TYPE_CODE_STRUCT || code2 == TYPE_CODE_UNION)
- && TYPE_NAME (type) != 0)
+ && type->name () != 0)
{
struct value *v = value_cast_structs (to_type, arg2);
nbases = TYPE_N_BASECLASSES (type);
if (!looking_for_baseclass)
- for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
+ for (i = type->num_fields () - 1; i >= nbases; i--)
{
const char *t_field_name = TYPE_FIELD_NAME (type, i);
{
struct value *v;
- if (field_is_static (&TYPE_FIELD (type, i)))
+ if (field_is_static (&type->field (i)))
v = value_static_field (type, i);
else
v = value_primitive_field (arg1, offset, i, type);
bitpos is zero in an anonymous union field, so we
have to add the offset of the union here. */
if (field_type->code () == TYPE_CODE_STRUCT
- || (TYPE_NFIELDS (field_type) > 0
+ || (field_type->num_fields () > 0
&& TYPE_FIELD_BITPOS (field_type, 0) == 0))
new_offset += TYPE_FIELD_BITPOS (type, i) / 8;
{
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)),
- TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)),
+ TYPE_FN_FIELD_TYPE (f, j)->num_fields (),
TYPE_FN_FIELD_ARGS (f, j), args))
{
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
error (_("Attempt to extract a component of a value that is not a %s."),
err);
- for (i = TYPE_N_BASECLASSES (t); i < TYPE_NFIELDS (t); i++)
+ for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
{
- if (!field_is_static (&TYPE_FIELD (t, i))
+ if (!field_is_static (&t->field (i))
&& bitpos == TYPE_FIELD_BITPOS (t, i)
&& types_equal (ftype, TYPE_FIELD_TYPE (t, i)))
return value_primitive_field (*argp, 0, i, t);
obj = coerce_ref (obj);
while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR)
obj = coerce_ref (value_ind (obj));
- obj_type_name = TYPE_NAME (value_type (obj));
+ obj_type_name = value_type (obj)->name ();
/* First check whether this is a data member, e.g. a pointer to
a function. */
if (methods != NULL)
{
- nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (methods, ix));
+ nparms = TYPE_FN_FIELD_TYPE (methods, ix)->num_fields ();
static_offset = oload_method_static_p (methods, ix);
}
else
- nparms = TYPE_NFIELDS (SYMBOL_TYPE (functions[ix]));
+ nparms = SYMBOL_TYPE (functions[ix])->num_fields ();
parm_types.reserve (nparms);
for (jj = 0; jj < nparms; jj++)
gdb_assert (type->code () == TYPE_CODE_ENUM
&& TYPE_DECLARED_CLASS (type));
- for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); ++i)
+ for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
{
const char *fname = TYPE_FIELD_NAME (type, i);
int len;
}
error (_("no constant named \"%s\" in enum \"%s\""),
- name, TYPE_NAME (type));
+ name, type->name ());
}
/* C++: Given an aggregate type CURTYPE, and a member name NAME,
{
int start = 0;
- if (TYPE_NFIELDS (t1) > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0))
+ if (t1->num_fields () > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0))
++start;
/* If skipping artificial fields, find the first real field
in T1. */
if (skip_artificial)
{
- while (start < TYPE_NFIELDS (t1)
+ while (start < t1->num_fields ()
&& TYPE_FIELD_ARTIFICIAL (t1, start))
++start;
}
/* Special case: a method taking void. T1 will contain no
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
- if ((TYPE_NFIELDS (t1) - start) == 0 && TYPE_NFIELDS (t2) == 1
+ if ((t1->num_fields () - start) == 0 && t2->num_fields () == 1
&& TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID)
return 1;
- if ((TYPE_NFIELDS (t1) - start) == TYPE_NFIELDS (t2))
+ if ((t1->num_fields () - start) == t2->num_fields ())
{
int i;
- for (i = 0; i < TYPE_NFIELDS (t2); ++i)
+ for (i = 0; i < t2->num_fields (); ++i)
{
if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
TYPE_FIELD_TYPE (t2, i), NULL),
error (_("Internal error: non-aggregate type "
"to value_struct_elt_for_reference"));
- for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
+ for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
const char *t_field_name = TYPE_FIELD_NAME (t, i);
if (t_field_name && strcmp (t_field_name, name) == 0)
{
- if (field_is_static (&TYPE_FIELD (t, i)))
+ if (field_is_static (&t->field (i)))
{
struct value *v = value_static_field (t, i);
if (want_address)
if (retval == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_NAME (curtype));
+ name, curtype->name ());
return retval;
}
const char *name, int want_address,
enum noside noside)
{
- const char *namespace_name = TYPE_NAME (curtype);
+ const char *namespace_name = curtype->name ();
struct block_symbol sym;
struct value *result;
{
warning (_("Couldn't retrieve complete object of RTTI "
"type %s; object may be in register(s)."),
- TYPE_NAME (real_type));
+ real_type->name ());
return argp;
}
if (type_not_associated (array_type))
error (_("array not associated"));
- range_type = TYPE_INDEX_TYPE (array_type);
+ range_type = array_type->index_type ();
if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
error (_("slice from bad array or bitstring"));