gdb: remove TYPE_TARGET_TYPE

Remove the macro, replace all uses by calls to type::target_type.

Change-Id: Ie51d3e1e22f94130176d6abd723255282bb6d1ed
This commit is contained in:
Simon Marchi 2022-07-30 22:43:54 -04:00
parent 8a50fdcefc
commit 27710edb4e
97 changed files with 683 additions and 687 deletions

View File

@ -1496,7 +1496,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
{ {
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *target_type = check_typedef (type->target_type ());
if (TYPE_LENGTH (target_type) > 16) if (TYPE_LENGTH (target_type) > 16)
return -1; return -1;
@ -1526,7 +1526,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
} }
else else
{ {
struct type *target_type = TYPE_TARGET_TYPE (type); struct type *target_type = type->target_type ();
int count = aapcs_is_vfp_call_or_return_candidate_1 int count = aapcs_is_vfp_call_or_return_candidate_1
(target_type, fundamental_type); (target_type, fundamental_type);
@ -1801,7 +1801,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
{ {
const bfd_byte *buf = value_contents (arg).data (); const bfd_byte *buf = value_contents (arg).data ();
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (arg_type)); struct type *target_type = check_typedef (arg_type->target_type ());
if (!pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type), if (!pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type),
buf)) buf))

View File

@ -873,7 +873,7 @@ primary : primary TICK_ACCESS
if (!ada_is_modular_type (type_arg)) if (!ada_is_modular_type (type_arg))
error (_("'modulus must be applied to modular type")); error (_("'modulus must be applied to modular type"));
write_int (pstate, ada_modulus (type_arg), write_int (pstate, ada_modulus (type_arg),
TYPE_TARGET_TYPE (type_arg)); type_arg->target_type ());
} }
; ;

View File

@ -429,7 +429,7 @@ static struct type *
ada_typedef_target_type (struct type *type) ada_typedef_target_type (struct type *type)
{ {
while (type->code () == TYPE_CODE_TYPEDEF) while (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
return type; return type;
} }
@ -739,9 +739,9 @@ get_base_type (struct type *type)
{ {
while (type != NULL && type->code () == TYPE_CODE_RANGE) while (type != NULL && type->code () == TYPE_CODE_RANGE)
{ {
if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL) if (type == type->target_type () || type->target_type () == NULL)
return type; return type;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
return type; return type;
} }
@ -1712,7 +1712,7 @@ desc_base_type (struct type *type)
if (type != NULL if (type != NULL
&& (type->code () == TYPE_CODE_PTR && (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF)) || type->code () == TYPE_CODE_REF))
return ada_check_typedef (TYPE_TARGET_TYPE (type)); return ada_check_typedef (type->target_type ());
else else
return type; return type;
} }
@ -1800,7 +1800,7 @@ desc_bounds_type (struct type *type)
{ {
r = lookup_struct_elt_type (type, "P_BOUNDS", 1); r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
if (r != NULL) if (r != NULL)
return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r))); return ada_check_typedef (ada_check_typedef (r)->target_type ());
} }
return NULL; return NULL;
} }
@ -1844,7 +1844,7 @@ desc_bounds (struct value *arr)
if (p_bounds_type if (p_bounds_type
&& p_bounds_type->code () == TYPE_CODE_PTR) && p_bounds_type->code () == TYPE_CODE_PTR)
{ {
struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type); struct type *target_type = p_bounds_type->target_type ();
if (target_type->is_stub ()) if (target_type->is_stub ())
p_bounds = value_cast (lookup_pointer_type p_bounds = value_cast (lookup_pointer_type
@ -1902,7 +1902,7 @@ desc_data_target_type (struct type *type)
if (data_type if (data_type
&& ada_check_typedef (data_type)->code () == TYPE_CODE_PTR) && ada_check_typedef (data_type)->code () == TYPE_CODE_PTR)
return ada_check_typedef (TYPE_TARGET_TYPE (data_type)); return ada_check_typedef (data_type->target_type ());
} }
return NULL; return NULL;
@ -2042,7 +2042,7 @@ ada_is_array_type (struct type *type)
while (type != NULL while (type != NULL
&& (type->code () == TYPE_CODE_PTR && (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF)) || type->code () == TYPE_CODE_REF))
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
return ada_is_direct_array_type (type); return ada_is_direct_array_type (type);
} }
@ -2056,7 +2056,7 @@ ada_is_simple_array_type (struct type *type)
type = ada_check_typedef (type); type = ada_check_typedef (type);
return (type->code () == TYPE_CODE_ARRAY return (type->code () == TYPE_CODE_ARRAY
|| (type->code () == TYPE_CODE_PTR || (type->code () == TYPE_CODE_PTR
&& (ada_check_typedef (TYPE_TARGET_TYPE (type))->code () && (ada_check_typedef (type->target_type ())->code ()
== TYPE_CODE_ARRAY))); == TYPE_CODE_ARRAY)));
} }
@ -2277,7 +2277,7 @@ ada_is_unconstrained_packed_array_type (struct type *type)
type = desc_base_type (type); type = desc_base_type (type);
/* The structure's first field is a pointer to an array, so this /* The structure's first field is a pointer to an array, so this
fetches the array type. */ fetches the array type. */
type = TYPE_TARGET_TYPE (type->field (0).type ()); type = type->field (0).type ()->target_type ();
if (type->code () == TYPE_CODE_TYPEDEF) if (type->code () == TYPE_CODE_TYPEDEF)
type = ada_typedef_target_type (type); type = ada_typedef_target_type (type);
/* Now we can see if the array elements are packed. */ /* Now we can see if the array elements are packed. */
@ -2327,7 +2327,7 @@ decode_packed_array_bitsize (struct type *type)
gdb_assert (is_thick_pntr (type)); gdb_assert (is_thick_pntr (type));
/* The structure's first field is a pointer to an array, so this /* The structure's first field is a pointer to an array, so this
fetches the array type. */ fetches the array type. */
type = TYPE_TARGET_TYPE (type->field (0).type ()); type = type->field (0).type ()->target_type ();
/* Now we can see if the array elements are packed. */ /* Now we can see if the array elements are packed. */
return TYPE_FIELD_BITSIZE (type, 0); return TYPE_FIELD_BITSIZE (type, 0);
} }
@ -2381,7 +2381,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
new_type = alloc_type_copy (type); new_type = alloc_type_copy (type);
new_elt_type = new_elt_type =
constrained_packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)), constrained_packed_array_type (ada_check_typedef (type->target_type ()),
elt_bits); elt_bits);
create_array_type (new_type, new_elt_type, index_type); create_array_type (new_type, new_elt_type, index_type);
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits; TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
@ -2464,7 +2464,7 @@ recursively_update_array_bitsize (struct type *type)
return 0; return 0;
LONGEST our_len = high - low + 1; LONGEST our_len = high - low + 1;
struct type *elt_type = TYPE_TARGET_TYPE (type); struct type *elt_type = type->target_type ();
if (elt_type->code () == TYPE_CODE_ARRAY) if (elt_type->code () == TYPE_CODE_ARRAY)
{ {
LONGEST elt_len = recursively_update_array_bitsize (elt_type); LONGEST elt_len = recursively_update_array_bitsize (elt_type);
@ -2588,7 +2588,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
(long) idx); (long) idx);
bits = TYPE_FIELD_BITSIZE (elt_type, 0); bits = TYPE_FIELD_BITSIZE (elt_type, 0);
elt_total_bit_offset += (idx - lowerbound) * bits; elt_total_bit_offset += (idx - lowerbound) * bits;
elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type)); elt_type = ada_check_typedef (elt_type->target_type ());
} }
} }
elt_off = elt_total_bit_offset / HOST_CHAR_BIT; elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
@ -3007,7 +3007,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
for (k = 0; k < arity; k += 1) for (k = 0; k < arity; k += 1)
{ {
struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type); struct type *saved_elt_type = elt_type->target_type ();
if (elt_type->code () != TYPE_CODE_ARRAY) if (elt_type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k); error (_("too many subscripts (%d expected)"), k);
@ -3068,11 +3068,11 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
if (type->code () != TYPE_CODE_ARRAY) if (type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k); error (_("too many subscripts (%d expected)"), k);
arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), arr = value_cast (lookup_pointer_type (type->target_type ()),
value_copy (arr)); value_copy (arr));
get_discrete_bounds (type->index_type (), &lwb, &upb); get_discrete_bounds (type->index_type (), &lwb, &upb);
arr = value_ptradd (arr, pos_atr (ind[k]) - lwb); arr = value_ptradd (arr, pos_atr (ind[k]) - lwb);
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
return value_ind (arr); return value_ind (arr);
@ -3087,11 +3087,11 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
int low, int high) int low, int high)
{ {
struct type *type0 = ada_check_typedef (type); struct type *type0 = ada_check_typedef (type);
struct type *base_index_type = TYPE_TARGET_TYPE (type0->index_type ()); struct type *base_index_type = type0->index_type ()->target_type ();
struct type *index_type struct type *index_type
= create_static_range_type (NULL, base_index_type, low, high); = create_static_range_type (NULL, base_index_type, low, high);
struct type *slice_type = create_array_type_with_stride struct type *slice_type = create_array_type_with_stride
(NULL, TYPE_TARGET_TYPE (type0), index_type, (NULL, type0->target_type (), index_type,
type0->dyn_prop (DYN_PROP_BYTE_STRIDE), type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type0, 0)); TYPE_FIELD_BITSIZE (type0, 0));
int base_low = ada_discrete_type_low_bound (type0->index_type ()); int base_low = ada_discrete_type_low_bound (type0->index_type ());
@ -3110,7 +3110,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
ULONGEST stride = TYPE_FIELD_BITSIZE (slice_type, 0) / 8; ULONGEST stride = TYPE_FIELD_BITSIZE (slice_type, 0) / 8;
if (stride == 0) if (stride == 0)
stride = TYPE_LENGTH (TYPE_TARGET_TYPE (type0)); stride = TYPE_LENGTH (type0->target_type ());
base = value_as_address (array_ptr) + (*low_pos - *base_low_pos) * stride; base = value_as_address (array_ptr) + (*low_pos - *base_low_pos) * stride;
return value_at_lazy (slice_type, base); return value_at_lazy (slice_type, base);
@ -3121,11 +3121,11 @@ static struct value *
ada_value_slice (struct value *array, int low, int high) ada_value_slice (struct value *array, int low, int high)
{ {
struct type *type = ada_check_typedef (value_type (array)); struct type *type = ada_check_typedef (value_type (array));
struct type *base_index_type = TYPE_TARGET_TYPE (type->index_type ()); struct type *base_index_type = type->index_type ()->target_type ();
struct type *index_type struct type *index_type
= create_static_range_type (NULL, type->index_type (), low, high); = create_static_range_type (NULL, type->index_type (), low, high);
struct type *slice_type = create_array_type_with_stride struct type *slice_type = create_array_type_with_stride
(NULL, TYPE_TARGET_TYPE (type), index_type, (NULL, type->target_type (), index_type,
type->dyn_prop (DYN_PROP_BYTE_STRIDE), type->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type, 0)); TYPE_FIELD_BITSIZE (type, 0));
gdb::optional<LONGEST> low_pos, high_pos; gdb::optional<LONGEST> low_pos, high_pos;
@ -3167,7 +3167,7 @@ ada_array_arity (struct type *type)
while (type->code () == TYPE_CODE_ARRAY) while (type->code () == TYPE_CODE_ARRAY)
{ {
arity += 1; arity += 1;
type = ada_check_typedef (TYPE_TARGET_TYPE (type)); type = ada_check_typedef (type->target_type ());
} }
return arity; return arity;
@ -3199,7 +3199,7 @@ ada_array_element_type (struct type *type, int nindices)
k = nindices; k = nindices;
while (k > 0 && p_array_type != NULL) while (k > 0 && p_array_type != NULL)
{ {
p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type)); p_array_type = ada_check_typedef (p_array_type->target_type ());
k -= 1; k -= 1;
} }
return p_array_type; return p_array_type;
@ -3208,7 +3208,7 @@ ada_array_element_type (struct type *type, int nindices)
{ {
while (nindices != 0 && type->code () == TYPE_CODE_ARRAY) while (nindices != 0 && type->code () == TYPE_CODE_ARRAY)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
/* A multi-dimensional array is represented using a sequence /* A multi-dimensional array is represented using a sequence
of array types. If one of these types has a name, then of array types. If one of these types has a name, then
it is not another dimension of the outer array, but it is not another dimension of the outer array, but
@ -3242,9 +3242,9 @@ ada_index_type (struct type *type, int n, const char *name)
for (i = 1; i < n; i += 1) for (i = 1; i < n; i += 1)
{ {
type = ada_check_typedef (type); type = ada_check_typedef (type);
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
result_type = TYPE_TARGET_TYPE (ada_check_typedef (type)->index_type ()); result_type = ada_check_typedef (type)->index_type ()->target_type ();
/* FIXME: The stabs type r(0,0);bound;bound in an array type /* FIXME: The stabs type r(0,0);bound;bound in an array type
has a target type of TYPE_CODE_UNDEF. We compensate here, but has a target type of TYPE_CODE_UNDEF. We compensate here, but
perhaps stabsread.c would make more sense. */ perhaps stabsread.c would make more sense. */
@ -3282,7 +3282,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
return (LONGEST) - which; return (LONGEST) - which;
if (arr_type->code () == TYPE_CODE_PTR) if (arr_type->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (arr_type); type = arr_type->target_type ();
else else
type = arr_type; type = arr_type;
@ -3307,7 +3307,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
struct type *elt_type = check_typedef (type); struct type *elt_type = check_typedef (type);
for (i = 1; i < n; i++) for (i = 1; i < n; i++)
elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type)); elt_type = check_typedef (elt_type->target_type ());
index_type = elt_type->index_type (); index_type = elt_type->index_type ();
} }
@ -3376,7 +3376,7 @@ ada_array_length (struct value *arr, int n)
{ {
struct type *base_type; struct type *base_type;
if (index_type->code () == TYPE_CODE_RANGE) if (index_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (index_type); base_type = index_type->target_type ();
else else
base_type = index_type; base_type = index_type;
@ -3396,7 +3396,7 @@ empty_array (struct type *arr_type, int low, int high)
struct type *arr_type0 = ada_check_typedef (arr_type); struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_type struct type *index_type
= create_static_range_type = create_static_range_type
(NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low, (NULL, arr_type0->index_type ()->target_type (), low,
high < low ? low - 1 : high); high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1); struct type *elt_type = ada_array_element_type (arr_type0, 1);
@ -3520,11 +3520,11 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
} }
gdb_printf (stream, ")"); gdb_printf (stream, ")");
} }
if (TYPE_TARGET_TYPE (type) != NULL if (type->target_type () != NULL
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) && type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_printf (stream, " return "); gdb_printf (stream, " return ");
ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags); ada_print_type (type->target_type (), NULL, stream, -1, 0, flags);
} }
} }
@ -3905,9 +3905,9 @@ ada_type_match (struct type *ftype, struct type *atype)
atype = ada_check_typedef (atype); atype = ada_check_typedef (atype);
if (ftype->code () == TYPE_CODE_REF) if (ftype->code () == TYPE_CODE_REF)
ftype = TYPE_TARGET_TYPE (ftype); ftype = ftype->target_type ();
if (atype->code () == TYPE_CODE_REF) if (atype->code () == TYPE_CODE_REF)
atype = TYPE_TARGET_TYPE (atype); atype = atype->target_type ();
switch (ftype->code ()) switch (ftype->code ())
{ {
@ -3916,11 +3916,11 @@ ada_type_match (struct type *ftype, struct type *atype)
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
if (atype->code () != TYPE_CODE_PTR) if (atype->code () != TYPE_CODE_PTR)
return 0; return 0;
atype = TYPE_TARGET_TYPE (atype); atype = atype->target_type ();
/* This can only happen if the actual argument is 'null'. */ /* This can only happen if the actual argument is 'null'. */
if (atype->code () == TYPE_CODE_INT && TYPE_LENGTH (atype) == 0) if (atype->code () == TYPE_CODE_INT && TYPE_LENGTH (atype) == 0)
return 1; return 1;
return ada_type_match (TYPE_TARGET_TYPE (ftype), atype); return ada_type_match (ftype->target_type (), atype);
case TYPE_CODE_INT: case TYPE_CODE_INT:
case TYPE_CODE_ENUM: case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
@ -4002,7 +4002,7 @@ return_match (struct type *func_type, struct type *context_type)
return 1; return 1;
if (func_type->code () == TYPE_CODE_FUNC) if (func_type->code () == TYPE_CODE_FUNC)
return_type = get_base_type (TYPE_TARGET_TYPE (func_type)); return_type = get_base_type (func_type->target_type ());
else else
return_type = get_base_type (func_type); return_type = get_base_type (func_type);
if (return_type == NULL) if (return_type == NULL)
@ -4094,8 +4094,8 @@ numeric_type_p (struct type *type)
case TYPE_CODE_FIXED_POINT: case TYPE_CODE_FIXED_POINT:
return 1; return 1;
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
return (type == TYPE_TARGET_TYPE (type) return (type == type->target_type ()
|| numeric_type_p (TYPE_TARGET_TYPE (type))); || numeric_type_p (type->target_type ()));
default: default:
return 0; return 0;
} }
@ -4116,8 +4116,8 @@ integer_type_p (struct type *type)
case TYPE_CODE_INT: case TYPE_CODE_INT:
return 1; return 1;
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
return (type == TYPE_TARGET_TYPE (type) return (type == type->target_type ()
|| integer_type_p (TYPE_TARGET_TYPE (type))); || integer_type_p (type->target_type ()));
default: default:
return 0; return 0;
} }
@ -4379,7 +4379,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
t1 = t = ada_check_typedef (value_type (arg)); t1 = t = ada_check_typedef (value_type (arg));
if (t->code () == TYPE_CODE_REF) if (t->code () == TYPE_CODE_REF)
{ {
t1 = TYPE_TARGET_TYPE (t); t1 = t->target_type ();
if (t1 == NULL) if (t1 == NULL)
goto BadValue; goto BadValue;
t1 = ada_check_typedef (t1); t1 = ada_check_typedef (t1);
@ -4392,7 +4392,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
while (t->code () == TYPE_CODE_PTR) while (t->code () == TYPE_CODE_PTR)
{ {
t1 = TYPE_TARGET_TYPE (t); t1 = t->target_type ();
if (t1 == NULL) if (t1 == NULL)
goto BadValue; goto BadValue;
t1 = ada_check_typedef (t1); t1 = ada_check_typedef (t1);
@ -4429,7 +4429,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
if (ada_is_tagged_type (t1, 0) if (ada_is_tagged_type (t1, 0)
|| (t1->code () == TYPE_CODE_REF || (t1->code () == TYPE_CODE_REF
&& ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0))) && ada_is_tagged_type (t1->target_type (), 0)))
{ {
/* We first try to find the searched field in the current type. /* We first try to find the searched field in the current type.
If not found then let's look in the fixed type. */ If not found then let's look in the fixed type. */
@ -4497,10 +4497,10 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
struct type *formal_type = ada_check_typedef (formal_type0); struct type *formal_type = ada_check_typedef (formal_type0);
struct type *formal_target = struct type *formal_target =
formal_type->code () == TYPE_CODE_PTR formal_type->code () == TYPE_CODE_PTR
? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type; ? ada_check_typedef (formal_type->target_type ()) : formal_type;
struct type *actual_target = struct type *actual_target =
actual_type->code () == TYPE_CODE_PTR actual_type->code () == TYPE_CODE_PTR
? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type; ? ada_check_typedef (actual_type->target_type ()) : actual_type;
if (ada_is_array_descriptor_type (formal_target) if (ada_is_array_descriptor_type (formal_target)
&& actual_target->code () == TYPE_CODE_ARRAY) && actual_target->code () == TYPE_CODE_ARRAY)
@ -6258,7 +6258,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
if (type->code () != TYPE_CODE_PTR) if (type->code () != TYPE_CODE_PTR)
return 0; return 0;
name = TYPE_TARGET_TYPE (type)->name (); name = type->target_type ()->name ();
if (name == NULL) if (name == NULL)
return 0; return 0;
@ -6351,7 +6351,7 @@ ada_is_tag_type (struct type *type)
return 0; return 0;
else else
{ {
const char *name = ada_type_name (TYPE_TARGET_TYPE (type)); const char *name = ada_type_name (type->target_type ());
return (name != NULL return (name != NULL
&& strcmp (name, "ada__tags__dispatch_table") == 0); && strcmp (name, "ada__tags__dispatch_table") == 0);
@ -6665,7 +6665,7 @@ ada_parent_type (struct type *type)
/* If the _parent field is a pointer, then dereference it. */ /* If the _parent field is a pointer, then dereference it. */
if (parent_type->code () == TYPE_CODE_PTR) if (parent_type->code () == TYPE_CODE_PTR)
parent_type = TYPE_TARGET_TYPE (parent_type); parent_type = parent_type->target_type ();
/* If there is a parallel XVS type, get the actual base type. */ /* If there is a parallel XVS type, get the actual base type. */
parent_type = ada_get_base_type (parent_type); parent_type = ada_get_base_type (parent_type);
@ -6733,7 +6733,7 @@ ada_is_variant_part (struct type *type, int field_num)
return (field_type->code () == TYPE_CODE_UNION return (field_type->code () == TYPE_CODE_UNION
|| (is_dynamic_field (type, field_num) || (is_dynamic_field (type, field_num)
&& (TYPE_TARGET_TYPE (field_type)->code () && (field_type->target_type ()->code ()
== TYPE_CODE_UNION))); == TYPE_CODE_UNION)));
} }
@ -6776,7 +6776,7 @@ ada_variant_discrim_name (struct type *type0)
const char *discrim_start; const char *discrim_start;
if (type0->code () == TYPE_CODE_PTR) if (type0->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (type0); type = type0->target_type ();
else else
type = type0; type = type0;
@ -7321,7 +7321,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
type = ada_check_typedef (type); type = ada_check_typedef (type);
if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF) if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break; break;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
if (type == NULL if (type == NULL
@ -7905,8 +7905,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
{ {
const gdb_byte *field_valaddr = valaddr; const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address; CORE_ADDR field_address = address;
struct type *field_type = struct type *field_type = type->field (f).type ()->target_type ();
TYPE_TARGET_TYPE (type->field (f).type ());
if (dval0 == NULL) if (dval0 == NULL)
{ {
@ -8090,7 +8089,7 @@ template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr,
no runtime values. Useless for use in values, but that's OK, no runtime values. Useless for use in values, but that's OK,
since the results are used only for type determinations. Works on both since the results are used only for type determinations. Works on both
structs and unions. Representation note: to save space, we memorize structs and unions. Representation note: to save space, we memorize
the result of this function in the TYPE_TARGET_TYPE of the the result of this function in the type::target_type of the
template type. */ template type. */
static struct type * static struct type *
@ -8105,8 +8104,8 @@ template_to_static_fixed_type (struct type *type0)
return type0; return type0;
/* Likewise if we already have computed the static approximation. */ /* Likewise if we already have computed the static approximation. */
if (TYPE_TARGET_TYPE (type0) != NULL) if (type0->target_type () != NULL)
return TYPE_TARGET_TYPE (type0); return type0->target_type ();
/* Don't clone TYPE0 until we are sure we are going to need a copy. */ /* Don't clone TYPE0 until we are sure we are going to need a copy. */
type = type0; type = type0;
@ -8124,7 +8123,7 @@ template_to_static_fixed_type (struct type *type0)
if (is_dynamic_field (type0, f)) if (is_dynamic_field (type0, f))
{ {
field_type = ada_check_typedef (field_type); field_type = ada_check_typedef (field_type);
new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); new_type = to_static_fixed_type (field_type->target_type ());
} }
else else
new_type = static_unwrap_type (field_type); new_type = static_unwrap_type (field_type);
@ -8294,7 +8293,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
struct type *var_type; struct type *var_type;
if (var_type0->code () == TYPE_CODE_PTR) if (var_type0->code () == TYPE_CODE_PTR)
var_type = TYPE_TARGET_TYPE (var_type0); var_type = var_type0->target_type ();
else else
var_type = var_type0; var_type = var_type0;
@ -8311,8 +8310,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
return empty_record (var_type); return empty_record (var_type);
else if (is_dynamic_field (var_type, which)) else if (is_dynamic_field (var_type, which))
return to_fixed_record_type return to_fixed_record_type
(TYPE_TARGET_TYPE (var_type->field (which).type ()), (var_type->field (which).type ()->target_type(), valaddr, address, dval);
valaddr, address, dval);
else if (variant_field_index (var_type->field (which).type ()) >= 0) else if (variant_field_index (var_type->field (which).type ()) >= 0)
return return
to_fixed_record_type to_fixed_record_type
@ -8387,7 +8385,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
if (!ada_is_redundant_range_encoding (this_layer->index_type (), if (!ada_is_redundant_range_encoding (this_layer->index_type (),
desc_type->field (i).type ())) desc_type->field (i).type ()))
return 0; return 0;
this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer)); this_layer = check_typedef (this_layer->target_type ());
} }
return 1; return 1;
@ -8460,7 +8458,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
if (index_type_desc == NULL) if (index_type_desc == NULL)
{ {
struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0)); struct type *elt_type0 = ada_check_typedef (type0->target_type ());
/* NOTE: elt_type---the fixed version of elt_type0---should never /* NOTE: elt_type---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed depend on the contents of the array in properly constructed
@ -8491,7 +8489,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
elt_type0 = type0; elt_type0 = type0;
for (i = index_type_desc->num_fields (); i > 0; i -= 1) for (i = index_type_desc->num_fields (); i > 0; i -= 1)
elt_type0 = TYPE_TARGET_TYPE (elt_type0); elt_type0 = elt_type0->target_type ();
/* NOTE: result---the fixed version of elt_type0---should never /* NOTE: result---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed depend on the contents of the array in properly constructed
@ -8515,7 +8513,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
result = create_array_type (alloc_type_copy (elt_type0), result = create_array_type (alloc_type_copy (elt_type0),
result, range_type); result, range_type);
elt_type0 = TYPE_TARGET_TYPE (elt_type0); elt_type0 = elt_type0->target_type ();
} }
} }
@ -8530,7 +8528,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
type was a regular (non-packed) array type. As a result, the type was a regular (non-packed) array type. As a result, the
bitsize of the array elements needs to be set again, and the array bitsize of the array elements needs to be set again, and the array
length needs to be recomputed based on that bitsize. */ length needs to be recomputed based on that bitsize. */
int len = TYPE_LENGTH (result) / TYPE_LENGTH (TYPE_TARGET_TYPE (result)); int len = TYPE_LENGTH (result) / TYPE_LENGTH (result->target_type ());
int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0); int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0);
TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0); TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
@ -8941,7 +8939,7 @@ val_atr (struct type *type, LONGEST val)
{ {
gdb_assert (discrete_type_p (type)); gdb_assert (discrete_type_p (type));
if (type->code () == TYPE_CODE_RANGE) if (type->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_ENUM) if (type->code () == TYPE_CODE_ENUM)
{ {
if (val < 0 || val >= type->num_fields ()) if (val < 0 || val >= type->num_fields ())
@ -9088,7 +9086,7 @@ ada_get_base_type (struct type *raw_type)
} }
/* The field in our XVS type is a reference to the base type. */ /* The field in our XVS type is a reference to the base type. */
return TYPE_TARGET_TYPE (real_type_namer->field (0).type ()); return real_type_namer->field (0).type ()->target_type ();
} }
/* The type of value designated by TYPE, with all aligners removed. */ /* The type of value designated by TYPE, with all aligners removed. */
@ -9272,7 +9270,7 @@ ada_same_array_size_p (struct type *t1, struct type *t2)
static struct value * static struct value *
ada_promote_array_of_integrals (struct type *type, struct value *val) ada_promote_array_of_integrals (struct type *type, struct value *val)
{ {
struct type *elt_type = TYPE_TARGET_TYPE (type); struct type *elt_type = type->target_type ();
LONGEST lo, hi; LONGEST lo, hi;
LONGEST i; LONGEST i;
@ -9280,11 +9278,11 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
that the size of val's elements is smaller than the size that the size of val's elements is smaller than the size
of type's element. */ of type's element. */
gdb_assert (type->code () == TYPE_CODE_ARRAY); gdb_assert (type->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (TYPE_TARGET_TYPE (type))); gdb_assert (is_integral_type (type->target_type ()));
gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY); gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (TYPE_TARGET_TYPE (value_type (val)))); gdb_assert (is_integral_type (value_type (val)->target_type ()));
gdb_assert (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) gdb_assert (TYPE_LENGTH (type->target_type ())
> TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val)))); > TYPE_LENGTH (value_type (val)->target_type ()));
if (!get_array_bounds (type, &lo, &hi)) if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds")); error (_("unable to determine array bounds"));
@ -9331,18 +9329,18 @@ coerce_for_assign (struct type *type, struct value *val)
if (!ada_same_array_size_p (type, type2)) if (!ada_same_array_size_p (type, type2))
error (_("cannot assign arrays of different length")); error (_("cannot assign arrays of different length"));
if (is_integral_type (TYPE_TARGET_TYPE (type)) if (is_integral_type (type->target_type ())
&& is_integral_type (TYPE_TARGET_TYPE (type2)) && is_integral_type (type2->target_type ())
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type2)) && TYPE_LENGTH (type2->target_type ())
< TYPE_LENGTH (TYPE_TARGET_TYPE (type))) < TYPE_LENGTH (type->target_type ()))
{ {
/* Allow implicit promotion of the array elements to /* Allow implicit promotion of the array elements to
a wider type. */ a wider type. */
return ada_promote_array_of_integrals (type, val); return ada_promote_array_of_integrals (type, val);
} }
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2)) if (TYPE_LENGTH (type2->target_type ())
!= TYPE_LENGTH (TYPE_TARGET_TYPE (type))) != TYPE_LENGTH (type->target_type ()))
error (_("Incompatible types in assignment")); error (_("Incompatible types in assignment"));
deprecated_set_value_type (val, type); deprecated_set_value_type (val, type);
} }
@ -10193,7 +10191,7 @@ ada_atr_size (struct type *expect_type,
the user is really asking for the size of the actual object, the user is really asking for the size of the actual object,
not the size of the pointer. */ not the size of the pointer. */
if (type->code () == TYPE_CODE_REF) if (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
@ -10278,9 +10276,9 @@ ada_ternop_slice (struct expression *exp,
/* If this is a reference to an aligner type, then remove all /* If this is a reference to an aligner type, then remove all
the aligners. */ the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF if (value_type (array)->code () == TYPE_CODE_REF
&& ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) && ada_is_aligner_type (value_type (array)->target_type ()))
value_type (array)->set_target_type value_type (array)->set_target_type
(ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)))); (ada_aligned_type (value_type (array)->target_type ()));
if (ada_is_any_packed_array_type (value_type (array))) if (ada_is_any_packed_array_type (value_type (array)))
error (_("cannot slice a packed array")); error (_("cannot slice a packed array"));
@ -10303,7 +10301,7 @@ ada_ternop_slice (struct expression *exp,
/* If we have more than one level of pointer indirection, /* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */ dereference the value until we get only one level. */
while (value_type (array)->code () == TYPE_CODE_PTR while (value_type (array)->code () == TYPE_CODE_PTR
&& (TYPE_TARGET_TYPE (value_type (array))->code () && (value_type (array)->target_type ()->code ()
== TYPE_CODE_PTR)) == TYPE_CODE_PTR))
array = value_ind (array); array = value_ind (array);
@ -10320,11 +10318,11 @@ ada_ternop_slice (struct expression *exp,
struct type *type0 = ada_check_typedef (value_type (array)); struct type *type0 = ada_check_typedef (value_type (array));
if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS) if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound); return empty_array (type0->target_type (), low_bound, high_bound);
else else
{ {
struct type *arr_type0 = struct type *arr_type0 =
to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1); to_fixed_array_type (type0->target_type (), NULL, 1);
return ada_value_slice_from_ptr (array, arr_type0, return ada_value_slice_from_ptr (array, arr_type0,
longest_to_int (low_bound), longest_to_int (low_bound),
@ -10741,7 +10739,7 @@ ada_concat_operation::evaluate (struct type *expect_type,
struct type *rhs_type = check_typedef (value_type (rhs)); struct type *rhs_type = check_typedef (value_type (rhs));
struct type *elt_type = nullptr; struct type *elt_type = nullptr;
if (rhs_type->code () == TYPE_CODE_ARRAY) if (rhs_type->code () == TYPE_CODE_ARRAY)
elt_type = TYPE_TARGET_TYPE (rhs_type); elt_type = rhs_type->target_type ();
lhs = lhs_expr->evaluate (elt_type, exp, noside); lhs = lhs_expr->evaluate (elt_type, exp, noside);
} }
else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr) else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr)
@ -10755,7 +10753,7 @@ ada_concat_operation::evaluate (struct type *expect_type,
struct type *lhs_type = check_typedef (value_type (lhs)); struct type *lhs_type = check_typedef (value_type (lhs));
struct type *elt_type = nullptr; struct type *elt_type = nullptr;
if (lhs_type->code () == TYPE_CODE_ARRAY) if (lhs_type->code () == TYPE_CODE_ARRAY)
elt_type = TYPE_TARGET_TYPE (lhs_type); elt_type = lhs_type->target_type ();
rhs = rhs_expr->evaluate (elt_type, exp, noside); rhs = rhs_expr->evaluate (elt_type, exp, noside);
} }
else else
@ -10812,7 +10810,7 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
a reference type, find its underlying type. */ a reference type, find its underlying type. */
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
while (type->code () == TYPE_CODE_REF) while (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
arg1 = value_binop (arg1, arg2, std::get<0> (m_storage)); arg1 = value_binop (arg1, arg2, std::get<0> (m_storage));
/* We need to special-case the result with a range. /* We need to special-case the result with a range.
@ -10915,7 +10913,7 @@ ada_var_value_operation::evaluate (struct type *expect_type,
a reference should mostly be transparent to the user. */ a reference should mostly be transparent to the user. */
if (ada_is_tagged_type (type, 0) if (ada_is_tagged_type (type, 0)
|| (type->code () == TYPE_CODE_REF || (type->code () == TYPE_CODE_REF
&& ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))) && ada_is_tagged_type (type->target_type (), 0)))
{ {
/* Tagged types are a little special in the fact that the real /* Tagged types are a little special in the fact that the real
type is dynamic and can only be determined by inspecting the type is dynamic and can only be determined by inspecting the
@ -11045,7 +11043,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
if ((type->code () == TYPE_CODE_REF if ((type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_PTR) || type->code () == TYPE_CODE_PTR)
&& ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)) && ada_is_tagged_type (type->target_type (), 0))
{ {
arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_NORMAL); EVAL_NORMAL);
@ -11055,7 +11053,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
{ {
type = to_static_fixed_type type = to_static_fixed_type
(ada_aligned_type (ada_aligned_type
(ada_check_typedef (TYPE_TARGET_TYPE (type)))); (ada_check_typedef (type->target_type ())));
} }
return value_zero (type, lval_memory); return value_zero (type, lval_memory);
} }
@ -11192,17 +11190,17 @@ ada_funcall_operation::evaluate (struct type *expect_type,
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
{ {
switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()) switch (ada_check_typedef (type->target_type ())->code ())
{ {
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
type = ada_check_typedef (TYPE_TARGET_TYPE (type)); type = ada_check_typedef (type->target_type ());
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
break; break;
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
if (noside != EVAL_AVOID_SIDE_EFFECTS) if (noside != EVAL_AVOID_SIDE_EFFECTS)
callee = ada_value_ind (callee); callee = ada_value_ind (callee);
type = ada_check_typedef (TYPE_TARGET_TYPE (type)); type = ada_check_typedef (type->target_type ());
break; break;
default: default:
error (_("cannot subscript or call something of type `%s'"), error (_("cannot subscript or call something of type `%s'"),
@ -11216,9 +11214,9 @@ ada_funcall_operation::evaluate (struct type *expect_type,
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
if (TYPE_TARGET_TYPE (type) == NULL) if (type->target_type () == NULL)
error_call_unknown_return_type (NULL); error_call_unknown_return_type (NULL);
return allocate_value (TYPE_TARGET_TYPE (type)); return allocate_value (type->target_type ());
} }
return call_function_by_hand (callee, NULL, argvec); return call_function_by_hand (callee, NULL, argvec);
case TYPE_CODE_INTERNAL_FUNCTION: case TYPE_CODE_INTERNAL_FUNCTION:
@ -11265,7 +11263,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
case TYPE_CODE_PTR: /* Pointer to array */ case TYPE_CODE_PTR: /* Pointer to array */
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1); type = to_fixed_array_type (type->target_type (), NULL, 1);
type = ada_array_element_type (type, nargs); type = ada_array_element_type (type, nargs);
if (type == NULL) if (type == NULL)
error (_("element type of array unknown")); error (_("element type of array unknown"));
@ -11459,7 +11457,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
gdb_assert (raw_type->name () != NULL); gdb_assert (raw_type->name () != NULL);
if (raw_type->code () == TYPE_CODE_RANGE) if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type); base_type = raw_type->target_type ();
else else
base_type = raw_type; base_type = raw_type;
@ -13769,7 +13767,7 @@ public:
gdb::unique_xmalloc_ptr<char> watch_location_expression gdb::unique_xmalloc_ptr<char> watch_location_expression
(struct type *type, CORE_ADDR addr) const override (struct type *type, CORE_ADDR addr) const override
{ {
type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type); std::string name = type_to_string (type);
return xstrprintf ("{%s} %s", name.c_str (), core_addr_to_string (addr)); return xstrprintf ("{%s} %s", name.c_str (), core_addr_to_string (addr));
} }

View File

@ -436,7 +436,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
bounds_type = type->field (bounds_fieldno).type (); bounds_type = type->field (bounds_fieldno).type ();
if (bounds_type->code () == TYPE_CODE_PTR) if (bounds_type->code () == TYPE_CODE_PTR)
bounds_type = TYPE_TARGET_TYPE (bounds_type); bounds_type = bounds_type->target_type ();
if (bounds_type->code () != TYPE_CODE_STRUCT) if (bounds_type->code () != TYPE_CODE_STRUCT)
error (_("Unknown task name format. Aborting")); error (_("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0); upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
@ -909,7 +909,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
struct type *idxtype = NULL; struct type *idxtype = NULL;
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
eltype = check_typedef (TYPE_TARGET_TYPE (type)); eltype = check_typedef (type->target_type ());
if (eltype != NULL if (eltype != NULL
&& eltype->code () == TYPE_CODE_PTR) && eltype->code () == TYPE_CODE_PTR)
idxtype = check_typedef (type->index_type ()); idxtype = check_typedef (type->index_type ());

View File

@ -104,7 +104,7 @@ type_is_full_subrange_of_target_type (struct type *type)
if (type->code () != TYPE_CODE_RANGE) if (type->code () != TYPE_CODE_RANGE)
return 0; return 0;
subtype = TYPE_TARGET_TYPE (type); subtype = type->target_type ();
if (subtype == NULL) if (subtype == NULL)
return 0; return 0;
@ -143,7 +143,7 @@ print_range (struct type *type, struct ui_file *stream,
array ('["00"]' .. '["ff"]') of ... */ array ('["00"]' .. '["ff"]') of ... */
while (type_is_full_subrange_of_target_type (type)) while (type_is_full_subrange_of_target_type (type))
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
switch (type->code ()) switch (type->code ())
@ -271,7 +271,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
gdb_assert (name != NULL); gdb_assert (name != NULL);
if (raw_type->code () == TYPE_CODE_RANGE) if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type); base_type = raw_type->target_type ();
else else
base_type = raw_type; base_type = raw_type;
@ -390,7 +390,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
name, then it is not another dimension of the outer name, then it is not another dimension of the outer
array, but rather the element type of the outermost array, but rather the element type of the outermost
array. */ array. */
arr_type = TYPE_TARGET_TYPE (arr_type); arr_type = arr_type->target_type ();
if (arr_type->name () != nullptr) if (arr_type->name () != nullptr)
break; break;
} }
@ -402,7 +402,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
n_indices = range_desc_type->num_fields (); n_indices = range_desc_type->num_fields ();
for (k = 0, arr_type = type; for (k = 0, arr_type = type;
k < n_indices; k < n_indices;
k += 1, arr_type = TYPE_TARGET_TYPE (arr_type)) k += 1, arr_type = arr_type->target_type ())
{ {
if (k > 0) if (k > 0)
gdb_printf (stream, ", "); gdb_printf (stream, ", ");
@ -564,7 +564,7 @@ print_variant_clauses (struct type *type, int field_num,
if (var_type->code () == TYPE_CODE_PTR) if (var_type->code () == TYPE_CODE_PTR)
{ {
var_type = TYPE_TARGET_TYPE (var_type); var_type = var_type->target_type ();
if (var_type == NULL || var_type->code () != TYPE_CODE_UNION) if (var_type == NULL || var_type->code () != TYPE_CODE_UNION)
return; return;
} }
@ -884,8 +884,8 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
{ {
int i, len = type->num_fields (); int i, len = type->num_fields ();
if (TYPE_TARGET_TYPE (type) != NULL if (type->target_type () != NULL
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID) && type->target_type ()->code () == TYPE_CODE_VOID)
gdb_printf (stream, "procedure"); gdb_printf (stream, "procedure");
else else
gdb_printf (stream, "function"); gdb_printf (stream, "function");
@ -913,12 +913,12 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
gdb_printf (stream, ")"); gdb_printf (stream, ")");
} }
if (TYPE_TARGET_TYPE (type) == NULL) if (type->target_type () == NULL)
gdb_printf (stream, " return <unknown return type>"); gdb_printf (stream, " return <unknown return type>");
else if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) else if (type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_printf (stream, " return "); gdb_printf (stream, " return ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags); ada_print_type (type->target_type (), "", stream, 0, 0, flags);
} }
} }
@ -998,12 +998,12 @@ ada_print_type (struct type *type0, const char *varstring,
if (type->code () != TYPE_CODE_PTR if (type->code () != TYPE_CODE_PTR
|| strstr (varstring, "___XVL") == nullptr) || strstr (varstring, "___XVL") == nullptr)
gdb_printf (stream, "access "); gdb_printf (stream, "access ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, ada_print_type (type->target_type (), "", stream, show, level,
flags); flags);
break; break;
case TYPE_CODE_REF: case TYPE_CODE_REF:
gdb_printf (stream, "<ref> "); gdb_printf (stream, "<ref> ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, ada_print_type (type->target_type (), "", stream, show, level,
flags); flags);
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:

View File

@ -80,7 +80,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type,
of an enumerated type, where the underlying value of the of an enumerated type, where the underlying value of the
first element is typically 0, we might test the low bound first element is typically 0, we might test the low bound
against the wrong value. */ against the wrong value. */
index_type = TYPE_TARGET_TYPE (index_type); index_type = index_type->target_type ();
} }
/* Don't print the lower bound if it's the default one. */ /* Don't print the lower bound if it's the default one. */
@ -130,7 +130,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
struct value *mark = value_mark (); struct value *mark = value_mark ();
LONGEST low = 0; LONGEST low = 0;
elttype = TYPE_TARGET_TYPE (type); elttype = type->target_type ();
index_type = type->index_type (); index_type = type->index_type ();
{ {
@ -151,7 +151,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
} }
if (index_type->code () == TYPE_CODE_RANGE) if (index_type->code () == TYPE_CODE_RANGE)
index_type = TYPE_TARGET_TYPE (index_type); index_type = index_type->target_type ();
i = 0; i = 0;
annotate_array_section_begin (i, elttype); annotate_array_section_begin (i, elttype);
@ -421,7 +421,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break; break;
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream); ada_print_scalar (type->target_type (), val, stream);
return; return;
case TYPE_CODE_UNDEF: case TYPE_CODE_UNDEF:
@ -688,7 +688,7 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
const struct value_print_options *options) const struct value_print_options *options)
{ {
enum bfd_endian byte_order = type_byte_order (type); enum bfd_endian byte_order = type_byte_order (type);
struct type *elttype = TYPE_TARGET_TYPE (type); struct type *elttype = type->target_type ();
unsigned int eltlen; unsigned int eltlen;
unsigned int len; unsigned int len;
@ -731,8 +731,8 @@ ada_value_print_ptr (struct value *val,
const struct value_print_options *options) const struct value_print_options *options)
{ {
if (!options->format if (!options->format
&& TYPE_TARGET_TYPE (value_type (val))->code () == TYPE_CODE_INT && value_type (val)->target_type ()->code () == TYPE_CODE_INT
&& TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))) == 0) && TYPE_LENGTH (value_type (val)->target_type ()) == 0)
{ {
gdb_puts ("null", stream); gdb_puts ("null", stream);
return; return;
@ -761,15 +761,15 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (type->code () == TYPE_CODE_RANGE if (type->code () == TYPE_CODE_RANGE
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM && (type->target_type ()->code () == TYPE_CODE_ENUM
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL || type->target_type ()->code () == TYPE_CODE_BOOL
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR)) || type->target_type ()->code () == TYPE_CODE_CHAR))
{ {
/* For enum-valued ranges, we want to recurse, because we'll end /* For enum-valued ranges, we want to recurse, because we'll end
up printing the constant's name rather than its numeric up printing the constant's name rather than its numeric
value. Character and fixed-point types are also printed value. Character and fixed-point types are also printed
differently, so recuse for those as well. */ differently, so recuse for those as well. */
struct type *target_type = TYPE_TARGET_TYPE (type); struct type *target_type = type->target_type ();
val = value_cast (target_type, val); val = value_cast (target_type, val);
common_val_print (val, stream, recurse + 1, options, common_val_print (val, stream, recurse + 1, options,
language_def (language_ada)); language_def (language_ada));
@ -946,7 +946,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
of the object value would be confusing to an Ada programmer. of the object value would be confusing to an Ada programmer.
So, for Ada values, we print the actual dereferenced value So, for Ada values, we print the actual dereferenced value
regardless. */ regardless. */
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val; struct value *deref_val;
CORE_ADDR deref_val_int; CORE_ADDR deref_val_int;
@ -1093,14 +1093,14 @@ ada_value_print (struct value *val0, struct ui_file *stream,
/* If it is a pointer, indicate what it points to; but not for /* If it is a pointer, indicate what it points to; but not for
"void *" pointers. */ "void *" pointers. */
if (type->code () == TYPE_CODE_PTR if (type->code () == TYPE_CODE_PTR
&& !(TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_INT && !(type->target_type ()->code () == TYPE_CODE_INT
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == 0)) && TYPE_LENGTH (type->target_type ()) == 0))
{ {
/* Hack: don't print (char *) for char strings. Their /* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */ type is indicated by the quoted string anyway. */
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char) if (TYPE_LENGTH (type->target_type ()) != sizeof (char)
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT || type->target_type ()->code () != TYPE_CODE_INT
|| TYPE_TARGET_TYPE (type)->is_unsigned ()) || type->target_type ()->is_unsigned ())
{ {
gdb_printf (stream, "("); gdb_printf (stream, "(");
type_print (type, "", stream, -1); type_print (type, "", stream, -1);

View File

@ -137,7 +137,7 @@ ada_varobj_ind (struct value *parent_value,
/* Decode parent_type by the equivalent pointer to (decoded) /* Decode parent_type by the equivalent pointer to (decoded)
array. */ array. */
while (parent_type->code () == TYPE_CODE_TYPEDEF) while (parent_type->code () == TYPE_CODE_TYPEDEF)
parent_type = TYPE_TARGET_TYPE (parent_type); parent_type = parent_type->target_type ();
parent_type = ada_coerce_to_simple_array_type (parent_type); parent_type = ada_coerce_to_simple_array_type (parent_type);
parent_type = lookup_pointer_type (parent_type); parent_type = lookup_pointer_type (parent_type);
} }
@ -153,7 +153,7 @@ ada_varobj_ind (struct value *parent_value,
type = value_type (value); type = value_type (value);
} }
else else
type = TYPE_TARGET_TYPE (parent_type); type = parent_type->target_type ();
if (child_value) if (child_value)
*child_value = value; *child_value = value;
@ -184,7 +184,7 @@ ada_varobj_simple_array_elt (struct value *parent_value,
type = value_type (value); type = value_type (value);
} }
else else
type = TYPE_TARGET_TYPE (parent_type); type = parent_type->target_type ();
if (child_value) if (child_value)
*child_value = value; *child_value = value;
@ -207,12 +207,12 @@ ada_varobj_adjust_for_child_access (struct value **value,
the struct/union type. We handle this situation by dereferencing the struct/union type. We handle this situation by dereferencing
the (value, type) couple. */ the (value, type) couple. */
if ((*type)->code () == TYPE_CODE_PTR if ((*type)->code () == TYPE_CODE_PTR
&& (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT && ((*type)->target_type ()->code () == TYPE_CODE_STRUCT
|| TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION) || (*type)->target_type ()->code () == TYPE_CODE_UNION)
&& *value != nullptr && *value != nullptr
&& value_as_address (*value) != 0 && value_as_address (*value) != 0
&& !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type)) && !ada_is_array_descriptor_type ((*type)->target_type ())
&& !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type))) && !ada_is_constrained_packed_array_type ((*type)->target_type ()))
ada_varobj_ind (*value, *type, value, type); ada_varobj_ind (*value, *type, value, type);
/* If this is a tagged type, we need to transform it a bit in order /* If this is a tagged type, we need to transform it a bit in order
@ -327,7 +327,7 @@ static int
ada_varobj_get_ptr_number_of_children (struct value *parent_value, ada_varobj_get_ptr_number_of_children (struct value *parent_value,
struct type *parent_type) struct type *parent_type)
{ {
struct type *child_type = TYPE_TARGET_TYPE (parent_type); struct type *child_type = parent_type->target_type ();
/* Pointer to functions and to void do not have a child, since /* Pointer to functions and to void do not have a child, since
you cannot print what they point to. */ you cannot print what they point to. */
@ -634,7 +634,7 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
/* If the index type is a range type, find the base type. */ /* If the index type is a range type, find the base type. */
while (index_type->code () == TYPE_CODE_RANGE) while (index_type->code () == TYPE_CODE_RANGE)
index_type = TYPE_TARGET_TYPE (index_type); index_type = index_type->target_type ();
if (index_type->code () == TYPE_CODE_ENUM if (index_type->code () == TYPE_CODE_ENUM
|| index_type->code () == TYPE_CODE_BOOL) || index_type->code () == TYPE_CODE_BOOL)
@ -946,7 +946,7 @@ ada_value_is_changeable_p (const struct varobj *var)
? value_type (var->value.get ()) : var->type); ? value_type (var->value.get ()) : var->type);
if (type->code () == TYPE_CODE_REF) if (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (ada_is_access_to_unconstrained_array (type)) if (ada_is_access_to_unconstrained_array (type))
{ {

View File

@ -684,7 +684,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *subtype = check_typedef (type->target_type ());
/* All fields in an array have the same type. */ /* All fields in an array have the same type. */
amd64_classify (subtype, theclass); amd64_classify (subtype, theclass);

View File

@ -373,7 +373,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
/* __m128, __m128i and __m128d are returned via XMM0. */ /* __m128, __m128i and __m128d are returned via XMM0. */
if (type->is_vector () && len == 16) if (type->is_vector () && len == 16)
{ {
enum type_code code = TYPE_TARGET_TYPE (type)->code (); enum type_code code = type->target_type ()->code ();
if (code == TYPE_CODE_INT || code == TYPE_CODE_FLT) if (code == TYPE_CODE_INT || code == TYPE_CODE_FLT)
{ {
regnum = AMD64_XMM0_REGNUM; regnum = AMD64_XMM0_REGNUM;

View File

@ -4296,7 +4296,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int count; int count;
unsigned unitlen; unsigned unitlen;
count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), count = arm_vfp_cprc_sub_candidate (t->target_type (),
base_type); base_type);
if (count == -1) if (count == -1)
return -1; return -1;
@ -4442,7 +4442,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
applies. */ applies. */
ftype = check_typedef (value_type (function)); ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); ftype = check_typedef (ftype->target_type ());
use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype); use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
/* Set the return address. For the ARM, the return breakpoint is /* Set the return address. For the ARM, the return breakpoint is
@ -4485,7 +4485,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
arg_type = check_typedef (value_type (args[argnum])); arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type); len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (arg_type); target_type = arg_type->target_type ();
typecode = arg_type->code (); typecode = arg_type->code ();
val = value_contents (args[argnum]).data (); val = value_contents (args[argnum]).data ();

View File

@ -319,8 +319,8 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
avr_convert_iaddr_to_raw (addr)); avr_convert_iaddr_to_raw (addr));
} }
/* Is it a code address? */ /* Is it a code address? */
else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC else if (type->target_type ()->code () == TYPE_CODE_FUNC
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD) || type->target_type ()->code () == TYPE_CODE_METHOD)
{ {
/* A code pointer is word (16 bits) addressed. We shift the address down /* A code pointer is word (16 bits) addressed. We shift the address down
by 1 bit to convert it to a pointer. */ by 1 bit to convert it to a pointer. */
@ -350,9 +350,9 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
return avr_make_iaddr (addr); return avr_make_iaddr (addr);
} }
/* Is it a code address? */ /* Is it a code address? */
else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC else if (type->target_type ()->code () == TYPE_CODE_FUNC
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD || type->target_type ()->code () == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) || TYPE_CODE_SPACE (type->target_type ()))
{ {
/* A code pointer is word (16 bits) addressed so we shift it up /* A code pointer is word (16 bits) addressed so we shift it up
by 1 bit to convert it to an address. */ by 1 bit to convert it to an address. */

View File

@ -255,7 +255,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
int string_trace = 0; int string_trace = 0;
if (ax->trace_string if (ax->trace_string
&& value->type->code () == TYPE_CODE_PTR && value->type->code () == TYPE_CODE_PTR
&& c_textual_element_type (check_typedef (TYPE_TARGET_TYPE (value->type)), && c_textual_element_type (check_typedef (value->type->target_type ()),
's')) 's'))
string_trace = 1; string_trace = 1;
@ -367,7 +367,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
} }
if (type->code () == TYPE_CODE_RANGE) if (type->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
switch (type->code ()) switch (type->code ())
{ {
@ -735,7 +735,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
are no longer an lvalue. */ are no longer an lvalue. */
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
{ {
struct type *elements = TYPE_TARGET_TYPE (value->type); struct type *elements = value->type->target_type ();
value->type = lookup_pointer_type (elements); value->type = lookup_pointer_type (elements);
value->kind = axs_rvalue; value->kind = axs_rvalue;
@ -946,7 +946,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
static void static void
gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type) gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
{ {
struct type *element = TYPE_TARGET_TYPE (type); struct type *element = type->target_type ();
if (TYPE_LENGTH (element) != 1) if (TYPE_LENGTH (element) != 1)
{ {
@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
gdb_assert (value1->type->is_pointer_or_reference ()); gdb_assert (value1->type->is_pointer_or_reference ());
gdb_assert (value2->type->is_pointer_or_reference ()); gdb_assert (value2->type->is_pointer_or_reference ());
if (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type)) if (TYPE_LENGTH (value1->type->target_type ())
!= TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type))) != TYPE_LENGTH (value2->type->target_type ()))
error (_("\ error (_("\
First argument of `-' is a pointer, but second argument is neither\n\ First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type.")); an integer nor a pointer of the same type."));
@ -1104,7 +1104,7 @@ gen_deref (struct axs_value *value)
actually emit any code; we just change the type from "Pointer to actually emit any code; we just change the type from "Pointer to
T" to "T", and mark the value as an lvalue in memory. Leave it T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */ to the consumer to actually dereference it. */
value->type = check_typedef (TYPE_TARGET_TYPE (value->type)); value->type = check_typedef (value->type->target_type ());
if (value->type->code () == TYPE_CODE_VOID) if (value->type->code () == TYPE_CODE_VOID)
error (_("Attempt to dereference a generic pointer.")); error (_("Attempt to dereference a generic pointer."));
value->kind = ((value->type->code () == TYPE_CODE_FUNC) value->kind = ((value->type->code () == TYPE_CODE_FUNC)

View File

@ -440,14 +440,14 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
{ {
/* Get the return type of the resolver. */ /* Get the return type of the resolver. */
struct type *resolver_ret_type struct type *resolver_ret_type
= check_typedef (TYPE_TARGET_TYPE (resolver_type)); = check_typedef (resolver_type->target_type ());
/* If we found a pointer to function, then the resolved type /* If we found a pointer to function, then the resolved type
is the type of the pointed-to function. */ is the type of the pointed-to function. */
if (resolver_ret_type->code () == TYPE_CODE_PTR) if (resolver_ret_type->code () == TYPE_CODE_PTR)
{ {
struct type *resolved_type struct type *resolved_type
= TYPE_TARGET_TYPE (resolver_ret_type); = resolver_ret_type->target_type ();
if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC) if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
return resolved_type; return resolved_type;
} }

View File

@ -865,10 +865,10 @@ exp : COMPLEX_INT
{ {
operation_up real operation_up real
= (make_operation<long_const_operation> = (make_operation<long_const_operation>
(TYPE_TARGET_TYPE ($1.type), 0)); ($1.type->target_type (), 0));
operation_up imag operation_up imag
= (make_operation<long_const_operation> = (make_operation<long_const_operation>
(TYPE_TARGET_TYPE ($1.type), $1.val)); ($1.type->target_type (), $1.val));
pstate->push_new<complex_operation> pstate->push_new<complex_operation>
(std::move (real), std::move (imag), $1.type); (std::move (real), std::move (imag), $1.type);
} }
@ -905,8 +905,7 @@ exp : FLOAT
exp : COMPLEX_FLOAT exp : COMPLEX_FLOAT
{ {
struct type *underlying struct type *underlying = $1.type->target_type ();
= TYPE_TARGET_TYPE ($1.type);
float_data val; float_data val;
target_float_from_host_double (val.data (), target_float_from_host_double (val.data (),
@ -955,7 +954,8 @@ exp : SIZEOF '(' type ')' %prec UNARY
or a reference type, the result is the size of or a reference type, the result is the size of
the referenced type." */ the referenced type." */
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
pstate->push_new<long_const_operation> pstate->push_new<long_const_operation>
(int_type, TYPE_LENGTH (type)); (int_type, TYPE_LENGTH (type));
} }

View File

@ -118,8 +118,8 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
/* Call for side effects. */ /* Call for side effects. */
check_typedef (elttype); check_typedef (elttype);
if (TYPE_TARGET_TYPE (elttype)) if (elttype->target_type ())
elttype = TYPE_TARGET_TYPE (elttype); elttype = elttype->target_type ();
else else
{ {
/* Perhaps check_typedef did not update the target type. In /* Perhaps check_typedef did not update the target type. In
@ -247,7 +247,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int err, width; int err, width;
unsigned int fetchlimit; unsigned int fetchlimit;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value_type (value));
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = type->target_type ();
int req_length = *length; int req_length = *length;
enum bfd_endian byte_order enum bfd_endian byte_order
= type_byte_order (type); = type_byte_order (type);
@ -625,7 +625,7 @@ c_string_operation::evaluate (struct type *expect_type,
if (expect_type && expect_type->code () == TYPE_CODE_ARRAY) if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{ {
struct type *element_type struct type *element_type
= check_typedef (TYPE_TARGET_TYPE (expect_type)); = check_typedef (expect_type->target_type ());
if (element_type->code () == TYPE_CODE_INT if (element_type->code () == TYPE_CODE_INT
|| element_type->code () == TYPE_CODE_CHAR) || element_type->code () == TYPE_CODE_CHAR)
@ -697,7 +697,7 @@ c_is_string_type_p (struct type *type)
type = check_typedef (type); type = check_typedef (type);
while (type->code () == TYPE_CODE_REF) while (type->code () == TYPE_CODE_REF)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
type = check_typedef (type); type = check_typedef (type);
} }
@ -706,7 +706,7 @@ c_is_string_type_p (struct type *type)
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
{ {
/* See if target type looks like a string. */ /* See if target type looks like a string. */
struct type *array_target_type = TYPE_TARGET_TYPE (type); struct type *array_target_type = type->target_type ();
return (TYPE_LENGTH (type) > 0 return (TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (array_target_type) > 0 && TYPE_LENGTH (array_target_type) > 0
&& c_textual_element_type (array_target_type, 0)); && c_textual_element_type (array_target_type, 0));
@ -715,7 +715,7 @@ c_is_string_type_p (struct type *type)
return true; return true;
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
{ {
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = type->target_type ();
return c_textual_element_type (element_type, 0); return c_textual_element_type (element_type, 0);
} }
default: default:

View File

@ -313,7 +313,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
gdb_assert (nargs > 0); gdb_assert (nargs > 0);
gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR); gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
domain = TYPE_TARGET_TYPE (args[0].type ()); domain = args[0].type ()->target_type ();
if (TYPE_CONST (domain)) if (TYPE_CONST (domain))
gdb_printf (stream, " const"); gdb_printf (stream, " const");
@ -366,7 +366,7 @@ c_type_print_varspec_prefix (struct type *type,
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 1, 1, language, flags, stream, show, 1, 1, language, flags,
podata); podata);
gdb_printf (stream, "*"); gdb_printf (stream, "*");
@ -374,7 +374,7 @@ c_type_print_varspec_prefix (struct type *type,
break; break;
case TYPE_CODE_MEMBERPTR: case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags, podata); stream, show, 0, 0, language, flags, podata);
name = TYPE_SELF_TYPE (type)->name (); name = TYPE_SELF_TYPE (type)->name ();
if (name) if (name)
@ -387,7 +387,7 @@ c_type_print_varspec_prefix (struct type *type,
break; break;
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags, stream, show, 0, 0, language, flags,
podata); podata);
gdb_printf (stream, "("); gdb_printf (stream, "(");
@ -403,7 +403,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_REF: case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF: case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 1, 0, language, flags, stream, show, 1, 0, language, flags,
podata); podata);
gdb_printf (stream, type->code () == TYPE_CODE_REF ? "&" : "&&"); gdb_printf (stream, type->code () == TYPE_CODE_REF ? "&" : "&&");
@ -412,7 +412,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_METHOD: case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags, stream, show, 0, 0, language, flags,
podata); podata);
if (passed_a_ptr) if (passed_a_ptr)
@ -420,7 +420,7 @@ c_type_print_varspec_prefix (struct type *type,
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, need_post_space, stream, show, 0, need_post_space,
language, flags, podata); language, flags, podata);
if (passed_a_ptr) if (passed_a_ptr)
@ -428,7 +428,7 @@ c_type_print_varspec_prefix (struct type *type,
break; break;
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (type->target_type (),
stream, show, passed_a_ptr, 0, stream, show, passed_a_ptr, 0,
language, flags, podata); language, flags, podata);
break; break;
@ -775,26 +775,26 @@ c_type_print_varspec_suffix (struct type *type,
plongest (high_bound - low_bound + 1)); plongest (high_bound - low_bound + 1));
gdb_printf (stream, (is_vector ? ")))" : "]")); gdb_printf (stream, (is_vector ? ")))" : "]"));
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags); show, 0, 0, language, flags);
} }
break; break;
case TYPE_CODE_MEMBERPTR: case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags); show, 0, 0, language, flags);
break; break;
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
gdb_printf (stream, ")"); gdb_printf (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags); show, 0, 0, language, flags);
break; break;
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_REF: case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF: case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, 1, 0, language, flags); show, 1, 0, language, flags);
break; break;
@ -804,12 +804,12 @@ c_type_print_varspec_suffix (struct type *type,
gdb_printf (stream, ")"); gdb_printf (stream, ")");
if (!demangled_args) if (!demangled_args)
c_type_print_args (type, stream, 0, language, flags); c_type_print_args (type, stream, 0, language, flags);
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, passed_a_ptr, 0, language, flags); show, passed_a_ptr, 0, language, flags);
break; break;
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, c_type_print_varspec_suffix (type->target_type (), stream,
show, passed_a_ptr, 0, language, flags); show, passed_a_ptr, 0, language, flags);
break; break;
@ -1266,7 +1266,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
gdb_printf (stream, "virtual "); gdb_printf (stream, "virtual ");
else if (TYPE_FN_FIELD_STATIC_P (f, j)) else if (TYPE_FN_FIELD_STATIC_P (f, j))
gdb_printf (stream, "static "); gdb_printf (stream, "static ");
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0) if (TYPE_FN_FIELD_TYPE (f, j)->target_type () == 0)
{ {
/* Keep GDB from crashing here. */ /* Keep GDB from crashing here. */
gdb_printf (stream, gdb_printf (stream,
@ -1282,7 +1282,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
&& !is_type_conversion_operator (type, i, j)) && !is_type_conversion_operator (type, i, j))
{ {
c_print_type_no_offsets c_print_type_no_offsets
(TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), (TYPE_FN_FIELD_TYPE (f, j)->target_type (),
"", stream, -1, 0, language, &local_flags, podata); "", stream, -1, 0, language, &local_flags, podata);
gdb_puts (" ", stream); gdb_puts (" ", stream);
@ -1382,7 +1382,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
/* Dereference the typedef declaration itself. */ /* Dereference the typedef declaration itself. */
gdb_assert (target->code () == TYPE_CODE_TYPEDEF); gdb_assert (target->code () == TYPE_CODE_TYPEDEF);
target = TYPE_TARGET_TYPE (target); target = target->target_type ();
if (need_access_label) if (need_access_label)
{ {
@ -1495,19 +1495,19 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
{ {
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
/* If we get here, the typedef doesn't have a name, and we /* If we get here, the typedef doesn't have a name, and we
couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */ couldn't resolve type::target_type. Not much we can do. */
gdb_assert (type->name () == NULL); gdb_assert (type->name () == NULL);
gdb_assert (TYPE_TARGET_TYPE (type) == NULL); gdb_assert (type->target_type () == NULL);
fprintf_styled (stream, metadata_style.style (), fprintf_styled (stream, metadata_style.style (),
_("<unnamed typedef>")); _("<unnamed typedef>"));
break; break;
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD: case TYPE_CODE_METHOD:
if (TYPE_TARGET_TYPE (type) == NULL) if (type->target_type () == NULL)
type_print_unknown_return_type (stream); type_print_unknown_return_type (stream);
else else
c_type_print_base_1 (TYPE_TARGET_TYPE (type), c_type_print_base_1 (type->target_type (),
stream, show, level, language, flags, podata); stream, show, level, language, flags, podata);
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
@ -1516,7 +1516,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF: case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF: case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
c_type_print_base_1 (TYPE_TARGET_TYPE (type), c_type_print_base_1 (type->target_type (),
stream, show, level, language, flags, podata); stream, show, level, language, flags, podata);
break; break;
@ -1564,9 +1564,9 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
print too much than too little; but conversely not to print too much than too little; but conversely not to
print something egregiously outside the current print something egregiously outside the current
language's syntax. */ language's syntax. */
if (language == language_cplus && TYPE_TARGET_TYPE (type) != NULL) if (language == language_cplus && type->target_type () != NULL)
{ {
struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type)); struct type *underlying = check_typedef (type->target_type ());
if (underlying->name () != NULL) if (underlying->name () != NULL)
gdb_printf (stream, ": %s ", underlying->name ()); gdb_printf (stream, ": %s ", underlying->name ());

View File

@ -87,8 +87,8 @@ c_textual_element_type (struct type *type, char format)
/* Peel a single typedef. If the typedef doesn't have a target /* Peel a single typedef. If the typedef doesn't have a target
type, we use check_typedef and hope the result is ok -- it type, we use check_typedef and hope the result is ok -- it
might be for C++, where wchar_t is a built-in type. */ might be for C++, where wchar_t is a built-in type. */
if (TYPE_TARGET_TYPE (iter_type)) if (iter_type->target_type ())
iter_type = TYPE_TARGET_TYPE (iter_type); iter_type = iter_type->target_type ();
else else
iter_type = check_typedef (iter_type); iter_type = check_typedef (iter_type);
} }
@ -238,7 +238,7 @@ c_value_print_array (struct value *val,
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
CORE_ADDR address = value_address (val); CORE_ADDR address = value_address (val);
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
struct type *unresolved_elttype = TYPE_TARGET_TYPE (type); struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype); struct type *elttype = check_typedef (unresolved_elttype);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
@ -347,7 +347,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
} }
else else
{ {
struct type *unresolved_elttype = TYPE_TARGET_TYPE (type); struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype); struct type *elttype = check_typedef (unresolved_elttype);
CORE_ADDR addr = unpack_pointer (type, valaddr); CORE_ADDR addr = unpack_pointer (type, valaddr);
@ -497,15 +497,15 @@ c_value_print (struct value *val, struct ui_file *stream,
are always exactly (char *), (wchar_t *), or the like. */ are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL && original_type->name () == NULL
&& TYPE_TARGET_TYPE (original_type)->name () != NULL && original_type->target_type ()->name () != NULL
&& (strcmp (TYPE_TARGET_TYPE (original_type)->name (), && (strcmp (original_type->target_type ()->name (),
"char") == 0 "char") == 0
|| textual_name (TYPE_TARGET_TYPE (original_type)->name ()))) || textual_name (original_type->target_type ()->name ())))
{ {
/* Print nothing. */ /* Print nothing. */
} }
else if (options->objectprint else if (options->objectprint
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{ {
int is_ref = TYPE_IS_REFERENCE (type); int is_ref = TYPE_IS_REFERENCE (type);
enum type_code refcode = TYPE_CODE_UNDEF; enum type_code refcode = TYPE_CODE_UNDEF;

View File

@ -403,7 +403,7 @@ c_describe_child (const struct varobj *parent, int index,
check_typedef and here, we want to show the true check_typedef and here, we want to show the true
declared type of the variable. */ declared type of the variable. */
if (ctype) if (ctype)
*ctype = TYPE_TARGET_TYPE (type); *ctype = type->target_type ();
if (cfull_expression) if (cfull_expression)
*cfull_expression = string_printf ("*(%s)", parent_expression.c_str ()); *cfull_expression = string_printf ("*(%s)", parent_expression.c_str ());
@ -482,7 +482,7 @@ c_value_of_variable (const struct varobj *var,
/* Strip top-level references. */ /* Strip top-level references. */
while (TYPE_IS_REFERENCE (type)) while (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
switch (type->code ()) switch (type->code ())
{ {

View File

@ -1468,8 +1468,8 @@ enter_linenos (file_ptr file_offset, int first_line,
static void static void
patch_type (struct type *type, struct type *real_type) patch_type (struct type *type, struct type *real_type)
{ {
struct type *target = TYPE_TARGET_TYPE (type); struct type *target = type->target_type ();
struct type *real_target = TYPE_TARGET_TYPE (real_type); struct type *real_target = real_type->target_type ();
int field_size = real_target->num_fields () * sizeof (struct field); int field_size = real_target->num_fields () * sizeof (struct field);
TYPE_LENGTH (target) = TYPE_LENGTH (real_target); TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
@ -1509,7 +1509,7 @@ patch_opaque_types (struct symtab *s)
if (real_sym->aclass () == LOC_TYPEDEF if (real_sym->aclass () == LOC_TYPEDEF
&& real_sym->domain () == VAR_DOMAIN && real_sym->domain () == VAR_DOMAIN
&& real_sym->type ()->code () == TYPE_CODE_PTR && real_sym->type ()->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (real_sym->type ())) != 0) && TYPE_LENGTH (real_sym->type ()->target_type ()) != 0)
{ {
const char *name = real_sym->linkage_name (); const char *name = real_sym->linkage_name ();
int hash = hashname (name); int hash = hashname (name);
@ -1699,8 +1699,8 @@ process_coff_symbol (struct coff_symbol *cs,
references work themselves out via the magic of references work themselves out via the magic of
coff_lookup_type. */ coff_lookup_type. */
if (sym->type ()->code () == TYPE_CODE_PTR if (sym->type ()->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) == 0 && TYPE_LENGTH (sym->type ()->target_type ()) == 0
&& TYPE_TARGET_TYPE (sym->type ())->code () && sym->type ()->target_type ()->code ()
!= TYPE_CODE_UNDEF) != TYPE_CODE_UNDEF)
{ {
int i = hashname (sym->linkage_name ()); int i = hashname (sym->linkage_name ());

View File

@ -495,7 +495,7 @@ generate_vla_size (compile_instance *compiler,
type = check_typedef (type); type = check_typedef (type);
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
switch (type->code ()) switch (type->code ())
{ {
@ -518,7 +518,7 @@ generate_vla_size (compile_instance *compiler,
generate_vla_size (compiler, stream, gdbarch, registers_used, pc, generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
type->index_type (), sym); type->index_type (), sym);
generate_vla_size (compiler, stream, gdbarch, registers_used, pc, generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
TYPE_TARGET_TYPE (type), sym); type->target_type (), sym);
break; break;
case TYPE_CODE_UNION: case TYPE_CODE_UNION:

View File

@ -29,7 +29,7 @@
static gcc_type static gcc_type
convert_pointer (compile_c_instance *context, struct type *type) convert_pointer (compile_c_instance *context, struct type *type)
{ {
gcc_type target = context->convert_type (TYPE_TARGET_TYPE (type)); gcc_type target = context->convert_type (type->target_type ());
return context->plugin ().build_pointer_type (target); return context->plugin ().build_pointer_type (target);
} }
@ -42,7 +42,7 @@ convert_array (compile_c_instance *context, struct type *type)
gcc_type element_type; gcc_type element_type;
struct type *range = type->index_type (); struct type *range = type->index_type ();
element_type = context->convert_type (TYPE_TARGET_TYPE (type)); element_type = context->convert_type (type->target_type ());
if (range->bounds ()->low.kind () != PROP_CONST) if (range->bounds ()->low.kind () != PROP_CONST)
return context->plugin ().error (_("array type with non-constant" return context->plugin ().error (_("array type with non-constant"
@ -155,7 +155,7 @@ convert_func (compile_c_instance *context, struct type *type)
struct gcc_type_array array; struct gcc_type_array array;
int is_varargs = type->has_varargs () || !type->is_prototyped (); int is_varargs = type->has_varargs () || !type->is_prototyped ();
struct type *target_type = TYPE_TARGET_TYPE (type); struct type *target_type = type->target_type ();
/* Functions with no debug info have no return type. Ideally we'd /* Functions with no debug info have no return type. Ideally we'd
want to fallback to the type of the cast just before the want to fallback to the type of the cast just before the
@ -263,7 +263,7 @@ convert_qualified (compile_c_instance *context, struct type *type)
static gcc_type static gcc_type
convert_complex (compile_c_instance *context, struct type *type) convert_complex (compile_c_instance *context, struct type *type)
{ {
gcc_type base = context->convert_type (TYPE_TARGET_TYPE (type)); gcc_type base = context->convert_type (type->target_type ());
return context->plugin ().build_complex_type (base); return context->plugin ().build_complex_type (base);
} }

View File

@ -410,7 +410,7 @@ static gcc_type
compile_cplus_convert_reference (compile_cplus_instance *instance, compile_cplus_convert_reference (compile_cplus_instance *instance,
struct type *type) struct type *type)
{ {
gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type)); gcc_type target = instance->convert_type (type->target_type ());
enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE; enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE;
switch (type->code ()) switch (type->code ())
@ -442,7 +442,7 @@ static gcc_type
compile_cplus_convert_pointer (compile_cplus_instance *instance, compile_cplus_convert_pointer (compile_cplus_instance *instance,
struct type *type) struct type *type)
{ {
gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type)); gcc_type target = instance->convert_type (type->target_type ());
return instance->convert_pointer_base (target); return instance->convert_pointer_base (target);
} }
@ -454,7 +454,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
struct type *type) struct type *type)
{ {
struct type *range = type->index_type (); struct type *range = type->index_type ();
gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type)); gcc_type element_type = instance->convert_type (type->target_type ());
if (range->bounds ()->low.kind () != PROP_CONST) if (range->bounds ()->low.kind () != PROP_CONST)
{ {
@ -697,7 +697,7 @@ compile_cplus_convert_memberptr (compile_cplus_instance *instance,
gcc_type class_type = instance->convert_type (containing_class); gcc_type class_type = instance->convert_type (containing_class);
gcc_type member_type gcc_type member_type
= instance->convert_type (TYPE_TARGET_TYPE (type)); = instance->convert_type (type->target_type ());
return instance->plugin ().build_pointer_to_member_type return instance->plugin ().build_pointer_to_member_type
(class_type, member_type); (class_type, member_type);
@ -961,7 +961,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
struct type *type, bool strip_artificial) struct type *type, bool strip_artificial)
{ {
int is_varargs = type->has_varargs (); int is_varargs = type->has_varargs ();
struct type *target_type = TYPE_TARGET_TYPE (type); struct type *target_type = type->target_type ();
/* Functions with no debug info have no return type. Ideally we'd /* Functions with no debug info have no return type. Ideally we'd
want to fallback to the type of the cast just before the want to fallback to the type of the cast just before the
@ -1086,7 +1086,7 @@ static gcc_type
compile_cplus_convert_complex (compile_cplus_instance *instance, compile_cplus_convert_complex (compile_cplus_instance *instance,
struct type *type) struct type *type)
{ {
gcc_type base = instance->convert_type (TYPE_TARGET_TYPE (type)); gcc_type base = instance->convert_type (type->target_type ());
return instance->plugin ().build_complex_type (base); return instance->plugin ().build_complex_type (base);
} }

View File

@ -469,7 +469,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_ptr_type = check_typedef (gdb_ptr_type); gdb_ptr_type = check_typedef (gdb_ptr_type);
if (gdb_ptr_type->code () != TYPE_CODE_PTR) if (gdb_ptr_type->code () != TYPE_CODE_PTR)
error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE); error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type)); gdb_type_from_ptr = check_typedef (gdb_ptr_type->target_type ());
if (types_deeply_equal (gdb_type, gdb_type_from_ptr)) if (types_deeply_equal (gdb_type, gdb_type_from_ptr))
{ {
@ -489,7 +489,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
switch (gdb_type_from_ptr->code ()) switch (gdb_type_from_ptr->code ())
{ {
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr); gdb_type_from_ptr = gdb_type_from_ptr->target_type ();
break; break;
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
break; break;
@ -500,7 +500,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
objfile_name (objfile)); objfile_name (objfile));
} }
if (!types_deeply_equal (gdb_type_from_ptr, if (!types_deeply_equal (gdb_type_from_ptr,
TYPE_TARGET_TYPE (gdb_type))) gdb_type->target_type ()))
error (_("Referenced types do not match for symbols \"%s\" and \"%s\" " error (_("Referenced types do not match for symbols \"%s\" and \"%s\" "
"in compiled module \"%s\"."), "in compiled module \"%s\"."),
COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL, COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL,
@ -530,7 +530,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
regsp_type->code (), GCC_FE_WRAPPER_FUNCTION, regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile)); objfile_name (objfile));
regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type)); regs_type = check_typedef (regsp_type->target_type ());
if (regs_type->code () != TYPE_CODE_STRUCT) if (regs_type->code () != TYPE_CODE_STRUCT)
error (_("Invalid type code %d of dereferenced first parameter " error (_("Invalid type code %d of dereferenced first parameter "
"of function \"%s\" in compiled module \"%s\"."), "of function \"%s\" in compiled module \"%s\"."),
@ -685,7 +685,7 @@ compile_object_load (const compile_file_names &file_names,
"module \"%s\"."), "module \"%s\"."),
func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION, func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile)); objfile_name (objfile));
if (!types_deeply_equal (expect_return_type, TYPE_TARGET_TYPE (func_type))) if (!types_deeply_equal (expect_return_type, func_type->target_type ()))
error (_("Invalid return type of function \"%s\" in compiled " error (_("Invalid return type of function \"%s\" in compiled "
"module \"%s\"."), "module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));

View File

@ -220,7 +220,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
return {}; return {};
type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())); type = check_typedef (lang_this.symbol->type ()->target_type ());
/* If TYPE_NAME is NULL, abandon trying to find this symbol. /* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++, This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */ which outputs no name for the container class. */

View File

@ -212,10 +212,10 @@ inspect_type (struct demangle_parse_info *info,
struct type *last = otype; struct type *last = otype;
/* Find the last typedef for the type. */ /* Find the last typedef for the type. */
while (TYPE_TARGET_TYPE (last) != NULL while (last->target_type () != NULL
&& (TYPE_TARGET_TYPE (last)->code () && (last->target_type ()->code ()
== TYPE_CODE_TYPEDEF)) == TYPE_CODE_TYPEDEF))
last = TYPE_TARGET_TYPE (last); last = last->target_type ();
/* If there is only one typedef for this anonymous type, /* If there is only one typedef for this anonymous type,
do not substitute it. */ do not substitute it. */
@ -1336,7 +1336,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
if (type->code () == TYPE_CODE_TYPEDEF) if (type->code () == TYPE_CODE_TYPEDEF)
type = check_typedef (type); type = check_typedef (type);
else else
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
type_name = type->name (); type_name = type->name ();

View File

@ -78,10 +78,10 @@ cp_is_vtbl_member (struct type *type)
structures. Nowadays it points directly to the structure. */ structures. Nowadays it points directly to the structure. */
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */ if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
|| type->code () == TYPE_CODE_PTR) /* if using thunks */ || type->code () == TYPE_CODE_PTR) /* if using thunks */
{ {
@ -589,7 +589,7 @@ cp_print_static_field (struct type *type,
{ {
struct type **first_dont_print; struct type **first_dont_print;
int i; int i;
struct type *target_type = TYPE_TARGET_TYPE (type); struct type *target_type = type->target_type ();
first_dont_print first_dont_print
= (struct type **) obstack_base (&dont_print_stat_array_obstack); = (struct type **) obstack_base (&dont_print_stat_array_obstack);

View File

@ -789,13 +789,13 @@ add_array_cv_type (struct ctf_context *ccp,
base_type = copy_type (base_type); base_type = copy_type (base_type);
inner_array = base_type; inner_array = base_type;
while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) while (inner_array->target_type ()->code () == TYPE_CODE_ARRAY)
{ {
inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array))); inner_array->set_target_type (copy_type (inner_array->target_type ()));
inner_array = TYPE_TARGET_TYPE (inner_array); inner_array = inner_array->target_type ();
} }
el_type = TYPE_TARGET_TYPE (inner_array); el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type); cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type); voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr)); inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr));
@ -936,7 +936,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
else else
this_type->set_target_type (nullptr); this_type->set_target_type (nullptr);
this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr); this_type->set_target_is_stub (this_type->target_type () != nullptr);
return set_tid_type (objfile, tid, this_type); return set_tid_type (objfile, tid, this_type);
} }

View File

@ -130,7 +130,7 @@ d_lookup_symbol (const struct language_defn *langdef,
if (lang_this.symbol == NULL) if (lang_this.symbol == NULL)
return {}; return {};
type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())); type = check_typedef (lang_this.symbol->type ()->target_type ());
classname = type->name (); classname = type->name ();
nested = name; nested = name;
} }

View File

@ -53,7 +53,7 @@ dynamic_array_type (struct type *type,
length = unpack_field_as_long (type, valaddr + embedded_offset, 0); length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
ptr_type = type->field (1).type (); ptr_type = type->field (1).type ();
elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type)); elttype = check_typedef (ptr_type->target_type ());
addr = unpack_pointer (ptr_type, addr = unpack_pointer (ptr_type,
valaddr + type->field (1).loc_bitpos () / 8 valaddr + type->field (1).loc_bitpos () / 8
+ embedded_offset); + embedded_offset);

View File

@ -1338,7 +1338,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
union call_site_parameter_u kind_u) union call_site_parameter_u kind_u)
{ {
struct type *checked_type = check_typedef (type); struct type *checked_type = check_typedef (type);
struct type *target_type = TYPE_TARGET_TYPE (checked_type); struct type *target_type = checked_type->target_type ();
struct frame_info *caller_frame = get_prev_frame (frame); struct frame_info *caller_frame = get_prev_frame (frame);
struct value *outer_val, *target_val, *val; struct value *outer_val, *target_val, *val;
struct call_site_parameter *parameter; struct call_site_parameter *parameter;
@ -1360,7 +1360,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
entry value. */ entry value. */
if (!TYPE_IS_REFERENCE (checked_type) if (!TYPE_IS_REFERENCE (checked_type)
|| TYPE_TARGET_TYPE (checked_type) == NULL) || checked_type->target_type () == NULL)
return outer_val; return outer_val;
target_val = dwarf_entry_parameter_to_value (parameter, target_val = dwarf_entry_parameter_to_value (parameter,
@ -1430,16 +1430,16 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
if (bytes != NULL) if (bytes != NULL)
{ {
if (byte_offset >= 0 if (byte_offset >= 0
&& byte_offset + TYPE_LENGTH (TYPE_TARGET_TYPE (type)) <= len) && byte_offset + TYPE_LENGTH (type->target_type ()) <= len)
{ {
bytes += byte_offset; bytes += byte_offset;
result = value_from_contents (TYPE_TARGET_TYPE (type), bytes); result = value_from_contents (type->target_type (), bytes);
} }
else else
invalid_synthetic_pointer (); invalid_synthetic_pointer ();
} }
else else
result = allocate_optimized_out_value (TYPE_TARGET_TYPE (type)); result = allocate_optimized_out_value (type->target_type ());
return result; return result;
} }
@ -1476,7 +1476,7 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data, return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
baton.size, baton.per_cu, baton.size, baton.per_cu,
baton.per_objfile, baton.per_objfile,
TYPE_TARGET_TYPE (type), type->target_type (),
byte_offset); byte_offset);
else else
return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu, return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu,

View File

@ -9060,7 +9060,7 @@ dwarf2_compute_name (const char *name,
if (type->num_fields () > 0 if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0) && TYPE_FIELD_ARTIFICIAL (type, 0)
&& type->field (0).type ()->code () == TYPE_CODE_PTR && type->field (0).type ()->code () == TYPE_CODE_PTR
&& TYPE_CONST (TYPE_TARGET_TYPE (type->field (0).type ()))) && TYPE_CONST (type->field (0).type ()->target_type ()))
buf.puts (" const"); buf.puts (" const");
} }
} }
@ -14125,7 +14125,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* TYPE is the domain of this method, and THIS_TYPE is the type /* TYPE is the domain of this method, and THIS_TYPE is the type
of the method itself (TYPE_CODE_METHOD). */ of the method itself (TYPE_CODE_METHOD). */
smash_to_method_type (fnp->type, type, smash_to_method_type (fnp->type, type,
TYPE_TARGET_TYPE (this_type), this_type->target_type (),
this_type->fields (), this_type->fields (),
this_type->num_fields (), this_type->num_fields (),
this_type->has_varargs ()); this_type->has_varargs ());
@ -14226,8 +14226,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
} }
else else
{ {
fnp->fcontext fnp->fcontext = this_type->field (0).type ()->target_type ();
= TYPE_TARGET_TYPE (this_type->field (0).type ());
} }
} }
} }
@ -14328,19 +14327,19 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
pfn_type = type->field (0).type (); pfn_type = type->field (0).type ();
if (pfn_type == NULL if (pfn_type == NULL
|| pfn_type->code () != TYPE_CODE_PTR || pfn_type->code () != TYPE_CODE_PTR
|| TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC) || pfn_type->target_type ()->code () != TYPE_CODE_FUNC)
return; return;
/* Look for the "this" argument. */ /* Look for the "this" argument. */
pfn_type = TYPE_TARGET_TYPE (pfn_type); pfn_type = pfn_type->target_type ();
if (pfn_type->num_fields () == 0 if (pfn_type->num_fields () == 0
/* || pfn_type->field (0).type () == NULL */ /* || pfn_type->field (0).type () == NULL */
|| pfn_type->field (0).type ()->code () != TYPE_CODE_PTR) || pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
return; return;
self_type = TYPE_TARGET_TYPE (pfn_type->field (0).type ()); self_type = pfn_type->field (0).type ()->target_type ();
new_type = alloc_type (objfile); new_type = alloc_type (objfile);
smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type), smash_to_method_type (new_type, self_type, pfn_type->target_type (),
pfn_type->fields (), pfn_type->num_fields (), pfn_type->fields (), pfn_type->num_fields (),
pfn_type->has_varargs ()); pfn_type->has_varargs ());
smash_to_methodptr_type (type, new_type); smash_to_methodptr_type (type, new_type);
@ -14360,7 +14359,7 @@ rewrite_array_type (struct type *type)
range_bounds *current_bounds = index_type->bounds (); range_bounds *current_bounds = index_type->bounds ();
/* Handle multi-dimensional arrays. */ /* Handle multi-dimensional arrays. */
struct type *new_target = rewrite_array_type (TYPE_TARGET_TYPE (type)); struct type *new_target = rewrite_array_type (type->target_type ());
if (new_target == nullptr) if (new_target == nullptr)
{ {
/* Maybe we don't need to rewrite this array. */ /* Maybe we don't need to rewrite this array. */
@ -14428,7 +14427,7 @@ quirk_ada_thick_pointer_struct (struct die_info *die, struct dwarf2_cu *cu,
because those may be referenced in other contexts where this because those may be referenced in other contexts where this
rewriting is undesirable. */ rewriting is undesirable. */
struct type *new_ary_type struct type *new_ary_type
= rewrite_array_type (TYPE_TARGET_TYPE (type->field (0).type ())); = rewrite_array_type (type->field (0).type ()->target_type ());
if (new_ary_type != nullptr) if (new_ary_type != nullptr)
type->field (0).set_type (lookup_pointer_type (new_ary_type)); type->field (0).set_type (lookup_pointer_type (new_ary_type));
} }
@ -15226,9 +15225,9 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
can tell us the reality. However, we defer to a local size can tell us the reality. However, we defer to a local size
attribute if one exists, because this lets the compiler override attribute if one exists, because this lets the compiler override
the underlying type if needed. */ the underlying type if needed. */
if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_TARGET_TYPE (type)->is_stub ()) if (type->target_type () != NULL && !type->target_type ()->is_stub ())
{ {
struct type *underlying_type = TYPE_TARGET_TYPE (type); struct type *underlying_type = type->target_type ();
underlying_type = check_typedef (underlying_type); underlying_type = check_typedef (underlying_type);
type->set_is_unsigned (underlying_type->is_unsigned ()); type->set_is_unsigned (underlying_type->is_unsigned ());
@ -15543,7 +15542,7 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
iter->main_type->dyn_prop_list = nullptr; iter->main_type->dyn_prop_list = nullptr;
iter->set_index_type iter->set_index_type
(create_static_range_type (NULL, bounds->field (i).type (), 1, 0)); (create_static_range_type (NULL, bounds->field (i).type (), 1, 0));
iter = TYPE_TARGET_TYPE (iter); iter = iter->target_type ();
} }
struct type *result = alloc_type (objfile); struct type *result = alloc_type (objfile);
@ -16224,7 +16223,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct type *new_type = alloc_type (cu->per_objfile->objfile); struct type *new_type = alloc_type (cu->per_objfile->objfile);
smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type), smash_to_method_type (new_type, domain, to_type->target_type (),
to_type->fields (), to_type->num_fields (), to_type->fields (), to_type->num_fields (),
to_type->has_varargs ()); to_type->has_varargs ());
type = lookup_methodptr_type (new_type); type = lookup_methodptr_type (new_type);
@ -16284,13 +16283,13 @@ add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu,
base_type = copy_type (base_type); base_type = copy_type (base_type);
inner_array = base_type; inner_array = base_type;
while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) while (inner_array->target_type ()->code () == TYPE_CODE_ARRAY)
{ {
inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array))); inner_array->set_target_type (copy_type (inner_array->target_type ()));
inner_array = TYPE_TARGET_TYPE (inner_array); inner_array = inner_array->target_type ();
} }
el_type = TYPE_TARGET_TYPE (inner_array); el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type); cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type); voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, NULL)); inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, NULL));

View File

@ -983,7 +983,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
thread_info *thread = inferior_thread (); thread_info *thread = inferior_thread ();
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func; struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func;
struct type *value_type = TYPE_TARGET_TYPE (func_func_type); struct type *value_type = func_func_type->target_type ();
struct regcache *regcache = get_thread_regcache (thread); struct regcache *regcache = get_thread_regcache (thread);
struct value *func_func; struct value *func_func;
struct value *value; struct value *value;

View File

@ -439,7 +439,7 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type)
{ {
type = check_typedef (type); type = check_typedef (type);
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
switch (type->code ()) switch (type->code ())
{ {
@ -649,7 +649,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
ftype = resolved_type; ftype = resolved_type;
} }
type *return_type = TYPE_TARGET_TYPE (ftype); type *return_type = ftype->target_type ();
if (return_type == NULL) if (return_type == NULL)
return_type = default_return_type; return_type = default_return_type;
@ -690,7 +690,7 @@ operation::evaluate_funcall (struct type *expect_type,
value *callee = evaluate_with_coercion (exp, noside); value *callee = evaluate_with_coercion (exp, noside);
struct type *type = value_type (callee); struct type *type = value_type (callee);
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
for (int i = 0; i < args.size (); ++i) for (int i = 0; i < args.size (); ++i)
{ {
if (i < type->num_fields ()) if (i < type->num_fields ())
@ -831,7 +831,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
if (a1_type->code () == TYPE_CODE_METHODPTR) if (a1_type->code () == TYPE_CODE_METHODPTR)
{ {
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
callee = value_zero (TYPE_TARGET_TYPE (a1_type), not_lval); callee = value_zero (a1_type->target_type (), not_lval);
else else
callee = cplus_method_ptr_to_value (&lhs, rhs); callee = cplus_method_ptr_to_value (&lhs, rhs);
@ -842,7 +842,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
struct type *type_ptr struct type *type_ptr
= lookup_pointer_type (TYPE_SELF_TYPE (a1_type)); = lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
struct type *target_type_ptr struct type *target_type_ptr
= lookup_pointer_type (TYPE_TARGET_TYPE (a1_type)); = lookup_pointer_type (a1_type->target_type ());
/* Now, convert this value to an address. */ /* Now, convert this value to an address. */
lhs = value_cast (type_ptr, lhs); lhs = value_cast (type_ptr, lhs);
@ -1038,7 +1038,7 @@ structop_base_operation::complete (struct expression *exp,
type = check_typedef (type); type = check_typedef (type);
if (!type->is_pointer_or_reference ()) if (!type->is_pointer_or_reference ())
break; break;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
if (type->code () == TYPE_CODE_UNION if (type->code () == TYPE_CODE_UNION
@ -1068,7 +1068,7 @@ is_integral_or_integral_reference (struct type *type)
type = check_typedef (type); type = check_typedef (type);
return (type != nullptr return (type != nullptr
&& TYPE_IS_REFERENCE (type) && TYPE_IS_REFERENCE (type)
&& is_integral_type (TYPE_TARGET_TYPE (type))); && is_integral_type (type->target_type ()));
} }
/* Helper function that implements the body of OP_SCOPE. */ /* Helper function that implements the body of OP_SCOPE. */
@ -1258,8 +1258,8 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct value_print_options opts; struct value_print_options opts;
get_user_print_options (&opts); get_user_print_options (&opts);
if (opts.objectprint && TYPE_TARGET_TYPE (arg_type) if (opts.objectprint && arg_type->target_type ()
&& (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT)) && (arg_type->target_type ()->code () == TYPE_CODE_STRUCT))
{ {
real_type = value_rtti_indirect_type (arg1, &full, &top, real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc); &using_enc);
@ -1290,7 +1290,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
{ {
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (TYPE_TARGET_TYPE (type), not_lval); return value_zero (type->target_type (), not_lval);
else else
{ {
arg2 = cplus_method_ptr_to_value (&arg1, arg2); arg2 = cplus_method_ptr_to_value (&arg1, arg2);
@ -1305,7 +1305,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
mem_offset = value_as_long (arg2); mem_offset = value_as_long (arg2);
arg3 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), arg3 = value_from_pointer (lookup_pointer_type (type->target_type ()),
value_as_long (arg1) + mem_offset); value_as_long (arg1) + mem_offset);
return value_ind (arg3); return value_ind (arg3);
@ -1436,7 +1436,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
} }
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1)); return value_zero (type->target_type (), VALUE_LVAL (arg1));
else else
return value_subscript (arg1, value_as_long (arg2)); return value_subscript (arg1, value_as_long (arg2));
} }
@ -1677,12 +1677,12 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
in the inferior, but being able to print accurate type in the inferior, but being able to print accurate type
information seems worth the risk. */ information seems worth the risk. */
if (!type->is_pointer_or_reference () if (!type->is_pointer_or_reference ()
|| !is_dynamic_type (TYPE_TARGET_TYPE (type))) || !is_dynamic_type (type->target_type ()))
{ {
if (type->is_pointer_or_reference () if (type->is_pointer_or_reference ()
/* In C you can dereference an array to get the 1st elt. */ /* In C you can dereference an array to get the 1st elt. */
|| type->code () == TYPE_CODE_ARRAY) || type->code () == TYPE_CODE_ARRAY)
return value_zero (TYPE_TARGET_TYPE (type), return value_zero (type->target_type (),
lval_memory); lval_memory);
else if (type->code () == TYPE_CODE_INT) else if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */ /* GDB allows dereferencing an int. */
@ -2145,8 +2145,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
struct type *callee_type = value_type (called_method); struct type *callee_type = value_type (called_method);
if (callee_type && callee_type->code () == TYPE_CODE_PTR) if (callee_type && callee_type->code () == TYPE_CODE_PTR)
callee_type = TYPE_TARGET_TYPE (callee_type); callee_type = callee_type->target_type ();
callee_type = TYPE_TARGET_TYPE (callee_type); callee_type = callee_type->target_type ();
if (callee_type) if (callee_type)
{ {
@ -2439,7 +2439,7 @@ array_operation::evaluate (struct type *expect_type,
&& type->code () == TYPE_CODE_ARRAY) && type->code () == TYPE_CODE_ARRAY)
{ {
struct type *range_type = type->index_type (); struct type *range_type = type->index_type ();
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = type->target_type ();
struct value *array = allocate_value (expect_type); struct value *array = allocate_value (expect_type);
int element_size = TYPE_LENGTH (check_typedef (element_type)); int element_size = TYPE_LENGTH (check_typedef (element_type));
LONGEST low_bound, high_bound, index; LONGEST low_bound, high_bound, index;
@ -2483,7 +2483,7 @@ array_operation::evaluate (struct type *expect_type,
/* Get targettype of elementtype. */ /* Get targettype of elementtype. */
while (check_type->code () == TYPE_CODE_RANGE while (check_type->code () == TYPE_CODE_RANGE
|| check_type->code () == TYPE_CODE_TYPEDEF) || check_type->code () == TYPE_CODE_TYPEDEF)
check_type = TYPE_TARGET_TYPE (check_type); check_type = check_type->target_type ();
if (!get_discrete_bounds (element_type, &low_bound, &high_bound)) if (!get_discrete_bounds (element_type, &low_bound, &high_bound))
error (_("(power)set type with unknown size")); error (_("(power)set type with unknown size"));
@ -2503,9 +2503,9 @@ array_operation::evaluate (struct type *expect_type,
different types. Also check if type of element is "compatible" different types. Also check if type of element is "compatible"
with element type of powerset. */ with element type of powerset. */
if (range_low_type->code () == TYPE_CODE_RANGE) if (range_low_type->code () == TYPE_CODE_RANGE)
range_low_type = TYPE_TARGET_TYPE (range_low_type); range_low_type = range_low_type->target_type ();
if (range_high_type->code () == TYPE_CODE_RANGE) if (range_high_type->code () == TYPE_CODE_RANGE)
range_high_type = TYPE_TARGET_TYPE (range_high_type); range_high_type = range_high_type->target_type ();
if ((range_low_type->code () != range_high_type->code ()) if ((range_low_type->code () != range_high_type->code ())
|| (range_low_type->code () == TYPE_CODE_ENUM || (range_low_type->code () == TYPE_CODE_ENUM
&& (range_low_type != range_high_type))) && (range_low_type != range_high_type)))
@ -2577,7 +2577,7 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
struct type *type = check_typedef (value_type (x)); struct type *type = check_typedef (value_type (x));
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)), return value_zero (lookup_pointer_type (type->target_type ()),
not_lval); not_lval);
else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x)) else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
return value_zero (lookup_pointer_type (value_type (x)), return value_zero (lookup_pointer_type (value_type (x)),
@ -2709,7 +2709,7 @@ var_value_operation::evaluate_with_coercion (struct expression *exp,
{ {
struct value *val = address_of_variable (var, struct value *val = address_of_variable (var,
std::get<0> (m_storage).block); std::get<0> (m_storage).block);
return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); return value_cast (lookup_pointer_type (type->target_type ()), val);
} }
return evaluate (nullptr, exp, noside); return evaluate (nullptr, exp, noside);
} }
@ -2729,7 +2729,7 @@ evaluate_subexp_for_sizeof_base (struct expression *exp, struct type *type)
type = check_typedef (type); type = check_typedef (type);
if (exp->language_defn->la_language == language_cplus if (exp->language_defn->la_language == language_cplus
&& (TYPE_IS_REFERENCE (type))) && (TYPE_IS_REFERENCE (type)))
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
} }
@ -2771,7 +2771,7 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp,
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
type = type->index_type (); type = type->index_type ();
@ -2803,7 +2803,7 @@ unop_ind_base_operation::evaluate_for_sizeof (struct expression *exp,
if (!type->is_pointer_or_reference () if (!type->is_pointer_or_reference ()
&& type->code () != TYPE_CODE_ARRAY) && type->code () != TYPE_CODE_ARRAY)
error (_("Attempt to take contents of a non-pointer value.")); error (_("Attempt to take contents of a non-pointer value."));
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (is_dynamic_type (type)) if (is_dynamic_type (type))
type = value_type (value_ind (val)); type = value_type (value_ind (val));
/* FIXME: This should be size_t. */ /* FIXME: This should be size_t. */

View File

@ -1508,7 +1508,7 @@ public:
enum noside noside) override enum noside noside) override
{ {
if (expect_type != nullptr && expect_type->code () == TYPE_CODE_PTR) if (expect_type != nullptr && expect_type->code () == TYPE_CODE_PTR)
expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); expect_type = check_typedef (expect_type)->target_type ();
value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside); value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
return eval_op_ind (expect_type, exp, noside, val); return eval_op_ind (expect_type, exp, noside, val);
} }

View File

@ -46,7 +46,7 @@ public:
error ("unable to read array bounds"); error ("unable to read array bounds");
/* Figure out the stride for this array. */ /* Figure out the stride for this array. */
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elt_type = check_typedef (type->target_type ());
m_stride = type->index_type ()->bounds ()->bit_stride (); m_stride = type->index_type ()->bounds ()->bit_stride ();
if (m_stride == 0) if (m_stride == 0)
m_stride = type_length_units (elt_type); m_stride = type_length_units (elt_type);
@ -230,13 +230,13 @@ private:
m_nss++; m_nss++;
gdb_assert (range_type->code () == TYPE_CODE_RANGE); gdb_assert (range_type->code () == TYPE_CODE_RANGE);
m_impl.start_dimension (TYPE_TARGET_TYPE (range_type), m_impl.start_dimension (range_type->target_type (),
upperbound - lowerbound + 1, upperbound - lowerbound + 1,
m_nss == m_ndimensions); m_nss == m_ndimensions);
if (m_nss != m_ndimensions) if (m_nss != m_ndimensions)
{ {
struct type *subarray_type = TYPE_TARGET_TYPE (check_typedef (type)); struct type *subarray_type = check_typedef (type)->target_type ();
/* For dimensions other than the inner most, walk each element and /* For dimensions other than the inner most, walk each element and
recurse while peeling off one more dimension of the array. */ recurse while peeling off one more dimension of the array. */
@ -258,7 +258,7 @@ private:
} }
else else
{ {
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elt_type = check_typedef (type)->target_type ();
/* For the inner most dimension of the array, process each element /* For the inner most dimension of the array, process each element
within this dimension. */ within this dimension. */

View File

@ -162,7 +162,7 @@ fortran_bounds_all_dims (bool lbound_p,
value_contents_copy (result, dst_offset, v, 0, elm_len); value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */ /* Peel another dimension of the array. */
array_type = TYPE_TARGET_TYPE (array_type); array_type = array_type->target_type ();
} }
return result; return result;
@ -208,7 +208,7 @@ fortran_bounds_for_dimension (bool lbound_p, value *array, value *dim_val,
} }
/* Peel off another dimension of the array. */ /* Peel off another dimension of the array. */
array_type = TYPE_TARGET_TYPE (array_type); array_type = array_type->target_type ();
} }
gdb_assert_not_reached ("failed to find matching dimension"); gdb_assert_not_reached ("failed to find matching dimension");
@ -230,7 +230,7 @@ calc_f77_array_dims (struct type *array_type)
tmp_type = array_type; tmp_type = array_type;
while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) while ((tmp_type = tmp_type->target_type ()))
{ {
if (tmp_type->code () == TYPE_CODE_ARRAY) if (tmp_type->code () == TYPE_CODE_ARRAY)
++ndimen; ++ndimen;
@ -435,13 +435,13 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
struct type *pointer_target_type; struct type *pointer_target_type;
if (pointer_type->code () == TYPE_CODE_PTR) if (pointer_type->code () == TYPE_CODE_PTR)
pointer_target_type = TYPE_TARGET_TYPE (pointer_type); pointer_target_type = pointer_type->target_type ();
else else
pointer_target_type = pointer_type; pointer_target_type = pointer_type;
struct type *target_target_type; struct type *target_target_type;
if (target_type->code () == TYPE_CODE_PTR) if (target_type->code () == TYPE_CODE_PTR)
target_target_type = TYPE_TARGET_TYPE (target_type); target_target_type = target_type->target_type ();
else else
target_target_type = target_type; target_target_type = target_type;
@ -530,12 +530,12 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
if (pointer_stride == 0) if (pointer_stride == 0)
pointer_stride pointer_stride
= type_length_units (check_typedef = type_length_units (check_typedef
(TYPE_TARGET_TYPE (pointer_type))) * 8; (pointer_type->target_type ())) * 8;
target_stride = target_range->bounds ()->bit_stride (); target_stride = target_range->bounds ()->bit_stride ();
if (target_stride == 0) if (target_stride == 0)
target_stride target_stride
= type_length_units (check_typedef = type_length_units (check_typedef
(TYPE_TARGET_TYPE (target_type))) * 8; (target_type->target_type ())) * 8;
if (pointer_stride != target_stride) if (pointer_stride != target_stride)
break; break;
@ -634,7 +634,7 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
} }
/* Peel off another dimension of the array. */ /* Peel off another dimension of the array. */
array_type = TYPE_TARGET_TYPE (array_type); array_type = array_type->target_type ();
} }
return value_from_longest (result_type, result); return value_from_longest (result_type, result);
@ -747,7 +747,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
value_contents_copy (result, dst_offset, v, 0, elm_len); value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */ /* Peel another dimension of the array. */
val_type = TYPE_TARGET_TYPE (val_type); val_type = val_type->target_type ();
} }
return result; return result;
@ -1016,11 +1016,11 @@ eval_op_f_kind (struct type *expect_type, struct expression *exp,
error (_("argument to kind must be an intrinsic type")); error (_("argument to kind must be an intrinsic type"));
} }
if (!TYPE_TARGET_TYPE (type)) if (!type->target_type ())
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (type)); TYPE_LENGTH (type));
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (TYPE_TARGET_TYPE (type))); TYPE_LENGTH (type->target_type ()));
} }
/* A helper function for UNOP_FORTRAN_ALLOCATED. */ /* A helper function for UNOP_FORTRAN_ALLOCATED. */
@ -1139,7 +1139,7 @@ fortran_undetermined::value_subarray (value *array,
for (int i = 0; i < ndimensions; ++i) for (int i = 0; i < ndimensions; ++i)
{ {
dim_types.push_back (type); dim_types.push_back (type);
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
/* TYPE is now the inner element type of the array, we start the new /* TYPE is now the inner element type of the array, we start the new
array slice off as this type, then as we process the requested slice array slice off as this type, then as we process the requested slice
@ -1228,7 +1228,7 @@ fortran_undetermined::value_subarray (value *array,
error (_("stride must not be 0")); error (_("stride must not be 0"));
/* Get information about this dimension in the original ARRAY. */ /* Get information about this dimension in the original ARRAY. */
struct type *target_type = TYPE_TARGET_TYPE (dim_type); struct type *target_type = dim_type->target_type ();
struct type *index_type = dim_type->index_type (); struct type *index_type = dim_type->index_type ();
LONGEST lb = f77_get_lowerbound (dim_type); LONGEST lb = f77_get_lowerbound (dim_type);
LONGEST ub = f77_get_upperbound (dim_type); LONGEST ub = f77_get_upperbound (dim_type);
@ -1330,7 +1330,7 @@ fortran_undetermined::value_subarray (value *array,
= value_as_long (ops[i]->evaluate_with_coercion (exp, noside)); = value_as_long (ops[i]->evaluate_with_coercion (exp, noside));
/* Get information about this dimension in the original ARRAY. */ /* Get information about this dimension in the original ARRAY. */
struct type *target_type = TYPE_TARGET_TYPE (dim_type); struct type *target_type = dim_type->target_type ();
struct type *index_type = dim_type->index_type (); struct type *index_type = dim_type->index_type ();
LONGEST lb = f77_get_lowerbound (dim_type); LONGEST lb = f77_get_lowerbound (dim_type);
LONGEST ub = f77_get_upperbound (dim_type); LONGEST ub = f77_get_upperbound (dim_type);
@ -1395,7 +1395,7 @@ fortran_undetermined::value_subarray (value *array,
struct type *new_range struct type *new_range
= create_range_type_with_stride ((struct type *) NULL, = create_range_type_with_stride ((struct type *) NULL,
TYPE_TARGET_TYPE (d.index), d.index->target_type (),
&p_low, &p_high, 0, &p_stride, &p_low, &p_high, 0, &p_stride,
true); true);
array_slice_type array_slice_type
@ -1431,7 +1431,7 @@ fortran_undetermined::value_subarray (value *array,
struct type *new_range struct type *new_range
= create_range_type_with_stride ((struct type *) NULL, = create_range_type_with_stride ((struct type *) NULL,
TYPE_TARGET_TYPE (d.index), d.index->target_type (),
&p_low, &p_high, 0, &p_stride, &p_low, &p_high, 0, &p_stride,
true); true);
repacked_array_type repacked_array_type
@ -1503,7 +1503,7 @@ fortran_undetermined::evaluate (struct type *expect_type,
So we need to look into its target type to see if it is So we need to look into its target type to see if it is
array, string or function. If it is, we need to switch array, string or function. If it is, we need to switch
to the target value the original one points to. */ to the target value the original one points to. */
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *target_type = check_typedef (type->target_type ());
if (target_type->code () == TYPE_CODE_ARRAY if (target_type->code () == TYPE_CODE_ARRAY
|| target_type->code () == TYPE_CODE_STRING || target_type->code () == TYPE_CODE_STRING
@ -1989,7 +1989,7 @@ fortran_adjust_dynamic_array_base_address_hack (struct type *type,
error ("failed to get range bounds"); error ("failed to get range bounds");
/* Figure out the stride for this dimension. */ /* Figure out the stride for this dimension. */
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); struct type *elt_type = check_typedef (tmp_type->target_type ());
stride = tmp_type->index_type ()->bounds ()->bit_stride (); stride = tmp_type->index_type ()->bounds ()->bit_stride ();
if (stride == 0) if (stride == 0)
stride = type_length_units (elt_type); stride = type_length_units (elt_type);
@ -2007,7 +2007,7 @@ fortran_adjust_dynamic_array_base_address_hack (struct type *type,
if (stride < 0 && lowerbound < upperbound) if (stride < 0 && lowerbound < upperbound)
offset = (upperbound - lowerbound) * stride; offset = (upperbound - lowerbound) * stride;
total_offset += offset; total_offset += offset;
tmp_type = TYPE_TARGET_TYPE (tmp_type); tmp_type = tmp_type->target_type ();
} }
/* Adjust the address of this object and return it. */ /* Adjust the address of this object and return it. */

View File

@ -197,7 +197,7 @@ public:
type = check_typedef (type); type = check_typedef (type);
return (type->code () == TYPE_CODE_STRING return (type->code () == TYPE_CODE_STRING
|| (type->code () == TYPE_CODE_ARRAY || (type->code () == TYPE_CODE_ARRAY
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR)); && type->target_type ()->code () == TYPE_CODE_CHAR));
} }
/* See language.h. */ /* See language.h. */

View File

@ -64,10 +64,10 @@ f_language::print_type (struct type *type, const char *varstring,
|| code == TYPE_CODE_ARRAY || code == TYPE_CODE_ARRAY
|| ((code == TYPE_CODE_PTR || ((code == TYPE_CODE_PTR
|| code == TYPE_CODE_REF) || code == TYPE_CODE_REF)
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC && (type->target_type ()->code () == TYPE_CODE_FUNC
|| (TYPE_TARGET_TYPE (type)->code () || (type->target_type ()->code ()
== TYPE_CODE_METHOD) == TYPE_CODE_METHOD)
|| (TYPE_TARGET_TYPE (type)->code () || (type->target_type ()->code ()
== TYPE_CODE_ARRAY)))))) == TYPE_CODE_ARRAY))))))
gdb_puts (" ", stream); gdb_puts (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0); f_type_print_varspec_prefix (type, stream, show, 0);
@ -105,17 +105,17 @@ f_language::f_type_print_varspec_prefix (struct type *type,
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1); f_type_print_varspec_prefix (type->target_type (), stream, 0, 1);
break; break;
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0); f_type_print_varspec_prefix (type->target_type (), stream, 0, 0);
if (passed_a_ptr) if (passed_a_ptr)
gdb_printf (stream, "("); gdb_printf (stream, "(");
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0); f_type_print_varspec_prefix (type->target_type (), stream, 0, 0);
break; break;
case TYPE_CODE_UNDEF: case TYPE_CODE_UNDEF:
@ -187,8 +187,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
print_rank_only = true; print_rank_only = true;
} }
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY) if (type->target_type ()->code () == TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, f_type_print_varspec_suffix (type->target_type (), stream, 0,
0, 0, arrayprint_recurse_level, 0, 0, arrayprint_recurse_level,
print_rank_only); print_rank_only);
@ -213,8 +213,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
} }
} }
if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_ARRAY) if (type->target_type ()->code () != TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, f_type_print_varspec_suffix (type->target_type (), stream, 0,
0, 0, arrayprint_recurse_level, 0, 0, arrayprint_recurse_level,
print_rank_only); print_rank_only);
@ -227,7 +227,7 @@ f_language::f_type_print_varspec_suffix (struct type *type,
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_REF: case TYPE_CODE_REF:
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0, f_type_print_varspec_suffix (type->target_type (), stream, 0, 1, 0,
arrayprint_recurse_level, false); arrayprint_recurse_level, false);
gdb_printf (stream, " )"); gdb_printf (stream, " )");
break; break;
@ -236,7 +236,7 @@ f_language::f_type_print_varspec_suffix (struct type *type,
{ {
int i, nfields = type->num_fields (); int i, nfields = type->num_fields ();
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, f_type_print_varspec_suffix (type->target_type (), stream, 0,
passed_a_ptr, 0, passed_a_ptr, 0,
arrayprint_recurse_level, false); arrayprint_recurse_level, false);
if (passed_a_ptr) if (passed_a_ptr)
@ -333,27 +333,27 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); f_type_print_base (type->target_type (), stream, 0, level);
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); f_type_print_base (type->target_type (), stream, show, level);
break; break;
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
if (TYPE_TARGET_TYPE (type) == NULL) if (type->target_type () == NULL)
type_print_unknown_return_type (stream); type_print_unknown_return_type (stream);
else else
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); f_type_print_base (type->target_type (), stream, show, level);
break; break;
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
gdb_printf (stream, "%*sPTR TO -> ( ", level, ""); gdb_printf (stream, "%*sPTR TO -> ( ", level, "");
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0); f_type_print_base (type->target_type (), stream, show, 0);
break; break;
case TYPE_CODE_REF: case TYPE_CODE_REF:
gdb_printf (stream, "%*sREF TO -> ( ", level, ""); gdb_printf (stream, "%*sREF TO -> ( ", level, "");
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0); f_type_print_base (type->target_type (), stream, show, 0);
break; break;
case TYPE_CODE_VOID: case TYPE_CODE_VOID:

View File

@ -82,9 +82,9 @@ f77_get_dynamic_length_of_aggregate (struct type *type)
This function also works for strings which behave very This function also works for strings which behave very
similarly to arrays. */ similarly to arrays. */
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY if (type->target_type ()->code () == TYPE_CODE_ARRAY
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRING) || type->target_type ()->code () == TYPE_CODE_STRING)
f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type)); f77_get_dynamic_length_of_aggregate (type->target_type ());
/* Recursion ends here, start setting up lengths. */ /* Recursion ends here, start setting up lengths. */
lower_bound = f77_get_lowerbound (type); lower_bound = f77_get_lowerbound (type);
@ -94,7 +94,7 @@ f77_get_dynamic_length_of_aggregate (struct type *type)
TYPE_LENGTH (type) = TYPE_LENGTH (type) =
(upper_bound - lower_bound + 1) (upper_bound - lower_bound + 1)
* TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type))); * TYPE_LENGTH (check_typedef (type->target_type ()));
} }
/* Per-dimension statistics. */ /* Per-dimension statistics. */
@ -339,7 +339,7 @@ private:
LONGEST offset1, LONGEST offset2) LONGEST offset1, LONGEST offset2)
{ {
if (type->code () == TYPE_CODE_ARRAY if (type->code () == TYPE_CODE_ARRAY
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR) && type->target_type ()->code () != TYPE_CODE_CHAR)
{ {
/* Extract the range, and get lower and upper bounds. */ /* Extract the range, and get lower and upper bounds. */
struct type *range_type = check_typedef (type)->index_type (); struct type *range_type = check_typedef (type)->index_type ();
@ -350,7 +350,7 @@ private:
/* CALC is used to calculate the offsets for each element. */ /* CALC is used to calculate the offsets for each element. */
fortran_array_offset_calculator calc (type); fortran_array_offset_calculator calc (type);
struct type *subarray_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *subarray_type = check_typedef (type->target_type ());
for (LONGEST i = lowerbound; i < upperbound + 1; i++) for (LONGEST i = lowerbound; i < upperbound + 1; i++)
{ {
/* Use the index and the stride to work out a new offset. */ /* Use the index and the stride to work out a new offset. */
@ -452,11 +452,11 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR) if (type->target_type ()->code () != TYPE_CODE_CHAR)
fortran_print_array (type, address, stream, recurse, val, options); fortran_print_array (type, address, stream, recurse, val, options);
else else
{ {
struct type *ch_type = TYPE_TARGET_TYPE (type); struct type *ch_type = type->target_type ();
f77_get_dynamic_length_of_aggregate (type); f77_get_dynamic_length_of_aggregate (type);
printstr (stream, ch_type, valaddr, printstr (stream, ch_type, valaddr,
@ -476,7 +476,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
int want_space = 0; int want_space = 0;
addr = unpack_pointer (type, valaddr); addr = unpack_pointer (type, valaddr);
elttype = check_typedef (TYPE_TARGET_TYPE (type)); elttype = check_typedef (type->target_type ());
if (elttype->code () == TYPE_CODE_FUNC) if (elttype->code () == TYPE_CODE_FUNC)
{ {
@ -503,7 +503,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
{ {
if (want_space) if (want_space)
gdb_puts (" ", stream); gdb_puts (" ", stream);
val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1, val_print_string (type->target_type (), NULL, addr, -1,
stream, options); stream, options);
} }
return; return;

View File

@ -1251,7 +1251,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else if (abi == FRV_ABI_FDPIC else if (abi == FRV_ABI_FDPIC
&& len == 4 && len == 4
&& typecode == TYPE_CODE_PTR && typecode == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_FUNC) && arg_type->target_type ()->code () == TYPE_CODE_FUNC)
{ {
/* The FDPIC ABI requires function descriptors to be passed instead /* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */ of entry points. */

View File

@ -266,7 +266,7 @@ get_target_type (struct type *type)
{ {
if (type != NULL) if (type != NULL)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type != NULL) if (type != NULL)
type = check_typedef (type); type = check_typedef (type);
} }
@ -1056,10 +1056,10 @@ get_discrete_low_bound (struct type *type)
LONGEST low = type->bounds ()->low.const_val (); LONGEST low = type->bounds ()->low.const_val ();
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM) if (type->target_type ()->code () == TYPE_CODE_ENUM)
{ {
gdb::optional<LONGEST> low_pos gdb::optional<LONGEST> low_pos
= discrete_position (TYPE_TARGET_TYPE (type), low); = discrete_position (type->target_type (), low);
if (low_pos.has_value ()) if (low_pos.has_value ())
low = *low_pos; low = *low_pos;
@ -1127,10 +1127,10 @@ get_discrete_high_bound (struct type *type)
LONGEST high = type->bounds ()->high.const_val (); LONGEST high = type->bounds ()->high.const_val ();
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM) if (type->target_type ()->code () == TYPE_CODE_ENUM)
{ {
gdb::optional<LONGEST> high_pos gdb::optional<LONGEST> high_pos
= discrete_position (TYPE_TARGET_TYPE (type), high); = discrete_position (type->target_type (), high);
if (high_pos.has_value ()) if (high_pos.has_value ())
high = *high_pos; high = *high_pos;
@ -1248,7 +1248,7 @@ gdb::optional<LONGEST>
discrete_position (struct type *type, LONGEST val) discrete_position (struct type *type, LONGEST val)
{ {
if (type->code () == TYPE_CODE_RANGE) if (type->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_ENUM) if (type->code () == TYPE_CODE_ENUM)
{ {
@ -1292,7 +1292,7 @@ update_static_array_size (struct type *type)
if (!get_discrete_bounds (range_type, &low_bound, &high_bound)) if (!get_discrete_bounds (range_type, &low_bound, &high_bound))
low_bound = high_bound = 0; low_bound = high_bound = 0;
element_type = check_typedef (TYPE_TARGET_TYPE (type)); element_type = check_typedef (type->target_type ());
/* Be careful when setting the array length. Ada arrays can be /* Be careful when setting the array length. Ada arrays can be
empty arrays with the high_bound being smaller than the low_bound. empty arrays with the high_bound being smaller than the low_bound.
In such cases, the array length should be zero. */ In such cases, the array length should be zero. */
@ -1513,10 +1513,10 @@ make_vector_type (struct type *array_type)
/* Find the innermost array type, in case the array is /* Find the innermost array type, in case the array is
multi-dimensional. */ multi-dimensional. */
inner_array = array_type; inner_array = array_type;
while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) while (inner_array->target_type ()->code () == TYPE_CODE_ARRAY)
inner_array = TYPE_TARGET_TYPE (inner_array); inner_array = inner_array->target_type ();
elt_type = TYPE_TARGET_TYPE (inner_array); elt_type = inner_array->target_type ();
if (elt_type->code () == TYPE_CODE_INT) if (elt_type->code () == TYPE_CODE_INT)
{ {
type_instance_flags flags type_instance_flags flags
@ -1840,7 +1840,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
if (type->code () != TYPE_CODE_PTR if (type->code () != TYPE_CODE_PTR
&& type->code () != TYPE_CODE_REF) && type->code () != TYPE_CODE_REF)
break; break;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
if (type->code () != TYPE_CODE_STRUCT if (type->code () != TYPE_CODE_STRUCT
@ -2085,7 +2085,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
/* We only want to recognize references at the outermost level. */ /* We only want to recognize references at the outermost level. */
if (top_level && type->code () == TYPE_CODE_REF) if (top_level && type->code () == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
/* Types that have a dynamic TYPE_DATA_LOCATION are considered /* Types that have a dynamic TYPE_DATA_LOCATION are considered
dynamic, even if the type itself is statically defined. dynamic, even if the type itself is statically defined.
@ -2121,7 +2121,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
of the range type are static. It allows us to assume that of the range type are static. It allows us to assume that
the subtype of a static range type is also static. */ the subtype of a static range type is also static. */
return (!has_static_range (type->bounds ()) return (!has_static_range (type->bounds ())
|| is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0)); || is_dynamic_type_internal (type->target_type (), 0));
} }
case TYPE_CODE_STRING: case TYPE_CODE_STRING:
@ -2135,7 +2135,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
if (is_dynamic_type_internal (type->index_type (), 0)) if (is_dynamic_type_internal (type->index_type (), 0))
return 1; return 1;
/* ... or the elements it contains have a dynamic contents... */ /* ... or the elements it contains have a dynamic contents... */
if (is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0)) if (is_dynamic_type_internal (type->target_type (), 0))
return 1; return 1;
/* ... or if it has a dynamic stride... */ /* ... or if it has a dynamic stride... */
if (array_type_has_dynamic_stride (type)) if (array_type_has_dynamic_stride (type))
@ -2259,7 +2259,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
} }
static_target_type static_target_type
= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type), = resolve_dynamic_type_internal (dyn_range_type->target_type (),
addr_stack, 0); addr_stack, 0);
LONGEST bias = dyn_range_type->bounds ()->bias; LONGEST bias = dyn_range_type->bounds ()->bias;
static_range_type = create_range_type_with_stride static_range_type = create_range_type_with_stride
@ -2340,7 +2340,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
range_type range_type
= resolve_dynamic_range (range_type, addr_stack, rank, resolve_p); = resolve_dynamic_range (range_type, addr_stack, rank, resolve_p);
ary_dim = check_typedef (TYPE_TARGET_TYPE (type)); ary_dim = check_typedef (type->target_type ());
if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY) if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
{ {
ary_dim = copy_type (ary_dim); ary_dim = copy_type (ary_dim);
@ -2348,7 +2348,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
rank - 1, resolve_p); rank - 1, resolve_p);
} }
else else
elt_type = TYPE_TARGET_TYPE (type); elt_type = type->target_type ();
prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE); prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE);
if (prop != NULL && resolve_p) if (prop != NULL && resolve_p)
@ -2405,7 +2405,7 @@ resolve_dynamic_array_or_string (struct type *type,
function. In this case the resolved type should not be an function. In this case the resolved type should not be an
array, but should instead be that of an array element. */ array, but should instead be that of an array element. */
struct type *dynamic_array_type = type; struct type *dynamic_array_type = type;
type = copy_type (TYPE_TARGET_TYPE (dynamic_array_type)); type = copy_type (dynamic_array_type->target_type ());
struct dynamic_prop_list *prop_list struct dynamic_prop_list *prop_list
= TYPE_MAIN_TYPE (dynamic_array_type)->dyn_prop_list; = TYPE_MAIN_TYPE (dynamic_array_type)->dyn_prop_list;
if (prop_list != nullptr) if (prop_list != nullptr)
@ -2434,12 +2434,12 @@ resolve_dynamic_array_or_string (struct type *type,
and so on, until eventually, we have the element type at the and so on, until eventually, we have the element type at the
end of the chain. Create all the additional array types here end of the chain. Create all the additional array types here
by copying the top level array type. */ by copying the top level array type. */
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = type->target_type ();
struct type *rank_type = type; struct type *rank_type = type;
for (int i = 1; i < rank; i++) for (int i = 1; i < rank; i++)
{ {
rank_type->set_target_type (copy_type (rank_type)); rank_type->set_target_type (copy_type (rank_type));
rank_type = TYPE_TARGET_TYPE (rank_type); rank_type = rank_type->target_type ();
} }
rank_type->set_target_type (element_type); rank_type->set_target_type (element_type);
} }
@ -2448,9 +2448,9 @@ resolve_dynamic_array_or_string (struct type *type,
{ {
rank = 1; rank = 1;
for (struct type *tmp_type = check_typedef (TYPE_TARGET_TYPE (type)); for (struct type *tmp_type = check_typedef (type->target_type ());
tmp_type->code () == TYPE_CODE_ARRAY; tmp_type->code () == TYPE_CODE_ARRAY;
tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type))) tmp_type = check_typedef (tmp_type->target_type ()))
++rank; ++rank;
} }
@ -2812,7 +2812,7 @@ resolve_dynamic_type_internal (struct type *type,
{ {
resolved_type = copy_type (type); resolved_type = copy_type (type);
resolved_type->set_target_type resolved_type->set_target_type
(resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack, (resolve_dynamic_type_internal (type->target_type (), addr_stack,
top_level)); top_level));
} }
else else
@ -2826,7 +2826,7 @@ resolve_dynamic_type_internal (struct type *type,
{ {
struct property_addr_info pinfo; struct property_addr_info pinfo;
pinfo.type = check_typedef (TYPE_TARGET_TYPE (type)); pinfo.type = check_typedef (type->target_type ());
pinfo.valaddr = {}; pinfo.valaddr = {};
if (addr_stack->valaddr.data () != NULL) if (addr_stack->valaddr.data () != NULL)
pinfo.addr = extract_typed_address (addr_stack->valaddr.data (), pinfo.addr = extract_typed_address (addr_stack->valaddr.data (),
@ -2837,7 +2837,7 @@ resolve_dynamic_type_internal (struct type *type,
resolved_type = copy_type (type); resolved_type = copy_type (type);
resolved_type->set_target_type resolved_type->set_target_type
(resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), (resolve_dynamic_type_internal (type->target_type (),
&pinfo, top_level)); &pinfo, top_level));
break; break;
} }
@ -2982,7 +2982,7 @@ type::remove_dyn_prop (dynamic_prop_node_kind kind)
stripped. If necessary a new qualified form of the underlying type stripped. If necessary a new qualified form of the underlying type
is created. is created.
NOTE: This will return a typedef if TYPE_TARGET_TYPE for the typedef has NOTE: This will return a typedef if type::target_type for the typedef has
not been computed and we're either in the middle of reading symbols, or not been computed and we're either in the middle of reading symbols, or
there was no name for the typedef in the debug info. there was no name for the typedef in the debug info.
@ -3014,7 +3014,7 @@ check_typedef (struct type *type)
while (type->code () == TYPE_CODE_TYPEDEF) while (type->code () == TYPE_CODE_TYPEDEF)
{ {
if (!TYPE_TARGET_TYPE (type)) if (!type->target_type ())
{ {
const char *name; const char *name;
struct symbol *sym; struct symbol *sym;
@ -3038,7 +3038,7 @@ check_typedef (struct type *type)
else /* TYPE_CODE_UNDEF */ else /* TYPE_CODE_UNDEF */
type->set_target_type (alloc_type_arch (type->arch ())); type->set_target_type (alloc_type_arch (type->arch ()));
} }
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
/* Preserve the instance flags as we traverse down the typedef chain. /* Preserve the instance flags as we traverse down the typedef chain.
@ -3138,7 +3138,7 @@ check_typedef (struct type *type)
if (type->target_is_stub ()) if (type->target_is_stub ())
{ {
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *target_type = check_typedef (type->target_type ());
if (target_type->is_stub () || target_type->target_is_stub ()) if (target_type->is_stub () || target_type->target_is_stub ())
{ {
@ -3299,7 +3299,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
mtype = TYPE_FN_FIELD_TYPE (f, signature_id); mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
/* MTYPE may currently be a function (TYPE_CODE_FUNC). /* MTYPE may currently be a function (TYPE_CODE_FUNC).
We want a method (TYPE_CODE_METHOD). */ We want a method (TYPE_CODE_METHOD). */
smash_to_method_type (mtype, type, TYPE_TARGET_TYPE (mtype), smash_to_method_type (mtype, type, mtype->target_type (),
argtypes, argcount, p[-2] == '.'); argtypes, argcount, p[-2] == '.');
mtype->set_is_stub (false); mtype->set_is_stub (false);
TYPE_FN_FIELD_STUB (f, signature_id) = 0; TYPE_FN_FIELD_STUB (f, signature_id) = 0;
@ -3671,7 +3671,7 @@ type_align (struct type *type)
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
align = type_align (TYPE_TARGET_TYPE (type)); align = type_align (type->target_type ());
break; break;
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
@ -3760,7 +3760,7 @@ can_dereference (struct type *t)
return return
(t != NULL (t != NULL
&& t->code () == TYPE_CODE_PTR && t->code () == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (t)->code () != TYPE_CODE_VOID); && t->target_type ()->code () != TYPE_CODE_VOID);
} }
int int
@ -3828,7 +3828,7 @@ is_scalar_type_recursive (struct type *t)
&& t->index_type ()->code () == TYPE_CODE_RANGE) && t->index_type ()->code () == TYPE_CODE_RANGE)
{ {
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t)); struct type *elt_type = check_typedef (t->target_type ());
if (get_discrete_bounds (t->index_type (), &low_bound, &high_bound)) if (get_discrete_bounds (t->index_type (), &low_bound, &high_bound))
return (high_bound == low_bound return (high_bound == low_bound
@ -4253,8 +4253,8 @@ types_equal (struct type *a, struct type *b)
of the same type. */ of the same type. */
if (a->code () == TYPE_CODE_PTR if (a->code () == TYPE_CODE_PTR
|| a->code () == TYPE_CODE_REF) || a->code () == TYPE_CODE_REF)
return types_equal (TYPE_TARGET_TYPE (a), return types_equal (a->target_type (),
TYPE_TARGET_TYPE (b)); b->target_type ());
/* Well, damnit, if the names are exactly the same, I'll say they /* Well, damnit, if the names are exactly the same, I'll say they
are exactly the same. This happens when we generate method are exactly the same. This happens when we generate method
@ -4274,7 +4274,7 @@ types_equal (struct type *a, struct type *b)
if (a->num_fields () != b->num_fields ()) if (a->num_fields () != b->num_fields ())
return false; return false;
if (!types_equal (TYPE_TARGET_TYPE (a), TYPE_TARGET_TYPE (b))) if (!types_equal (a->target_type (), b->target_type ()))
return false; return false;
for (i = 0; i < a->num_fields (); ++i) for (i = 0; i < a->num_fields (); ++i)
@ -4407,15 +4407,15 @@ check_types_equal (struct type *type1, struct type *type2,
} }
} }
if (TYPE_TARGET_TYPE (type1) != NULL) if (type1->target_type () != NULL)
{ {
if (TYPE_TARGET_TYPE (type2) == NULL) if (type2->target_type () == NULL)
return false; return false;
worklist->emplace_back (TYPE_TARGET_TYPE (type1), worklist->emplace_back (type1->target_type (),
TYPE_TARGET_TYPE (type2)); type2->target_type ());
} }
else if (TYPE_TARGET_TYPE (type2) != NULL) else if (type2->target_type () != NULL)
return false; return false;
return true; return true;
@ -4504,12 +4504,12 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
/* Allowed pointer conversions are: /* Allowed pointer conversions are:
(a) pointer to void-pointer conversion. */ (a) pointer to void-pointer conversion. */
if (TYPE_TARGET_TYPE (parm)->code () == TYPE_CODE_VOID) if (parm->target_type ()->code () == TYPE_CODE_VOID)
return VOID_PTR_CONVERSION_BADNESS; return VOID_PTR_CONVERSION_BADNESS;
/* (b) pointer to ancestor-pointer conversion. */ /* (b) pointer to ancestor-pointer conversion. */
rank.subrank = distance_to_ancestor (TYPE_TARGET_TYPE (parm), rank.subrank = distance_to_ancestor (parm->target_type (),
TYPE_TARGET_TYPE (arg), arg->target_type (),
0); 0);
if (rank.subrank >= 0) if (rank.subrank >= 0)
return sum_ranks (BASE_PTR_CONVERSION_BADNESS, rank); return sum_ranks (BASE_PTR_CONVERSION_BADNESS, rank);
@ -4517,8 +4517,8 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
{ {
struct type *t1 = TYPE_TARGET_TYPE (parm); struct type *t1 = parm->target_type ();
struct type *t2 = TYPE_TARGET_TYPE (arg); struct type *t2 = arg->target_type ();
if (types_equal (t1, t2)) if (types_equal (t1, t2))
{ {
@ -4534,7 +4534,7 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
} }
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL); return rank_one_type (parm->target_type (), arg, NULL);
case TYPE_CODE_INT: case TYPE_CODE_INT:
if (value != NULL && value_type (value)->code () == TYPE_CODE_INT) if (value != NULL && value_type (value)->code () == TYPE_CODE_INT)
{ {
@ -4571,8 +4571,8 @@ rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *val
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
return rank_one_type (TYPE_TARGET_TYPE (parm), return rank_one_type (parm->target_type (),
TYPE_TARGET_TYPE (arg), NULL); arg->target_type (), NULL);
default: default:
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
} }
@ -4586,7 +4586,7 @@ rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *valu
switch (arg->code ()) switch (arg->code ())
{ {
case TYPE_CODE_PTR: /* funcptr -> func */ case TYPE_CODE_PTR: /* funcptr -> func */
return rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL); return rank_one_type (parm, arg->target_type (), NULL);
default: default:
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
} }
@ -4909,7 +4909,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
lvalue references. */ lvalue references. */
if (parm->code () == TYPE_CODE_RVALUE_REF) if (parm->code () == TYPE_CODE_RVALUE_REF)
rank.subrank = REFERENCE_CONVERSION_RVALUE; rank.subrank = REFERENCE_CONVERSION_RVALUE;
else if (TYPE_CONST (TYPE_TARGET_TYPE (parm))) else if (TYPE_CONST (parm->target_type ()))
rank.subrank = REFERENCE_CONVERSION_CONST_LVALUE; rank.subrank = REFERENCE_CONVERSION_CONST_LVALUE;
else else
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
@ -4931,8 +4931,8 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
/* For pointers and references, compare target type. */ /* For pointers and references, compare target type. */
if (parm->is_pointer_or_reference ()) if (parm->is_pointer_or_reference ())
{ {
t1 = TYPE_TARGET_TYPE (parm); t1 = parm->target_type ();
t2 = TYPE_TARGET_TYPE (arg); t2 = arg->target_type ();
} }
/* Make sure they are CV equal, too. */ /* Make sure they are CV equal, too. */
@ -4949,10 +4949,10 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
references. */ references. */
if (TYPE_IS_REFERENCE (arg)) if (TYPE_IS_REFERENCE (arg))
return (sum_ranks (rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL), return (sum_ranks (rank_one_type (parm, arg->target_type (), NULL),
REFERENCE_SEE_THROUGH_BADNESS)); REFERENCE_SEE_THROUGH_BADNESS));
if (TYPE_IS_REFERENCE (parm)) if (TYPE_IS_REFERENCE (parm))
return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL), return (sum_ranks (rank_one_type (parm->target_type (), arg, NULL),
REFERENCE_SEE_THROUGH_BADNESS)); REFERENCE_SEE_THROUGH_BADNESS));
if (overload_debug) if (overload_debug)
{ {
@ -5354,10 +5354,10 @@ recursive_dump_type (struct type *type, int spaces)
gdb_printf ("%*sgdbarch %s\n", spaces, "", gdb_printf ("%*sgdbarch %s\n", spaces, "",
host_address_to_string (type->arch_owner ())); host_address_to_string (type->arch_owner ()));
gdb_printf ("%*starget_type %s\n", spaces, "", gdb_printf ("%*starget_type %s\n", spaces, "",
host_address_to_string (TYPE_TARGET_TYPE (type))); host_address_to_string (type->target_type ()));
if (TYPE_TARGET_TYPE (type) != NULL) if (type->target_type () != NULL)
{ {
recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2); recursive_dump_type (type->target_type (), spaces + 2);
} }
gdb_printf ("%*spointer_type %s\n", spaces, "", gdb_printf ("%*spointer_type %s\n", spaces, "",
host_address_to_string (TYPE_POINTER_TYPE (type))); host_address_to_string (TYPE_POINTER_TYPE (type)));
@ -5727,9 +5727,9 @@ copy_type_recursive (struct type *type, htab_t copied_types)
/* Copy pointers to other types. */ /* Copy pointers to other types. */
if (TYPE_TARGET_TYPE (type)) if (type->target_type ())
new_type->set_target_type new_type->set_target_type
(copy_type_recursive (TYPE_TARGET_TYPE (type), copied_types)); (copy_type_recursive (type->target_type (), copied_types));
/* Maybe copy the type_specific bits. /* Maybe copy the type_specific bits.
@ -6110,7 +6110,7 @@ bool
is_fixed_point_type (struct type *type) is_fixed_point_type (struct type *type)
{ {
while (check_typedef (type)->code () == TYPE_CODE_RANGE) while (check_typedef (type)->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (check_typedef (type)); type = check_typedef (type)->target_type ();
type = check_typedef (type); type = check_typedef (type);
return type->code () == TYPE_CODE_FIXED_POINT; return type->code () == TYPE_CODE_FIXED_POINT;
@ -6124,7 +6124,7 @@ type::fixed_point_type_base_type ()
struct type *type = this; struct type *type = this;
while (check_typedef (type)->code () == TYPE_CODE_RANGE) while (check_typedef (type)->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (check_typedef (type)); type = check_typedef (type)->target_type ();
type = check_typedef (type); type = check_typedef (type);
gdb_assert (type->code () == TYPE_CODE_FIXED_POINT); gdb_assert (type->code () == TYPE_CODE_FIXED_POINT);

View File

@ -105,7 +105,7 @@ enum type_code
Regardless of the language, GDB represents multidimensional Regardless of the language, GDB represents multidimensional
array types the way C does: as arrays of arrays. So an array types the way C does: as arrays of arrays. So an
instance of a GDB array type T can always be seen as a series instance of a GDB array type T can always be seen as a series
of instances of TYPE_TARGET_TYPE (T) laid out sequentially in of instances of T->target_type () laid out sequentially in
memory. memory.
Row-major languages like C lay out multi-dimensional arrays so Row-major languages like C lay out multi-dimensional arrays so
@ -1256,7 +1256,7 @@ struct type
} }
/* Used only for TYPE_CODE_FUNC where it specifies the real function /* Used only for TYPE_CODE_FUNC where it specifies the real function
address is returned by this function call. TYPE_TARGET_TYPE address is returned by this function call. The target_type method
determines the final returned function type to be presented to determines the final returned function type to be presented to
user. */ user. */
@ -2097,7 +2097,6 @@ extern void allocate_gnat_aux_type (struct type *);
allocate_fixed_point_type_info (type)) allocate_fixed_point_type_info (type))
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_TARGET_TYPE(thistype) ((thistype)->target_type ())
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type

View File

@ -108,7 +108,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
fcontext = TYPE_VPTR_BASETYPE (type); fcontext = TYPE_VPTR_BASETYPE (type);
context = lookup_pointer_type (fcontext); context = lookup_pointer_type (fcontext);
/* Now context is a pointer to the basetype containing the vtbl. */ /* Now context is a pointer to the basetype containing the vtbl. */
if (TYPE_TARGET_TYPE (context) != type1) if (context->target_type () != type1)
{ {
struct value *tmp = value_cast (context, value_addr (arg1)); struct value *tmp = value_cast (context, value_addr (arg1));
@ -133,7 +133,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
/* With older versions of g++, the vtbl field pointed to an array /* With older versions of g++, the vtbl field pointed to an array
of structures. Nowadays it points directly to the structure. */ of structures. Nowadays it points directly to the structure. */
if (value_type (vtbl)->code () == TYPE_CODE_PTR if (value_type (vtbl)->code () == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (value_type (vtbl))->code () == TYPE_CODE_ARRAY) && value_type (vtbl)->target_type ()->code () == TYPE_CODE_ARRAY)
{ {
/* Handle the case where the vtbl field points to an /* Handle the case where the vtbl field points to an
array of structures. */ array of structures. */
@ -323,13 +323,13 @@ vb_match (struct type *type, int index, struct type *basetype)
nameless types) or have the same name. This is ugly, and a more nameless types) or have the same name. This is ugly, and a more
elegant solution should be devised (which would probably just push elegant solution should be devised (which would probably just push
the ugliness into symbol reading unless we change the stabs format). */ the ugliness into symbol reading unless we change the stabs format). */
if (TYPE_TARGET_TYPE (fieldtype) == basetype) if (fieldtype->target_type () == basetype)
return 1; return 1;
if (basetype->name () != NULL if (basetype->name () != NULL
&& TYPE_TARGET_TYPE (fieldtype)->name () != NULL && fieldtype->target_type ()->name () != NULL
&& strcmp (basetype->name (), && strcmp (basetype->name (),
TYPE_TARGET_TYPE (fieldtype)->name ()) == 0) fieldtype->target_type ()->name ()) == 0)
return 1; return 1;
return 0; return 0;
} }

View File

@ -742,7 +742,7 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
self_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr))); self_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr)));
final_type = lookup_pointer_type (self_type); final_type = lookup_pointer_type (self_type);
method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr))); method_type = check_typedef (value_type (method_ptr))->target_type ();
/* Extract the pointer to member. */ /* Extract the pointer to member. */
gdbarch = self_type->arch (); gdbarch = self_type->arch ();
@ -1109,7 +1109,7 @@ gnuv3_get_typeid (struct value *value)
/* In the non_lvalue case, a reference might have slipped through /* In the non_lvalue case, a reference might have slipped through
here. */ here. */
if (type->code () == TYPE_CODE_REF) if (type->code () == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
/* Ignore top-level cv-qualifiers. */ /* Ignore top-level cv-qualifiers. */
type = make_cv_type (0, 0, type, NULL); type = make_cv_type (0, 0, type, NULL);
@ -1341,7 +1341,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
if (arg_type->code () != expected) if (arg_type->code () != expected)
return false; return false;
struct type *target = check_typedef (TYPE_TARGET_TYPE (arg_type)); struct type *target = check_typedef (arg_type->target_type ());
if (!(class_types_same_p (target, class_type))) if (!(class_types_same_p (target, class_type)))
return false; return false;
@ -1538,7 +1538,7 @@ gnuv3_pass_by_reference (struct type *type)
/* For arrays, make the decision based on the element type. */ /* For arrays, make the decision based on the element type. */
if (field_type->code () == TYPE_CODE_ARRAY) if (field_type->code () == TYPE_CODE_ARRAY)
field_type = check_typedef (TYPE_TARGET_TYPE (field_type)); field_type = check_typedef (field_type->target_type ());
struct language_pass_by_ref_info field_info struct language_pass_by_ref_info field_info
= gnuv3_pass_by_reference (field_type); = gnuv3_pass_by_reference (field_type);

View File

@ -86,7 +86,7 @@ gccgo_string_p (struct type *type)
&& type1->code () == TYPE_CODE_INT && type1->code () == TYPE_CODE_INT
&& strcmp (type->field (1).name (), "__length") == 0) && strcmp (type->field (1).name (), "__length") == 0)
{ {
struct type *target_type = TYPE_TARGET_TYPE (type0); struct type *target_type = type0->target_type ();
target_type = check_typedef (target_type); target_type = check_typedef (target_type);

View File

@ -52,7 +52,7 @@ go_language::print_type (struct type *type, const char *varstring,
/* Print the type of "abc" as "string", not char[4]. */ /* Print the type of "abc" as "string", not char[4]. */
if (type->code () == TYPE_CODE_ARRAY if (type->code () == TYPE_CODE_ARRAY
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR) && type->target_type ()->code () == TYPE_CODE_CHAR)
{ {
gdb_puts ("string", stream); gdb_puts ("string", stream);
return; return;

View File

@ -45,7 +45,7 @@ print_go_string (struct type *type,
{ {
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
struct type *elt_ptr_type = type->field (0).type (); struct type *elt_ptr_type = type->field (0).type ();
struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type); struct type *elt_type = elt_ptr_type->target_type ();
LONGEST length; LONGEST length;
/* TODO(dje): The encapsulation of what a pointer is belongs in value.c. /* TODO(dje): The encapsulation of what a pointer is belongs in value.c.
I.e. If there's going to be unpack_pointer, there should be I.e. If there's going to be unpack_pointer, there should be

View File

@ -205,7 +205,7 @@ lsscm_elt_type (lazy_string_smob *ls_smob)
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
return TYPE_TARGET_TYPE (realtype); return realtype->target_type ();
default: default:
/* This is done to preserve existing behaviour. PR 20769. /* This is done to preserve existing behaviour. PR 20769.
E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */ E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */
@ -324,7 +324,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
/* PR 20786: There's no way to specify an array of length zero. /* PR 20786: There's no way to specify an array of length zero.
Record a length of [0,-1] which is how Ada does it. Anything Record a length of [0,-1] which is how Ada does it. Anything
we do is broken, but this one possible solution. */ we do is broken, but this one possible solution. */
type = lookup_array_range_type (TYPE_TARGET_TYPE (realtype), type = lookup_array_range_type (realtype->target_type (),
0, ls_smob->length - 1); 0, ls_smob->length - 1);
value = value_at_lazy (type, ls_smob->address); value = value_at_lazy (type, ls_smob->address);
} }

View File

@ -65,7 +65,7 @@ enum valscm_binary_opcode
/* If TYPE is a reference, return the target; otherwise return TYPE. */ /* If TYPE is a reference, return the target; otherwise return TYPE. */
#define STRIP_REFERENCE(TYPE) \ #define STRIP_REFERENCE(TYPE) \
((TYPE->code () == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE)) ((TYPE->code () == TYPE_CODE_REF) ? ((TYPE)->target_type ()) : (TYPE))
/* Helper for vlscm_unop. Contains all the code that may throw a GDB /* Helper for vlscm_unop. Contains all the code that may throw a GDB
exception. */ exception. */

View File

@ -683,7 +683,7 @@ tyscm_get_composite (struct type *type)
if (type->code () != TYPE_CODE_PTR if (type->code () != TYPE_CODE_PTR
&& type->code () != TYPE_CODE_REF) && type->code () != TYPE_CODE_REF)
break; break;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
/* If this is not a struct, union, or enum type, raise TypeError /* If this is not a struct, union, or enum type, raise TypeError
@ -874,9 +874,9 @@ gdbscm_type_target (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type; struct type *type = t_smob->type;
SCM_ASSERT (TYPE_TARGET_TYPE (type), self, SCM_ARG1, FUNC_NAME); SCM_ASSERT (type->target_type (), self, SCM_ARG1, FUNC_NAME);
return tyscm_scm_from_type (TYPE_TARGET_TYPE (type)); return tyscm_scm_from_type (type->target_type ());
} }
/* (type-const <gdb:type>) -> <gdb:type> /* (type-const <gdb:type>) -> <gdb:type>

View File

@ -576,7 +576,7 @@ gdbscm_value_dynamic_type (SCM self)
if (((type->code () == TYPE_CODE_PTR) if (((type->code () == TYPE_CODE_PTR)
|| (type->code () == TYPE_CODE_REF)) || (type->code () == TYPE_CODE_REF))
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{ {
struct value *target; struct value *target;
int was_pointer = type->code () == TYPE_CODE_PTR; int was_pointer = type->code () == TYPE_CODE_PTR;
@ -1181,7 +1181,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
length = array_length; length = array_length;
else if (array_length == -1) else if (array_length == -1)
{ {
type = lookup_array_range_type (TYPE_TARGET_TYPE (realtype), type = lookup_array_range_type (realtype->target_type (),
0, length - 1); 0, length - 1);
} }
else if (length != array_length) else if (length != array_length)
@ -1190,7 +1190,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
specified length. */ specified length. */
if (length > array_length) if (length > array_length)
error (_("length is larger than array size")); error (_("length is larger than array size"));
type = lookup_array_range_type (TYPE_TARGET_TYPE (type), type = lookup_array_range_type (type->target_type (),
low_bound, low_bound,
low_bound + length - 1); low_bound + length - 1);
} }

View File

@ -1051,7 +1051,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* If we are passing a function pointer, make sure we pass a function /* If we are passing a function pointer, make sure we pass a function
descriptor instead of the function entry address. */ descriptor instead of the function entry address. */
if (type->code () == TYPE_CODE_PTR if (type->code () == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC) && type->target_type ()->code () == TYPE_CODE_FUNC)
{ {
ULONGEST codeptr, fptr; ULONGEST codeptr, fptr;

View File

@ -2647,7 +2647,7 @@ i386_16_byte_align_p (struct type *type)
&& TYPE_LENGTH (type) == 16) && TYPE_LENGTH (type) == 16)
return 1; return 1;
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
return i386_16_byte_align_p (TYPE_TARGET_TYPE (type)); return i386_16_byte_align_p (type->target_type ());
if (type->code () == TYPE_CODE_STRUCT if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION) || type->code () == TYPE_CODE_UNION)
{ {

View File

@ -116,7 +116,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *type = check_typedef (value_type (function)); struct type *type = check_typedef (value_type (function));
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
/* read_subroutine_type sets for non-static member functions the /* read_subroutine_type sets for non-static member functions the
artificial flag of the first parameter ('this' pointer). */ artificial flag of the first parameter ('this' pointer). */

View File

@ -3341,7 +3341,7 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
return return
is_float_or_hfa_type_recurse (check_typedef (TYPE_TARGET_TYPE (t)), is_float_or_hfa_type_recurse (check_typedef (t->target_type ()),
etp); etp);
break; break;
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
@ -3393,7 +3393,7 @@ slot_alignment_is_next_even (struct type *t)
return 0; return 0;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
return return
slot_alignment_is_next_even (check_typedef (TYPE_TARGET_TYPE (t))); slot_alignment_is_next_even (check_typedef (t->target_type ()));
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
{ {
int i; int i;
@ -3747,7 +3747,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Special handling for function parameters. */ /* Special handling for function parameters. */
if (len == 8 if (len == 8
&& type->code () == TYPE_CODE_PTR && type->code () == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC) && type->target_type ()->code () == TYPE_CODE_FUNC)
{ {
gdb_byte val_buf[8]; gdb_byte val_buf[8];
ULONGEST faddr = extract_unsigned_integer ULONGEST faddr = extract_unsigned_integer

View File

@ -183,7 +183,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
convert it back to a reference. This will issue an error convert it back to a reference. This will issue an error
if the value was not previously in memory - in some cases if the value was not previously in memory - in some cases
we should clearly be allowing this, but how? */ we should clearly be allowing this, but how? */
new_value = value_cast (TYPE_TARGET_TYPE (type), arg); new_value = value_cast (type->target_type (), arg);
new_value = value_ref (new_value, type->code ()); new_value = value_ref (new_value, type->code ());
return new_value; return new_value;
} }
@ -221,7 +221,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
because they are passed by value. */ because they are passed by value. */
if (current_language->c_style_arrays_p ()) if (current_language->c_style_arrays_p ())
if (!type->is_vector ()) if (!type->is_vector ())
type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); type = lookup_pointer_type (type->target_type ());
break; break;
case TYPE_CODE_UNDEF: case TYPE_CODE_UNDEF:
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
@ -266,7 +266,7 @@ find_function_addr (struct value *function,
else if (ftype->code () == TYPE_CODE_PTR) else if (ftype->code () == TYPE_CODE_PTR)
{ {
funaddr = value_as_address (function); funaddr = value_as_address (function);
ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); ftype = check_typedef (ftype->target_type ());
if (ftype->code () == TYPE_CODE_FUNC if (ftype->code () == TYPE_CODE_FUNC
|| ftype->code () == TYPE_CODE_METHOD) || ftype->code () == TYPE_CODE_METHOD)
funaddr = gdbarch_convert_from_func_ptr_addr funaddr = gdbarch_convert_from_func_ptr_addr
@ -295,13 +295,13 @@ find_function_addr (struct value *function,
target_ftype = find_gnu_ifunc_target_type (resolver_addr); target_ftype = find_gnu_ifunc_target_type (resolver_addr);
if (target_ftype != NULL) if (target_ftype != NULL)
{ {
value_type = TYPE_TARGET_TYPE (check_typedef (target_ftype)); value_type = check_typedef (target_ftype)->target_type ();
ftype = target_ftype; ftype = target_ftype;
} }
} }
} }
else else
value_type = TYPE_TARGET_TYPE (ftype); value_type = ftype->target_type ();
} }
else if (ftype->code () == TYPE_CODE_INT) else if (ftype->code () == TYPE_CODE_INT)
{ {
@ -1027,7 +1027,7 @@ call_function_by_hand_dummy (struct value *function,
prototyped. Can we respect TYPE_VARARGS? Probably not. */ prototyped. Can we respect TYPE_VARARGS? Probably not. */
if (ftype->code () == TYPE_CODE_METHOD) if (ftype->code () == TYPE_CODE_METHOD)
prototyped = 1; prototyped = 1;
else if (TYPE_TARGET_TYPE (ftype) == NULL && ftype->num_fields () == 0 else if (ftype->target_type () == NULL && ftype->num_fields () == 0
&& default_return_type != NULL) && default_return_type != NULL)
{ {
/* Calling a no-debug function with the return type /* Calling a no-debug function with the return type

View File

@ -1466,7 +1466,7 @@ get_return_value (struct symbol *func_symbol, struct value *function)
struct value *value; struct value *value;
struct type *value_type struct type *value_type
= check_typedef (TYPE_TARGET_TYPE (func_symbol->type ())); = check_typedef (func_symbol->type ()->target_type ());
gdb_assert (value_type->code () != TYPE_CODE_VOID); gdb_assert (value_type->code () != TYPE_CODE_VOID);
if (is_nocall_function (check_typedef (::value_type (function)))) if (is_nocall_function (check_typedef (::value_type (function))))
@ -1626,7 +1626,7 @@ finish_command_fsm::should_stop (struct thread_info *tp)
/* We're done. */ /* We're done. */
set_finished (); set_finished ();
rv->type = TYPE_TARGET_TYPE (function->type ()); rv->type = function->type ()->target_type ();
if (rv->type == NULL) if (rv->type == NULL)
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type")); _("finish_command: function has no target type"));

View File

@ -89,13 +89,13 @@ iq2000_pointer_to_address (struct gdbarch *gdbarch,
struct type * type, const gdb_byte * buf) struct type * type, const gdb_byte * buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_TARGET_TYPE (type)->code (); enum type_code target = type->target_type ()->code ();
CORE_ADDR addr CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
if (target == TYPE_CODE_FUNC if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD || target == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) || TYPE_CODE_SPACE (type->target_type ()))
addr = insn_addr_from_ptr (addr); addr = insn_addr_from_ptr (addr);
return addr; return addr;
@ -109,7 +109,7 @@ iq2000_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr) struct type *type, gdb_byte *buf, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_TARGET_TYPE (type)->code (); enum type_code target = type->target_type ()->code ();
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
addr = insn_ptr_from_addr (addr); addr = insn_ptr_from_addr (addr);
@ -599,7 +599,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
/* Skip typedefs. */ /* Skip typedefs. */
while (type->code () == TYPE_CODE_TYPEDEF) while (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
/* Non-struct and non-union types are always passed by value. */ /* Non-struct and non-union types are always passed by value. */
if (type->code () != TYPE_CODE_STRUCT if (type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION) && type->code () != TYPE_CODE_UNION)
@ -614,7 +614,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
return 1; return 1;
/* Skip typedefs of field type. */ /* Skip typedefs of field type. */
while (ftype->code () == TYPE_CODE_TYPEDEF) while (ftype->code () == TYPE_CODE_TYPEDEF)
ftype = TYPE_TARGET_TYPE (ftype); ftype = ftype->target_type ();
/* If field is int or float, pass by value. */ /* If field is int or float, pass by value. */
if (ftype->code () == TYPE_CODE_FLT if (ftype->code () == TYPE_CODE_FLT
|| ftype->code () == TYPE_CODE_INT) || ftype->code () == TYPE_CODE_INT)

View File

@ -601,7 +601,7 @@ language_defn::watch_location_expression (struct type *type,
CORE_ADDR addr) const CORE_ADDR addr) const
{ {
/* Generates an expression that assumes a C like syntax is valid. */ /* Generates an expression that assumes a C like syntax is valid. */
type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type); std::string name = type_to_string (type);
return xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr)); return xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr));
} }
@ -850,7 +850,7 @@ public:
type = check_typedef (type); type = check_typedef (type);
while (type->code () == TYPE_CODE_REF) while (type->code () == TYPE_CODE_REF)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
type = check_typedef (type); type = check_typedef (type);
} }
return (type->code () == TYPE_CODE_STRING); return (type->code () == TYPE_CODE_STRING);

View File

@ -1026,7 +1026,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
break; break;
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
{ {
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); struct type *target_type = check_typedef (type->target_type ());
size_t target_len = TYPE_LENGTH (target_type); size_t target_len = TYPE_LENGTH (target_type);
if (target_len < regsize) if (target_len < regsize)

View File

@ -104,7 +104,7 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
} }
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1)); return value_zero (type->target_type (), VALUE_LVAL (arg1));
else else
return value_subscript (arg1, value_as_long (arg2)); return value_subscript (arg1, value_as_long (arg2));
} }

View File

@ -119,9 +119,9 @@ public:
type = check_typedef (type); type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY if (type->code () == TYPE_CODE_ARRAY
&& TYPE_LENGTH (type) > 0 && TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) && TYPE_LENGTH (type->target_type ()) > 0)
{ {
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
if (TYPE_LENGTH (elttype) == 1 if (TYPE_LENGTH (elttype) == 1
&& (elttype->code () == TYPE_CODE_INT && (elttype->code () == TYPE_CODE_INT

View File

@ -190,14 +190,14 @@ m2_range (struct type *type, struct ui_file *stream, int show,
{ {
if (type->bounds ()->high.const_val () == type->bounds ()->low.const_val ()) if (type->bounds ()->high.const_val () == type->bounds ()->low.const_val ())
{ {
/* FIXME: TYPE_TARGET_TYPE used to be TYPE_DOMAIN_TYPE but that was /* FIXME: type::target_type used to be TYPE_DOMAIN_TYPE but that was
wrong. Not sure if TYPE_TARGET_TYPE is correct though. */ wrong. Not sure if type::target_type is correct though. */
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, m2_print_type (type->target_type (), "", stream, show, level,
flags); flags);
} }
else else
{ {
struct type *target = TYPE_TARGET_TYPE (type); struct type *target = type->target_type ();
gdb_printf (stream, "["); gdb_printf (stream, "[");
print_type_scalar (target, type->bounds ()->low.const_val (), stream); print_type_scalar (target, type->bounds ()->low.const_val (), stream);
@ -216,7 +216,7 @@ m2_typedef (struct type *type, struct ui_file *stream, int show,
gdb_puts (type->name (), stream); gdb_puts (type->name (), stream);
gdb_puts (" = ", stream); gdb_puts (" = ", stream);
} }
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); m2_print_type (type->target_type (), "", stream, show, level, flags);
} }
/* m2_array - prints out a Modula-2 ARRAY ... OF type. */ /* m2_array - prints out a Modula-2 ARRAY ... OF type. */
@ -225,7 +225,7 @@ static void m2_array (struct type *type, struct ui_file *stream,
int show, int level, const struct type_print_options *flags) int show, int level, const struct type_print_options *flags)
{ {
gdb_printf (stream, "ARRAY ["); gdb_printf (stream, "ARRAY [");
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 if (TYPE_LENGTH (type->target_type ()) > 0
&& type->bounds ()->high.kind () != PROP_UNDEFINED) && type->bounds ()->high.kind () != PROP_UNDEFINED)
{ {
if (type->index_type () != 0) if (type->index_type () != 0)
@ -236,11 +236,11 @@ static void m2_array (struct type *type, struct ui_file *stream,
} }
else else
gdb_puts (pulongest ((TYPE_LENGTH (type) gdb_puts (pulongest ((TYPE_LENGTH (type)
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type)))), / TYPE_LENGTH (type->target_type ()))),
stream); stream);
} }
gdb_printf (stream, "] OF "); gdb_printf (stream, "] OF ");
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); m2_print_type (type->target_type (), "", stream, show, level, flags);
} }
static void static void
@ -252,7 +252,7 @@ m2_pointer (struct type *type, struct ui_file *stream, int show,
else else
gdb_printf (stream, "POINTER TO "); gdb_printf (stream, "POINTER TO ");
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); m2_print_type (type->target_type (), "", stream, show, level, flags);
} }
static void static void
@ -260,7 +260,7 @@ m2_ref (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags) int level, const struct type_print_options *flags)
{ {
gdb_printf (stream, "VAR"); gdb_printf (stream, "VAR");
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); m2_print_type (type->target_type (), "", stream, show, level, flags);
} }
static void static void
@ -281,8 +281,8 @@ m2_procedure (struct type *type, struct ui_file *stream,
{ {
gdb_printf (stream, "PROCEDURE "); gdb_printf (stream, "PROCEDURE ");
m2_type_name (type, stream); m2_type_name (type, stream);
if (TYPE_TARGET_TYPE (type) == NULL if (type->target_type () == NULL
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) || type->target_type ()->code () != TYPE_CODE_VOID)
{ {
int i, len = type->num_fields (); int i, len = type->num_fields ();
@ -297,8 +297,8 @@ m2_procedure (struct type *type, struct ui_file *stream,
m2_print_type (type->field (i).type (), "", stream, -1, 0, flags); m2_print_type (type->field (i).type (), "", stream, -1, 0, flags);
} }
gdb_printf (stream, ") : "); gdb_printf (stream, ") : ");
if (TYPE_TARGET_TYPE (type) != NULL) if (type->target_type () != NULL)
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags); m2_print_type (type->target_type (), "", stream, 0, 0, flags);
else else
type_print_unknown_return_type (stream); type_print_unknown_return_type (stream);
} }
@ -309,7 +309,7 @@ m2_print_bounds (struct type *type,
struct ui_file *stream, int show, int level, struct ui_file *stream, int show, int level,
int print_high) int print_high)
{ {
struct type *target = TYPE_TARGET_TYPE (type); struct type *target = type->target_type ();
if (type->num_fields () == 0) if (type->num_fields () == 0)
return; return;
@ -414,7 +414,7 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
if (len == 0) if (len == 0)
return 0; return 0;
range = type->field (i).type ()->index_type (); range = type->field (i).type ()->index_type ();
target = TYPE_TARGET_TYPE (range); target = range->target_type ();
l1 = type->field (i).type ()->bounds ()->low.const_val (); l1 = type->field (i).type ()->bounds ()->low.const_val ();
h1 = type->field (len - 1).type ()->bounds ()->high.const_val (); h1 = type->field (len - 1).type ()->bounds ()->high.const_val ();
@ -487,7 +487,7 @@ m2_is_unbounded_array (struct type *type)
/* /*
* check if we have a structure with exactly two fields named * check if we have a structure with exactly two fields named
* _m2_contents and _m2_high. It also checks to see if the * _m2_contents and _m2_high. It also checks to see if the
* type of _m2_contents is a pointer. The TYPE_TARGET_TYPE * type of _m2_contents is a pointer. The type::target_type
* of the pointer determines the unbounded ARRAY OF type. * of the pointer determines the unbounded ARRAY OF type.
*/ */
if (type->num_fields () != 2) if (type->num_fields () != 2)
@ -517,7 +517,7 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
if (show > 0) if (show > 0)
{ {
gdb_puts ("ARRAY OF ", stream); gdb_puts ("ARRAY OF ", stream);
m2_print_type (TYPE_TARGET_TYPE (type->field (0).type ()), m2_print_type (type->field (0).type ()->target_type (),
"", stream, 0, level, flags); "", stream, 0, level, flags);
} }
return 1; return 1;

View File

@ -95,7 +95,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
return; return;
} }
target = TYPE_TARGET_TYPE (range); target = range->target_type ();
if (get_discrete_bounds (range, &field_low, &field_high)) if (get_discrete_bounds (range, &field_low, &field_high))
{ {
@ -139,7 +139,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
range = type->field (field).type ()->index_type (); range = type->field (field).type ()->index_type ();
if (!get_discrete_bounds (range, &field_low, &field_high)) if (!get_discrete_bounds (range, &field_low, &field_high))
break; break;
target = TYPE_TARGET_TYPE (range); target = range->target_type ();
} }
} }
if (element_seen) if (element_seen)
@ -171,7 +171,7 @@ m2_print_unbounded_array (struct value *value,
(type->field (0).loc_bitpos () / 8) + (type->field (0).loc_bitpos () / 8) +
valaddr); valaddr);
val = value_at_lazy (TYPE_TARGET_TYPE (type->field (0).type ()), val = value_at_lazy (type->field (0).type ()->target_type (),
addr); addr);
len = unpack_field_as_long (type, valaddr, 1); len = unpack_field_as_long (type, valaddr, 1);
@ -187,7 +187,7 @@ print_unpacked_pointer (struct type *type,
struct ui_file *stream) struct ui_file *stream)
{ {
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
int want_space = 0; int want_space = 0;
if (elttype->code () == TYPE_CODE_FUNC) if (elttype->code () == TYPE_CODE_FUNC)
@ -214,7 +214,7 @@ print_unpacked_pointer (struct type *type,
{ {
if (want_space) if (want_space)
gdb_puts (" ", stream); gdb_puts (" ", stream);
return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1, return val_print_string (type->target_type (), NULL, addr, -1,
stream, options); stream, options);
} }
@ -230,7 +230,7 @@ print_variable_at_address (struct type *type,
{ {
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
CORE_ADDR addr = unpack_pointer (type, valaddr); CORE_ADDR addr = unpack_pointer (type, valaddr);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
gdb_printf (stream, "["); gdb_printf (stream, "[");
gdb_puts (paddress (gdbarch, addr), stream); gdb_puts (paddress (gdbarch, addr), stream);
@ -239,7 +239,7 @@ print_variable_at_address (struct type *type,
if (elttype->code () != TYPE_CODE_UNDEF) if (elttype->code () != TYPE_CODE_UNDEF)
{ {
struct value *deref_val = struct value *deref_val =
value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr)); value_at (type->target_type (), unpack_pointer (type, valaddr));
common_val_print (deref_val, stream, recurse, options, current_language); common_val_print (deref_val, stream, recurse, options, current_language);
} }
@ -312,9 +312,9 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (type->target_type ()) > 0)
{ {
elttype = check_typedef (TYPE_TARGET_TYPE (type)); elttype = check_typedef (type->target_type ());
len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype); len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype);
/* For an array of chars, print with string syntax. */ /* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (elttype) == 1 && if (TYPE_LENGTH (elttype) == 1 &&
@ -337,7 +337,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
len = temp_len; len = temp_len;
} }
printstr (stream, TYPE_TARGET_TYPE (type), valaddr, len, printstr (stream, type->target_type (), valaddr, len,
NULL, 0, options); NULL, 0, options);
} }
else else
@ -443,9 +443,9 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
break; break;
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type))) if (TYPE_LENGTH (type) == TYPE_LENGTH (type->target_type ()))
{ {
struct value *v = value_cast (TYPE_TARGET_TYPE (type), val); struct value *v = value_cast (type->target_type (), val);
value_print_inner (v, stream, recurse, options); value_print_inner (v, stream, recurse, options);
break; break;
} }

View File

@ -2033,7 +2033,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Dereference function pointer types. */ /* Dereference function pointer types. */
if (func_type->code () == TYPE_CODE_PTR) if (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type); func_type = func_type->target_type ();
gdb_assert (func_type->code () == TYPE_CODE_FUNC || gdb_assert (func_type->code () == TYPE_CODE_FUNC ||
func_type->code () == TYPE_CODE_METHOD); func_type->code () == TYPE_CODE_METHOD);
@ -2412,7 +2412,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
enum type_code target_code; enum type_code target_code;
gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)); gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
target_code = TYPE_TARGET_TYPE (type)->code (); target_code = type->target_type ()->code ();
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{ {
@ -2493,7 +2493,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
target_code = TYPE_TARGET_TYPE (type)->code (); target_code = type->target_type ()->code ();
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{ {

View File

@ -404,7 +404,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
const bool is_vector = code == TYPE_CODE_ARRAY && type->is_vector (); const bool is_vector = code == TYPE_CODE_ARRAY && type->is_vector ();
if (is_vector if (is_vector
&& check_typedef (TYPE_TARGET_TYPE (type))->code () == TYPE_CODE_FLT) && check_typedef (type->target_type ())->code () == TYPE_CODE_FLT)
return 0; return 0;
/* According to m68k_return_in_memory in the m68k GCC back-end, /* According to m68k_return_in_memory in the m68k GCC back-end,

View File

@ -1645,7 +1645,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
dereference them. */ dereference them. */
while (tp->code () == TYPE_CODE_PTR while (tp->code () == TYPE_CODE_PTR
|| tp->code () == TYPE_CODE_ARRAY) || tp->code () == TYPE_CODE_ARRAY)
tp = TYPE_TARGET_TYPE (tp); tp = tp->target_type ();
/* Make sure that TYPE_CODE(tp) has an expected type code. /* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries Any type may be returned from cross_ref if file indirect entries
@ -2041,7 +2041,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
if (processing_gcc_compilation == 0 if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0 && found_ecoff_debugging_info == 0
&& TYPE_TARGET_TYPE (s->type ())->code () == TYPE_CODE_VOID) && s->type ()->target_type ()->code () == TYPE_CODE_VOID)
s->set_type (objfile_type (mdebugread_objfile)->nodebug_text_symbol); s->set_type (objfile_type (mdebugread_objfile)->nodebug_text_symbol);
} }

View File

@ -658,7 +658,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Dereference function pointer types. */ /* Dereference function pointer types. */
while (func_type->code () == TYPE_CODE_PTR) while (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type); func_type = func_type->target_type ();
/* The end result had better be a function or a method. */ /* The end result had better be a function or a method. */
gdb_assert (func_type->code () == TYPE_CODE_FUNC gdb_assert (func_type->code () == TYPE_CODE_FUNC

View File

@ -53,9 +53,9 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code,
return (type->code () == TYPE_CODE_ARRAY && type->is_vector () return (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& get_array_bounds (type, &lowb, &highb) && get_array_bounds (type, &lowb, &highb)
&& TYPE_TARGET_TYPE (type)->code () == code && type->target_type ()->code () == code
&& TYPE_TARGET_TYPE (type)->is_unsigned () == flag_unsigned && type->target_type ()->is_unsigned () == flag_unsigned
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == el_length && TYPE_LENGTH (type->target_type ()) == el_length
&& TYPE_LENGTH (type) == length && TYPE_LENGTH (type) == length
&& highb - lowb + 1 == n); && highb - lowb + 1 == n);
}; };
@ -121,7 +121,7 @@ lval_func_read (struct value *v)
{ {
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v)); struct type *type = check_typedef (value_type (v));
struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); struct type *eltype = check_typedef (value_type (c->val))->target_type ();
LONGEST offset = value_offset (v); LONGEST offset = value_offset (v);
LONGEST elsize = TYPE_LENGTH (eltype); LONGEST elsize = TYPE_LENGTH (eltype);
int n, i, j = 0; int n, i, j = 0;
@ -150,7 +150,7 @@ lval_func_write (struct value *v, struct value *fromval)
struct value *mark = value_mark (); struct value *mark = value_mark ();
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v)); struct type *type = check_typedef (value_type (v));
struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); struct type *eltype = check_typedef (value_type (c->val))->target_type ();
LONGEST offset = value_offset (v); LONGEST offset = value_offset (v);
LONGEST elsize = TYPE_LENGTH (eltype); LONGEST elsize = TYPE_LENGTH (eltype);
int n, i, j = 0; int n, i, j = 0;
@ -198,7 +198,7 @@ lval_func_check_synthetic_pointer (const struct value *v,
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */ /* Size of the target type in bits. */
int elsize = int elsize =
TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; TYPE_LENGTH (check_typedef (value_type (c->val))->target_type ()) * 8;
int startrest = offset % elsize; int startrest = offset % elsize;
int start = offset / elsize; int start = offset / elsize;
int endrest = (offset + length) % elsize; int endrest = (offset + length) % elsize;
@ -271,7 +271,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
int *indices, int n) int *indices, int n)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
struct type *elm_type = TYPE_TARGET_TYPE (type); struct type *elm_type = type->target_type ();
struct value *ret; struct value *ret;
/* Check if a single component of a vector is requested which means /* Check if a single component of a vector is requested which means
@ -453,7 +453,7 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{ {
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
LONGEST lowb, highb; LONGEST lowb, highb;
int i; int i;
@ -547,8 +547,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
if (!t1_is_vec || !t2_is_vec) if (!t1_is_vec || !t2_is_vec)
error (_("Vector operations are not supported on scalar types")); error (_("Vector operations are not supported on scalar types"));
eltype1 = check_typedef (TYPE_TARGET_TYPE (type1)); eltype1 = check_typedef (type1->target_type ());
eltype2 = check_typedef (TYPE_TARGET_TYPE (type2)); eltype2 = check_typedef (type2->target_type ());
if (!get_array_bounds (type1,&lowb1, &highb1) if (!get_array_bounds (type1,&lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2)) || !get_array_bounds (type2, &lowb2, &highb2))
@ -622,7 +622,7 @@ opencl_value_cast (struct type *type, struct value *arg)
value_vector_widen will error if the scalar value is value_vector_widen will error if the scalar value is
truncated by the cast. To avoid the error, cast (and truncated by the cast. To avoid the error, cast (and
possibly truncate) here. */ possibly truncate) here. */
eltype = check_typedef (TYPE_TARGET_TYPE (to_type)); eltype = check_typedef (to_type->target_type ());
arg = value_cast (eltype, arg); arg = value_cast (eltype, arg);
return value_vector_widen (arg, type); return value_vector_widen (arg, type);
@ -810,8 +810,8 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
Cannot perform conditional operation on incompatible types")); Cannot perform conditional operation on incompatible types"));
} }
eltype2 = check_typedef (TYPE_TARGET_TYPE (type2)); eltype2 = check_typedef (type2->target_type ());
eltype3 = check_typedef (TYPE_TARGET_TYPE (type3)); eltype3 = check_typedef (type3->target_type ());
if (!get_array_bounds (type1, &lowb1, &highb1) if (!get_array_bounds (type1, &lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2) || !get_array_bounds (type2, &lowb2, &highb2)

View File

@ -220,7 +220,7 @@ exp1 : exp
exp : exp '^' %prec UNARY exp : exp '^' %prec UNARY
{ pstate->wrap<unop_ind_operation> (); { pstate->wrap<unop_ind_operation> ();
if (current_type) if (current_type)
current_type = TYPE_TARGET_TYPE (current_type); } current_type = current_type->target_type (); }
; ;
exp : '@' exp %prec UNARY exp : '@' exp %prec UNARY
@ -260,7 +260,7 @@ exp : field_exp FIELDNAME
while (current_type->code () while (current_type->code ()
== TYPE_CODE_PTR) == TYPE_CODE_PTR)
current_type = current_type =
TYPE_TARGET_TYPE (current_type); current_type->target_type ();
current_type = lookup_struct_elt_type ( current_type = lookup_struct_elt_type (
current_type, $2.ptr, 0); current_type, $2.ptr, 0);
} }
@ -278,7 +278,7 @@ exp : field_exp name
while (current_type->code () while (current_type->code ()
== TYPE_CODE_PTR) == TYPE_CODE_PTR)
current_type = current_type =
TYPE_TARGET_TYPE (current_type); current_type->target_type ();
current_type = lookup_struct_elt_type ( current_type = lookup_struct_elt_type (
current_type, $2.ptr, 0); current_type, $2.ptr, 0);
} }
@ -321,7 +321,7 @@ exp : exp '['
{ pop_current_type (); { pop_current_type ();
pstate->wrap2<subscript_operation> (); pstate->wrap2<subscript_operation> ();
if (current_type) if (current_type)
current_type = TYPE_TARGET_TYPE (current_type); } current_type = current_type->target_type (); }
; ;
exp : exp '(' exp : exp '('
@ -337,7 +337,7 @@ exp : exp '('
(pstate->pop (), std::move (args)); (pstate->pop (), std::move (args));
pop_current_type (); pop_current_type ();
if (current_type) if (current_type)
current_type = TYPE_TARGET_TYPE (current_type); current_type = current_type->target_type ();
} }
; ;
@ -353,7 +353,7 @@ exp : type '(' exp ')' %prec UNARY
{ {
/* Allow automatic dereference of classes. */ /* Allow automatic dereference of classes. */
if ((current_type->code () == TYPE_CODE_PTR) if ((current_type->code () == TYPE_CODE_PTR)
&& (TYPE_TARGET_TYPE (current_type)->code () == TYPE_CODE_STRUCT) && (current_type->target_type ()->code () == TYPE_CODE_STRUCT)
&& (($1)->code () == TYPE_CODE_STRUCT)) && (($1)->code () == TYPE_CODE_STRUCT))
pstate->wrap<unop_ind_operation> (); pstate->wrap<unop_ind_operation> ();
} }
@ -598,7 +598,7 @@ exp : THIS
{ {
if (this_type->code () == TYPE_CODE_PTR) if (this_type->code () == TYPE_CODE_PTR)
{ {
this_type = TYPE_TARGET_TYPE (this_type); this_type = this_type->target_type ();
pstate->wrap<unop_ind_operation> (); pstate->wrap<unop_ind_operation> ();
} }
} }

View File

@ -108,7 +108,7 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
if (string_pos) if (string_pos)
*string_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT; *string_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
if (char_type) if (char_type)
*char_type = TYPE_TARGET_TYPE (type->field (1).type ()); *char_type = type->field (1).type ()->target_type ();
if (arrayname) if (arrayname)
*arrayname = type->field (1).name (); *arrayname = type->field (1).name ();
return 2; return 2;
@ -130,10 +130,10 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
/* FIXME: how can I detect wide chars in GPC ?? */ /* FIXME: how can I detect wide chars in GPC ?? */
if (char_type) if (char_type)
{ {
*char_type = TYPE_TARGET_TYPE (type->field (2).type ()); *char_type = type->field (2).type ()->target_type ();
if ((*char_type)->code () == TYPE_CODE_ARRAY) if ((*char_type)->code () == TYPE_CODE_ARRAY)
*char_type = TYPE_TARGET_TYPE (*char_type); *char_type = (*char_type)->target_type ();
} }
if (arrayname) if (arrayname)
*arrayname = type->field (2).name (); *arrayname = type->field (2).name ();

View File

@ -184,7 +184,7 @@ pascal_language::type_print_varspec_prefix (struct type *type,
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
gdb_printf (stream, "^"); gdb_printf (stream, "^");
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1, type_print_varspec_prefix (type->target_type (), stream, 0, 1,
flags); flags);
break; /* Pointer should be handled normally break; /* Pointer should be handled normally
in pascal. */ in pascal. */
@ -192,8 +192,8 @@ pascal_language::type_print_varspec_prefix (struct type *type,
case TYPE_CODE_METHOD: case TYPE_CODE_METHOD:
if (passed_a_ptr) if (passed_a_ptr)
gdb_printf (stream, "("); gdb_printf (stream, "(");
if (TYPE_TARGET_TYPE (type) != NULL if (type->target_type () != NULL
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) && type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_printf (stream, "function "); gdb_printf (stream, "function ");
} }
@ -212,7 +212,7 @@ pascal_language::type_print_varspec_prefix (struct type *type,
break; break;
case TYPE_CODE_REF: case TYPE_CODE_REF:
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1, type_print_varspec_prefix (type->target_type (), stream, 0, 1,
flags); flags);
gdb_printf (stream, "&"); gdb_printf (stream, "&");
break; break;
@ -221,8 +221,8 @@ pascal_language::type_print_varspec_prefix (struct type *type,
if (passed_a_ptr) if (passed_a_ptr)
gdb_printf (stream, "("); gdb_printf (stream, "(");
if (TYPE_TARGET_TYPE (type) != NULL if (type->target_type () != NULL
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) && type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_printf (stream, "function "); gdb_printf (stream, "function ");
} }
@ -237,7 +237,7 @@ pascal_language::type_print_varspec_prefix (struct type *type,
if (passed_a_ptr) if (passed_a_ptr)
gdb_printf (stream, "("); gdb_printf (stream, "(");
gdb_printf (stream, "array "); gdb_printf (stream, "array ");
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 if (TYPE_LENGTH (type->target_type ()) > 0
&& type->bounds ()->high.kind () != PROP_UNDEFINED) && type->bounds ()->high.kind () != PROP_UNDEFINED)
gdb_printf (stream, "[%s..%s] ", gdb_printf (stream, "[%s..%s] ",
plongest (type->bounds ()->low.const_val ()), plongest (type->bounds ()->low.const_val ()),
@ -313,20 +313,20 @@ pascal_language::type_print_func_varspec_suffix (struct type *type,
int demangled_args, int demangled_args,
const struct type_print_options *flags) const const struct type_print_options *flags) const
{ {
if (TYPE_TARGET_TYPE (type) == NULL if (type->target_type () == NULL
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) || type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_printf (stream, " : "); gdb_printf (stream, " : ");
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), type_print_varspec_prefix (type->target_type (),
stream, 0, 0, flags); stream, 0, 0, flags);
if (TYPE_TARGET_TYPE (type) == NULL) if (type->target_type () == NULL)
type_print_unknown_return_type (stream); type_print_unknown_return_type (stream);
else else
type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0, type_print_base (type->target_type (), stream, show, 0,
flags); flags);
type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, type_print_varspec_suffix (type->target_type (), stream, 0,
passed_a_ptr, 0, flags); passed_a_ptr, 0, flags);
} }
} }
@ -365,7 +365,7 @@ pascal_language::type_print_varspec_suffix (struct type *type,
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_REF: case TYPE_CODE_REF:
type_print_varspec_suffix (TYPE_TARGET_TYPE (type), type_print_varspec_suffix (type->target_type (),
stream, 0, 1, 0, flags); stream, 0, 1, 0, flags);
break; break;
@ -428,7 +428,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
/* void pointer */ /* void pointer */
if ((type->code () == TYPE_CODE_PTR) if ((type->code () == TYPE_CODE_PTR)
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)) && (type->target_type ()->code () == TYPE_CODE_VOID))
{ {
gdb_puts (type->name () ? type->name () : "pointer", gdb_puts (type->name () ? type->name () : "pointer",
stream); stream);
@ -451,12 +451,12 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_REF: case TYPE_CODE_REF:
type_print_base (TYPE_TARGET_TYPE (type), stream, show, level, type_print_base (type->target_type (), stream, show, level,
flags); flags);
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0, flags); print_type (type->target_type (), NULL, stream, 0, 0, flags);
break; break;
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
@ -636,7 +636,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
print_spaces (level + 4, stream); print_spaces (level + 4, stream);
if (TYPE_FN_FIELD_STATIC_P (f, j)) if (TYPE_FN_FIELD_STATIC_P (f, j))
gdb_printf (stream, "static "); gdb_printf (stream, "static ");
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0) if (TYPE_FN_FIELD_TYPE (f, j)->target_type () == 0)
{ {
/* Keep GDB from crashing here. */ /* Keep GDB from crashing here. */
gdb_printf (stream, "<undefined type> %s;\n", gdb_printf (stream, "<undefined type> %s;\n",
@ -652,8 +652,9 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
{ {
gdb_printf (stream, "destructor "); gdb_printf (stream, "destructor ");
} }
else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 else if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
&& TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID) && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
!= TYPE_CODE_VOID))
{ {
gdb_printf (stream, "function "); gdb_printf (stream, "function ");
} }
@ -665,11 +666,12 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
type_print_method_args (physname, method_name, stream); type_print_method_args (physname, method_name, stream);
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
&& TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID) && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
!= TYPE_CODE_VOID))
{ {
gdb_puts (" : ", stream); gdb_puts (" : ", stream);
type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), type_print (TYPE_FN_FIELD_TYPE (f, j)->target_type (),
"", stream, -1); "", stream, -1);
} }
if (TYPE_FN_FIELD_VIRTUAL_P (f, j)) if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
@ -739,7 +741,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
/* this probably does not work for enums. */ /* this probably does not work for enums. */
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
{ {
struct type *target = TYPE_TARGET_TYPE (type); struct type *target = type->target_type ();
print_type_scalar (target, type->bounds ()->low.const_val (), stream); print_type_scalar (target, type->bounds ()->low.const_val (), stream);
gdb_puts ("..", stream); gdb_puts ("..", stream);

View File

@ -91,7 +91,7 @@ pascal_language::value_print_inner (struct value *val,
if (get_array_bounds (type, &low_bound, &high_bound)) if (get_array_bounds (type, &low_bound, &high_bound))
{ {
len = high_bound - low_bound + 1; len = high_bound - low_bound + 1;
elttype = check_typedef (TYPE_TARGET_TYPE (type)); elttype = check_typedef (type->target_type ());
eltlen = TYPE_LENGTH (elttype); eltlen = TYPE_LENGTH (elttype);
/* If 's' format is used, try to print out as string. /* If 's' format is used, try to print out as string.
If no format is given, print as string if element type If no format is given, print as string if element type
@ -116,7 +116,7 @@ pascal_language::value_print_inner (struct value *val,
len = temp_len; len = temp_len;
} }
printstr (stream, TYPE_TARGET_TYPE (type), valaddr, len, printstr (stream, type->target_type (), valaddr, len,
NULL, 0, options); NULL, 0, options);
i = len; i = len;
} }
@ -161,11 +161,11 @@ pascal_language::value_print_inner (struct value *val,
print_address_demangle (options, gdbarch, addr, stream, demangle); print_address_demangle (options, gdbarch, addr, stream, demangle);
break; break;
} }
check_typedef (TYPE_TARGET_TYPE (type)); check_typedef (type->target_type ());
addr = unpack_pointer (type, valaddr); addr = unpack_pointer (type, valaddr);
print_unpacked_pointer: print_unpacked_pointer:
elttype = check_typedef (TYPE_TARGET_TYPE (type)); elttype = check_typedef (type->target_type ());
if (elttype->code () == TYPE_CODE_FUNC) if (elttype->code () == TYPE_CODE_FUNC)
{ {
@ -259,7 +259,7 @@ pascal_language::value_print_inner (struct value *val,
} }
else else
{ {
wtype = TYPE_TARGET_TYPE (type); wtype = type->target_type ();
} }
vt_val = value_at (wtype, vt_address); vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, recurse + 1, options, common_val_print (vt_val, stream, recurse + 1, options,
@ -423,8 +423,8 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
type is indicated by the quoted string anyway. */ type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR if (type->code () == TYPE_CODE_PTR
&& type->name () == NULL && type->name () == NULL
&& TYPE_TARGET_TYPE (type)->name () != NULL && type->target_type ()->name () != NULL
&& strcmp (TYPE_TARGET_TYPE (type)->name (), "char") == 0) && strcmp (type->target_type ()->name (), "char") == 0)
{ {
/* Print nothing. */ /* Print nothing. */
} }
@ -482,10 +482,10 @@ pascal_object_is_vtbl_member (struct type *type)
{ {
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_STRUCT /* If not using if (type->code () == TYPE_CODE_STRUCT /* If not using
thunks. */ thunks. */
|| type->code () == TYPE_CODE_PTR) /* If using thunks. */ || type->code () == TYPE_CODE_PTR) /* If using thunks. */

View File

@ -41,7 +41,7 @@ ppc_sysv_use_opencl_abi (struct type *ftype)
ftype = check_typedef (ftype); ftype = check_typedef (ftype);
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); ftype = check_typedef (ftype->target_type ());
return (ftype->code () == TYPE_CODE_FUNC return (ftype->code () == TYPE_CODE_FUNC
&& TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL); && TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL);
@ -340,7 +340,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* OpenCL vectors shorter than 16 bytes are passed as if /* OpenCL vectors shorter than 16 bytes are passed as if
a series of independent scalars. */ a series of independent scalars. */
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype); int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
for (i = 0; i < nelt; i++) for (i = 0; i < nelt; i++)
@ -813,7 +813,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
&& TYPE_LENGTH (type) < 16 && TYPE_LENGTH (type) < 16
&& opencl_abi) && opencl_abi)
{ {
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype); int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
for (i = 0; i < nelt; i++) for (i = 0; i < nelt; i++)
@ -1093,7 +1093,7 @@ ppc64_aggregate_candidate (struct type *type,
break; break;
case TYPE_CODE_COMPLEX: case TYPE_CODE_COMPLEX:
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
if (type->code () == TYPE_CODE_FLT if (type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT) || type->code () == TYPE_CODE_DECFLOAT)
{ {
@ -1119,7 +1119,7 @@ ppc64_aggregate_candidate (struct type *type,
LONGEST count, low_bound, high_bound; LONGEST count, low_bound, high_bound;
count = ppc64_aggregate_candidate count = ppc64_aggregate_candidate
(TYPE_TARGET_TYPE (type), field_type); (type->target_type (), field_type);
if (count == -1) if (count == -1)
return -1; return -1;
@ -1497,7 +1497,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
|| type->code () == TYPE_CODE_REF)) || type->code () == TYPE_CODE_REF))
{ {
struct type *target_type struct type *target_type
= check_typedef (TYPE_TARGET_TYPE (type)); = check_typedef (type->target_type ());
if (target_type->code () == TYPE_CODE_FUNC if (target_type->code () == TYPE_CODE_FUNC
|| target_type->code () == TYPE_CODE_METHOD) || target_type->code () == TYPE_CODE_METHOD)
@ -1695,7 +1695,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
if (type->code () == TYPE_CODE_COMPLEX) if (type->code () == TYPE_CODE_COMPLEX)
{ {
/* Complex types are passed as if two independent scalars. */ /* Complex types are passed as if two independent scalars. */
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos); ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos);
ppc64_sysv_abi_push_param (gdbarch, eltype, ppc64_sysv_abi_push_param (gdbarch, eltype,
@ -1711,7 +1711,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
int i, nelt; int i, nelt;
if (TYPE_LENGTH (type) < 16) if (TYPE_LENGTH (type) < 16)
eltype = check_typedef (TYPE_TARGET_TYPE (type)); eltype = check_typedef (type->target_type ());
else else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum); eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
@ -1999,7 +1999,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
/* Complex types are returned as if two independent scalars. */ /* Complex types are returned as if two independent scalars. */
if (valtype->code () == TYPE_CODE_COMPLEX) if (valtype->code () == TYPE_CODE_COMPLEX)
{ {
eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); eltype = check_typedef (valtype->target_type ());
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -2022,7 +2022,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
&& opencl_abi) && opencl_abi)
{ {
if (TYPE_LENGTH (valtype) < 16) if (TYPE_LENGTH (valtype) < 16)
eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); eltype = check_typedef (valtype->target_type ());
else else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum); eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
@ -2057,8 +2057,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
if (valtype->code () == TYPE_CODE_ARRAY if (valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector () && !valtype->is_vector ()
&& TYPE_LENGTH (valtype) <= 8 && TYPE_LENGTH (valtype) <= 8
&& TYPE_TARGET_TYPE (valtype)->code () == TYPE_CODE_INT && valtype->target_type ()->code () == TYPE_CODE_INT
&& TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) && TYPE_LENGTH (valtype->target_type ()) == 1)
{ {
int regnum = tdep->ppc_gp0_regnum + 3; int regnum = tdep->ppc_gp0_regnum + 3;
int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype)); int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));

View File

@ -254,7 +254,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (function != nullptr) if (function != nullptr)
{ {
struct type *ret_type = struct type *ret_type =
check_typedef (TYPE_TARGET_TYPE (function->type ())); check_typedef (function->type ()->target_type ());
/* Remember only non-void return types. */ /* Remember only non-void return types. */
if (ret_type->code () != TYPE_CODE_VOID) if (ret_type->code () != TYPE_CODE_VOID)

View File

@ -130,7 +130,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
/* PR 20786: There's no way to specify an array of length zero. /* PR 20786: There's no way to specify an array of length zero.
Record a length of [0,-1] which is how Ada does it. Anything Record a length of [0,-1] which is how Ada does it. Anything
we do is broken, but this is one possible solution. */ we do is broken, but this is one possible solution. */
type = lookup_array_range_type (TYPE_TARGET_TYPE (realtype), type = lookup_array_range_type (realtype->target_type (),
0, self_string->length - 1); 0, self_string->length - 1);
val = value_at_lazy (type, self_string->address); val = value_at_lazy (type, self_string->address);
} }
@ -262,7 +262,7 @@ stpy_lazy_string_elt_type (lazy_string_object *lazy)
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
return TYPE_TARGET_TYPE (realtype); return realtype->target_type ();
default: default:
/* This is done to preserve existing behaviour. PR 20769. /* This is done to preserve existing behaviour. PR 20769.
E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */ E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */

View File

@ -503,7 +503,7 @@ typy_get_composite (struct type *type)
if (!type->is_pointer_or_reference ()) if (!type->is_pointer_or_reference ())
break; break;
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
} }
/* If this is not a struct, union, or enum type, raise TypeError /* If this is not a struct, union, or enum type, raise TypeError
@ -686,14 +686,14 @@ typy_target (PyObject *self, PyObject *args)
{ {
struct type *type = ((type_object *) self)->type; struct type *type = ((type_object *) self)->type;
if (!TYPE_TARGET_TYPE (type)) if (!type->target_type ())
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Type does not have a target.")); _("Type does not have a target."));
return NULL; return NULL;
} }
return type_to_type_object (TYPE_TARGET_TYPE (type)); return type_to_type_object (type->target_type ());
} }
/* Return a const-qualified type variant. */ /* Return a const-qualified type variant. */
@ -1007,7 +1007,7 @@ typy_template_argument (PyObject *self, PyObject *args)
{ {
type = check_typedef (type); type = check_typedef (type);
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
{ {

View File

@ -422,7 +422,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
type = check_typedef (type); type = check_typedef (type);
if (type->is_pointer_or_reference () if (type->is_pointer_or_reference ()
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{ {
struct value *target; struct value *target;
int was_pointer = type->code () == TYPE_CODE_PTR; int was_pointer = type->code () == TYPE_CODE_PTR;
@ -525,7 +525,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
length = array_length; length = array_length;
else if (array_length == -1) else if (array_length == -1)
{ {
type = lookup_array_range_type (TYPE_TARGET_TYPE (realtype), type = lookup_array_range_type (realtype->target_type (),
0, length - 1); 0, length - 1);
} }
else if (length != array_length) else if (length != array_length)
@ -534,7 +534,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
specified length. */ specified length. */
if (length > array_length) if (length > array_length)
error (_("Length is larger than array size.")); error (_("Length is larger than array size."));
type = lookup_array_range_type (TYPE_TARGET_TYPE (realtype), type = lookup_array_range_type (realtype->target_type (),
low_bound, low_bound,
low_bound + length - 1); low_bound + length - 1);
} }
@ -886,7 +886,7 @@ value_has_field (struct value *v, PyObject *field)
val_type = value_type (v); val_type = value_type (v);
val_type = check_typedef (val_type); val_type = check_typedef (val_type);
if (val_type->is_pointer_or_reference ()) if (val_type->is_pointer_or_reference ())
val_type = check_typedef (TYPE_TARGET_TYPE (val_type)); val_type = check_typedef (val_type->target_type ());
type_code = val_type->code (); type_code = val_type->code ();
if ((type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION) if ((type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION)
@ -1274,7 +1274,7 @@ enum valpy_opcode
/* If TYPE is a reference, return the target; otherwise return TYPE. */ /* If TYPE is a reference, return the target; otherwise return TYPE. */
#define STRIP_REFERENCE(TYPE) \ #define STRIP_REFERENCE(TYPE) \
(TYPE_IS_REFERENCE (TYPE) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE)) (TYPE_IS_REFERENCE (TYPE) ? ((TYPE)->target_type ()) : (TYPE))
/* Helper for valpy_binop. Returns a value object which is the result /* Helper for valpy_binop. Returns a value object which is the result
of applying the operation specified by OPCODE to the given of applying the operation specified by OPCODE to the given

View File

@ -3049,7 +3049,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); ftype = check_typedef (ftype->target_type ());
/* We'll use register $a0 if we're returning a struct. */ /* We'll use register $a0 if we're returning a struct. */
if (return_method == return_method_struct) if (return_method == return_method_struct)

View File

@ -1049,9 +1049,9 @@ rl78_pointer_to_address (struct gdbarch *gdbarch,
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
/* Is it a code address? */ /* Is it a code address? */
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC if (type->target_type ()->code () == TYPE_CODE_FUNC
|| TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD || type->target_type ()->code () == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)) || TYPE_CODE_SPACE (type->target_type ())
|| TYPE_LENGTH (type) == 4) || TYPE_LENGTH (type) == 4)
return rl78_make_instruction_address (addr); return rl78_make_instruction_address (addr);
else else

View File

@ -331,7 +331,7 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
if (strcmp (type->name (), "&str") == 0) if (strcmp (type->name (), "&str") == 0)
val_print_string (TYPE_TARGET_TYPE (value_type (base)), "UTF-8", val_print_string (value_type (base)->target_type (), "UTF-8",
value_as_address (base), value_as_long (len), stream, value_as_address (base), value_as_long (len), stream,
options); options);
else else
@ -345,7 +345,7 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
gdb_printf (stream, "[]"); gdb_printf (stream, "[]");
else else
{ {
struct type *elt_type = TYPE_TARGET_TYPE (value_type (base)); struct type *elt_type = value_type (base)->target_type ();
struct type *array_type = lookup_array_range_type (elt_type, 0, struct type *array_type = lookup_array_range_type (elt_type, 0,
llen - 1); llen - 1);
struct value *array = allocate_value_lazy (array_type); struct value *array = allocate_value_lazy (array_type);
@ -536,14 +536,14 @@ rust_language::value_print_inner
{ {
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY if (type->target_type ()->code () == TYPE_CODE_ARRAY
&& rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type))) && rust_u8_type_p (type->target_type ()->target_type ())
&& get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound, && get_array_bounds (type->target_type (), &low_bound,
&high_bound)) &high_bound))
{ {
/* We have a pointer to a byte string, so just print /* We have a pointer to a byte string, so just print
that. */ that. */
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
CORE_ADDR addr = value_as_address (val); CORE_ADDR addr = value_as_address (val);
struct gdbarch *arch = type->arch (); struct gdbarch *arch = type->arch ();
@ -554,7 +554,7 @@ rust_language::value_print_inner
} }
gdb_puts ("b", stream); gdb_puts ("b", stream);
val_print_string (TYPE_TARGET_TYPE (elttype), "ASCII", addr, val_print_string (elttype->target_type (), "ASCII", addr,
high_bound - low_bound + 1, stream, high_bound - low_bound + 1, stream,
&opts); &opts);
break; break;
@ -583,7 +583,7 @@ rust_language::value_print_inner
byte string, hence the choice of "ASCII" as the byte string, hence the choice of "ASCII" as the
encoding. */ encoding. */
gdb_puts ("b", stream); gdb_puts ("b", stream);
printstr (stream, TYPE_TARGET_TYPE (type), printstr (stream, type->target_type (),
value_contents_for_printing (val).data (), value_contents_for_printing (val).data (),
high_bound - low_bound + 1, "ASCII", 0, &opts); high_bound - low_bound + 1, "ASCII", 0, &opts);
} }
@ -839,10 +839,10 @@ rust_internal_print_type (struct type *type, const char *varstring,
} }
gdb_puts (")", stream); gdb_puts (")", stream);
/* If it returns unit, we can omit the return type. */ /* If it returns unit, we can omit the return type. */
if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID) if (type->target_type ()->code () != TYPE_CODE_VOID)
{ {
gdb_puts (" -> ", stream); gdb_puts (" -> ", stream);
rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream, rust_internal_print_type (type->target_type (), "", stream,
-1, 0, flags, false, podata); -1, 0, flags, false, podata);
} }
break; break;
@ -852,7 +852,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
gdb_puts ("[", stream); gdb_puts ("[", stream);
rust_internal_print_type (TYPE_TARGET_TYPE (type), NULL, rust_internal_print_type (type->target_type (), NULL,
stream, show - 1, level, flags, false, stream, show - 1, level, flags, false,
podata); podata);
@ -915,7 +915,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
/* We currently can't distinguish between pointers and /* We currently can't distinguish between pointers and
references. */ references. */
gdb_puts ("*mut ", stream); gdb_puts ("*mut ", stream);
type_print (TYPE_TARGET_TYPE (type), "", stream, 0); type_print (type->target_type (), "", stream, 0);
} }
} }
break; break;
@ -1168,14 +1168,14 @@ rust_subscript (struct type *expect_type, struct expression *exp,
{ {
struct type *base_type = nullptr; struct type *base_type = nullptr;
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
base_type = TYPE_TARGET_TYPE (type); base_type = type->target_type ();
else if (rust_slice_type_p (type)) else if (rust_slice_type_p (type))
{ {
for (int i = 0; i < type->num_fields (); ++i) for (int i = 0; i < type->num_fields (); ++i)
{ {
if (strcmp (type->field (i).name (), "data_ptr") == 0) if (strcmp (type->field (i).name (), "data_ptr") == 0)
{ {
base_type = TYPE_TARGET_TYPE (type->field (i).type ()); base_type = type->field (i).type ()->target_type ();
break; break;
} }
} }
@ -1183,7 +1183,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
error (_("Could not find 'data_ptr' in slice type")); error (_("Could not find 'data_ptr' in slice type"));
} }
else if (type->code () == TYPE_CODE_PTR) else if (type->code () == TYPE_CODE_PTR)
base_type = TYPE_TARGET_TYPE (type); base_type = type->target_type ();
else else
error (_("Cannot subscript non-array type")); error (_("Cannot subscript non-array type"));
@ -1571,7 +1571,7 @@ rust_structop::evaluate_funcall (struct type *expect_type,
args[i + 1] = ops[i]->evaluate (nullptr, exp, noside); args[i + 1] = ops[i]->evaluate (nullptr, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (TYPE_TARGET_TYPE (fn_type), not_lval); return value_zero (fn_type->target_type (), not_lval);
return call_function_by_hand (function, NULL, args); return call_function_by_hand (function, NULL, args);
} }
@ -1672,9 +1672,9 @@ rust_language::is_string_type_p (struct type *type) const
type = check_typedef (type); type = check_typedef (type);
return ((type->code () == TYPE_CODE_STRING) return ((type->code () == TYPE_CODE_STRING)
|| (type->code () == TYPE_CODE_PTR || (type->code () == TYPE_CODE_PTR
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY && (type->target_type ()->code () == TYPE_CODE_ARRAY
&& rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type))) && rust_u8_type_p (type->target_type ()->target_type ())
&& get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound, && get_array_bounds (type->target_type (), &low_bound,
&high_bound))) &high_bound)))
|| (type->code () == TYPE_CODE_STRUCT || (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type) && !rust_enum_p (type)

View File

@ -116,7 +116,7 @@ public:
gdb::unique_xmalloc_ptr<char> watch_location_expression gdb::unique_xmalloc_ptr<char> watch_location_expression
(struct type *type, CORE_ADDR addr) const override (struct type *type, CORE_ADDR addr) const override
{ {
type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type); std::string name = type_to_string (type);
return xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr), return xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr),
name.c_str ()); name.c_str ());

View File

@ -672,7 +672,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Dereference function pointer types. */ /* Dereference function pointer types. */
while (func_type->code () == TYPE_CODE_PTR) while (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type); func_type = func_type->target_type ();
/* The end result had better be a function or a method. */ /* The end result had better be a function or a method. */
gdb_assert (func_type->code () == TYPE_CODE_FUNC gdb_assert (func_type->code () == TYPE_CODE_FUNC
@ -707,7 +707,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (return_method == return_method_struct) if (return_method == return_method_struct)
{ {
struct type *return_type = TYPE_TARGET_TYPE (func_type); struct type *return_type = func_type->target_type ();
gdb_assert (return_type->code () == TYPE_CODE_STRUCT gdb_assert (return_type->code () == TYPE_CODE_STRUCT
|| func_type->code () == TYPE_CODE_UNION); || func_type->code () == TYPE_CODE_UNION);

View File

@ -1914,7 +1914,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); ftype = check_typedef (ftype->target_type ());
arg_prep.copy = sp; arg_prep.copy = sp;
arg_prep.gr = (return_method == return_method_struct) ? 3 : 2; arg_prep.gr = (return_method == return_method_struct) ? 3 : 2;

View File

@ -93,7 +93,7 @@ sh_is_renesas_calling_convention (struct type *func_type)
func_type = check_typedef (func_type); func_type = check_typedef (func_type);
if (func_type->code () == TYPE_CODE_PTR) if (func_type->code () == TYPE_CODE_PTR)
func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); func_type = check_typedef (func_type->target_type ());
if (func_type->code () == TYPE_CODE_FUNC if (func_type->code () == TYPE_CODE_FUNC
&& TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh) && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)

View File

@ -302,7 +302,7 @@ sparc_structure_return_p (const struct type *type)
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{ {
/* Float vectors are always returned by memory. */ /* Float vectors are always returned by memory. */
if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) if (sparc_floating_p (check_typedef (type->target_type ())))
return true; return true;
/* Integer vectors are returned by memory if the vector size /* Integer vectors are returned by memory if the vector size
is greater than 8 bytes long. */ is greater than 8 bytes long. */
@ -330,7 +330,7 @@ sparc_arg_by_memory_p (const struct type *type)
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{ {
/* Float vectors are always passed by memory. */ /* Float vectors are always passed by memory. */
if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) if (sparc_floating_p (check_typedef (type->target_type ())))
return true; return true;
/* Integer vectors are passed by memory if the vector size /* Integer vectors are passed by memory if the vector size
is greater than 8 bytes long. */ is greater than 8 bytes long. */
@ -1234,7 +1234,7 @@ sparc32_struct_return_from_sym (struct symbol *sym)
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
{ {
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
if (sparc_structure_or_union_p (type) if (sparc_structure_or_union_p (type)
|| (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)) || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
return 1; return 1;

View File

@ -1175,7 +1175,7 @@ sparc64_16_byte_align_p (struct type *type)
{ {
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
struct type *t = check_typedef (TYPE_TARGET_TYPE (type)); struct type *t = check_typedef (type->target_type ());
if (sparc64_floating_p (t)) if (sparc64_floating_p (t))
return 1; return 1;

View File

@ -2747,7 +2747,7 @@ return_command (const char *retval_exp, int from_tty)
/* Cast return value to the return type of the function. Should /* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */ the cast fail, this call throws an error. */
if (thisfun != NULL) if (thisfun != NULL)
return_type = TYPE_TARGET_TYPE (thisfun->type ()); return_type = thisfun->type ()->target_type ();
if (return_type == NULL) if (return_type == NULL)
{ {
if (retval_expr->first_opcode () != UNOP_CAST if (retval_expr->first_opcode () != UNOP_CAST

View File

@ -2145,7 +2145,7 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
be typedefed; just be safe. */ be typedefed; just be safe. */
t = check_typedef (t); t = check_typedef (t);
if (t->is_pointer_or_reference ()) if (t->is_pointer_or_reference ())
t = TYPE_TARGET_TYPE (t); t = t->target_type ();
if (t->code () != TYPE_CODE_STRUCT if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION) && t->code () != TYPE_CODE_UNION)

View File

@ -885,7 +885,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Determine the type of this function. */ /* Determine the type of this function. */
func_type = check_typedef (func_type); func_type = check_typedef (func_type);
if (func_type->code () == TYPE_CODE_PTR) if (func_type->code () == TYPE_CODE_PTR)
func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); func_type = check_typedef (func_type->target_type ());
gdb_assert (func_type->code () == TYPE_CODE_FUNC gdb_assert (func_type->code () == TYPE_CODE_FUNC
|| func_type->code () == TYPE_CODE_METHOD); || func_type->code () == TYPE_CODE_METHOD);

View File

@ -528,7 +528,7 @@ whatis_exp (const char *exp, int show)
because we do not want to dig past all typedefs. */ because we do not want to dig past all typedefs. */
check_typedef (type); check_typedef (type);
if (type->code () == TYPE_CODE_TYPEDEF) if (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
/* If the expression is actually a type, then there's no /* If the expression is actually a type, then there's no
value to fetch the dynamic type from. */ value to fetch the dynamic type from. */
@ -545,7 +545,7 @@ whatis_exp (const char *exp, int show)
if (val != NULL && opts.objectprint) if (val != NULL && opts.objectprint)
{ {
if (type->is_pointer_or_reference () if (type->is_pointer_or_reference ()
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) && (type->target_type ()->code () == TYPE_CODE_STRUCT))
real_type = value_rtti_indirect_type (val, &full, &top, &using_enc); real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
else if (type->code () == TYPE_CODE_STRUCT) else if (type->code () == TYPE_CODE_STRUCT)
real_type = value_rtti_type (val, &full, &top, &using_enc); real_type = value_rtti_type (val, &full, &top, &using_enc);
@ -654,7 +654,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break; break;
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
print_type_scalar (TYPE_TARGET_TYPE (type), val, stream); print_type_scalar (type->target_type (), val, stream);
return; return;
case TYPE_CODE_FIXED_POINT: case TYPE_CODE_FIXED_POINT:

View File

@ -542,7 +542,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
if (fld_type->code () == TYPE_CODE_ARRAY) if (fld_type->code () == TYPE_CODE_ARRAY)
{ {
tgt_type = TYPE_TARGET_TYPE (fld_type); tgt_type = fld_type->target_type ();
if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4) if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4)
return 0; return 0;
} }
@ -560,7 +560,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
fld_type = type->field (0).type (); fld_type = type->field (0).type ();
if (fld_type->code () == TYPE_CODE_ARRAY) if (fld_type->code () == TYPE_CODE_ARRAY)
{ {
tgt_type = TYPE_TARGET_TYPE (fld_type); tgt_type = fld_type->target_type ();
if (TYPE_LENGTH (tgt_type) > 0 if (TYPE_LENGTH (tgt_type) > 0
&& TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2) && TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
return 1; return 1;

View File

@ -54,7 +54,7 @@ find_size_for_pointer_math (struct type *ptr_type)
struct type *ptr_target; struct type *ptr_target;
gdb_assert (ptr_type->code () == TYPE_CODE_PTR); gdb_assert (ptr_type->code () == TYPE_CODE_PTR);
ptr_target = check_typedef (TYPE_TARGET_TYPE (ptr_type)); ptr_target = check_typedef (ptr_type->target_type ());
sz = type_length_units (ptr_target); sz = type_length_units (ptr_target);
if (sz == 0) if (sz == 0)
@ -115,13 +115,13 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
gdb_assert (type1->code () == TYPE_CODE_PTR); gdb_assert (type1->code () == TYPE_CODE_PTR);
gdb_assert (type2->code () == TYPE_CODE_PTR); gdb_assert (type2->code () == TYPE_CODE_PTR);
if (TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1))) if (TYPE_LENGTH (check_typedef (type1->target_type ()))
!= TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2)))) != TYPE_LENGTH (check_typedef (type2->target_type ())))
error (_("First argument of `-' is a pointer and " error (_("First argument of `-' is a pointer and "
"second argument is neither\n" "second argument is neither\n"
"an integer nor a pointer of the same type.")); "an integer nor a pointer of the same type."));
sz = type_length_units (check_typedef (TYPE_TARGET_TYPE (type1))); sz = type_length_units (check_typedef (type1->target_type ()));
if (sz == 0) if (sz == 0)
{ {
warning (_("Type size unknown, assuming 1. " warning (_("Type size unknown, assuming 1. "
@ -200,7 +200,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index,
LONGEST lowerbound) LONGEST lowerbound)
{ {
struct type *array_type = check_typedef (value_type (array)); struct type *array_type = check_typedef (value_type (array));
struct type *elt_type = TYPE_TARGET_TYPE (array_type); struct type *elt_type = array_type->target_type ();
LONGEST elt_size = type_length_units (elt_type); LONGEST elt_size = type_length_units (elt_type);
/* Fetch the bit stride and convert it to a byte stride, assuming 8 bits /* Fetch the bit stride and convert it to a byte stride, assuming 8 bits
@ -257,11 +257,11 @@ binop_types_user_defined_p (enum exp_opcode op,
type1 = check_typedef (type1); type1 = check_typedef (type1);
if (TYPE_IS_REFERENCE (type1)) if (TYPE_IS_REFERENCE (type1))
type1 = check_typedef (TYPE_TARGET_TYPE (type1)); type1 = check_typedef (type1->target_type ());
type2 = check_typedef (type2); type2 = check_typedef (type2);
if (TYPE_IS_REFERENCE (type2)) if (TYPE_IS_REFERENCE (type2))
type2 = check_typedef (TYPE_TARGET_TYPE (type2)); type2 = check_typedef (type2->target_type ());
return (type1->code () == TYPE_CODE_STRUCT return (type1->code () == TYPE_CODE_STRUCT
|| type2->code () == TYPE_CODE_STRUCT); || type2->code () == TYPE_CODE_STRUCT);
@ -295,7 +295,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
return 0; return 0;
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (value_type (arg1));
if (TYPE_IS_REFERENCE (type1)) if (TYPE_IS_REFERENCE (type1))
type1 = check_typedef (TYPE_TARGET_TYPE (type1)); type1 = check_typedef (type1->target_type ());
return type1->code () == TYPE_CODE_STRUCT; return type1->code () == TYPE_CODE_STRUCT;
} }
@ -525,8 +525,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
{ {
struct type *return_type; struct type *return_type;
return_type return_type = check_typedef (value_type (argvec[0]))->target_type ();
= TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
return value_zero (return_type, VALUE_LVAL (arg1)); return value_zero (return_type, VALUE_LVAL (arg1));
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
@ -639,8 +638,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
{ {
struct type *return_type; struct type *return_type;
return_type return_type = check_typedef (value_type (argvec[0]))->target_type ();
= TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
return value_zero (return_type, VALUE_LVAL (arg1)); return value_zero (return_type, VALUE_LVAL (arg1));
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
@ -668,7 +666,7 @@ value_concat (struct value *arg1, struct value *arg2)
struct type *elttype1 = type1; struct type *elttype1 = type1;
if (elttype1->code () == TYPE_CODE_ARRAY) if (elttype1->code () == TYPE_CODE_ARRAY)
{ {
elttype1 = TYPE_TARGET_TYPE (elttype1); elttype1 = elttype1->target_type ();
if (!get_array_bounds (type1, &low1, &high1)) if (!get_array_bounds (type1, &low1, &high1))
error (_("could not determine array bounds on left-hand-side of " error (_("could not determine array bounds on left-hand-side of "
"array concatenation")); "array concatenation"));
@ -683,7 +681,7 @@ value_concat (struct value *arg1, struct value *arg2)
struct type *elttype2 = type2; struct type *elttype2 = type2;
if (elttype2->code () == TYPE_CODE_ARRAY) if (elttype2->code () == TYPE_CODE_ARRAY)
{ {
elttype2 = TYPE_TARGET_TYPE (elttype2); elttype2 = elttype2->target_type ();
if (!get_array_bounds (type2, &low2, &high2)) if (!get_array_bounds (type2, &low2, &high2))
error (_("could not determine array bounds on right-hand-side of " error (_("could not determine array bounds on right-hand-side of "
"array concatenation")); "array concatenation"));
@ -1557,7 +1555,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
if (!get_array_bounds (vector_type, &low_bound, &high_bound)) if (!get_array_bounds (vector_type, &low_bound, &high_bound))
error (_("Could not determine the vector bounds")); error (_("Could not determine the vector bounds"));
eltype = check_typedef (TYPE_TARGET_TYPE (vector_type)); eltype = check_typedef (vector_type->target_type ());
elval = value_cast (eltype, scalar_value); elval = value_cast (eltype, scalar_value);
scalar_type = check_typedef (value_type (scalar_value)); scalar_type = check_typedef (value_type (scalar_value));
@ -1605,8 +1603,8 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
|| !get_array_bounds (type2, &low_bound2, &high_bound2)) || !get_array_bounds (type2, &low_bound2, &high_bound2))
error (_("Could not determine the vector bounds")); error (_("Could not determine the vector bounds"));
eltype1 = check_typedef (TYPE_TARGET_TYPE (type1)); eltype1 = check_typedef (type1->target_type ());
eltype2 = check_typedef (TYPE_TARGET_TYPE (type2)); eltype2 = check_typedef (type2->target_type ());
elsize = TYPE_LENGTH (eltype1); elsize = TYPE_LENGTH (eltype1);
if (eltype1->code () != eltype2->code () if (eltype1->code () != eltype2->code ()
@ -1905,7 +1903,7 @@ value_neg (struct value *arg1)
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{ {
struct value *val = allocate_value (type); struct value *val = allocate_value (type);
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
int i; int i;
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
@ -1949,7 +1947,7 @@ value_complement (struct value *arg1)
val = value_from_longest (type, ~value_as_long (arg1)); val = value_from_longest (type, ~value_as_long (arg1));
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{ {
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *eltype = check_typedef (type->target_type ());
int i; int i;
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
@ -2017,7 +2015,7 @@ value_in (struct value *element, struct value *set)
struct type *eltype = check_typedef (value_type (element)); struct type *eltype = check_typedef (value_type (element));
if (eltype->code () == TYPE_CODE_RANGE) if (eltype->code () == TYPE_CODE_RANGE)
eltype = TYPE_TARGET_TYPE (eltype); eltype = eltype->target_type ();
if (settype->code () != TYPE_CODE_SET) if (settype->code () != TYPE_CODE_SET)
error (_("Second argument of 'IN' has wrong type")); error (_("Second argument of 'IN' has wrong type"));
if (eltype->code () != TYPE_CODE_INT if (eltype->code () != TYPE_CODE_INT

View File

@ -297,8 +297,8 @@ value_cast_pointers (struct type *type, struct value *arg2,
{ {
struct type *type1 = check_typedef (type); struct type *type1 = check_typedef (type);
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (value_type (arg2));
struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1)); struct type *t1 = check_typedef (type1->target_type ());
struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2)); struct type *t2 = check_typedef (type2->target_type ());
if (t1->code () == TYPE_CODE_STRUCT if (t1->code () == TYPE_CODE_STRUCT
&& t2->code () == TYPE_CODE_STRUCT && t2->code () == TYPE_CODE_STRUCT
@ -443,7 +443,7 @@ value_cast (struct type *type, struct value *arg2)
we generate value of the given reference. Nothing wrong with we generate value of the given reference. Nothing wrong with
that. */ that. */
struct type *t1 = check_typedef (type); struct type *t1 = check_typedef (type);
struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1)); struct type *dereftype = check_typedef (t1->target_type ());
struct value *val = value_cast (dereftype, arg2); struct value *val = value_cast (dereftype, arg2);
return value_ref (val, t1->code ()); return value_ref (val, t1->code ());
@ -472,7 +472,7 @@ value_cast (struct type *type, struct value *arg2)
where N is sizeof(OBJECT)/sizeof(TYPE). */ where N is sizeof(OBJECT)/sizeof(TYPE). */
if (code1 == TYPE_CODE_ARRAY) if (code1 == TYPE_CODE_ARRAY)
{ {
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = type->target_type ();
unsigned element_length = TYPE_LENGTH (check_typedef (element_type)); unsigned element_length = TYPE_LENGTH (check_typedef (element_type));
if (element_length > 0 && type->bounds ()->high.kind () == PROP_UNDEFINED) if (element_length > 0 && type->bounds ()->high.kind () == PROP_UNDEFINED)
@ -490,7 +490,7 @@ value_cast (struct type *type, struct value *arg2)
/* FIXME-type-allocation: need a way to free this type when /* FIXME-type-allocation: need a way to free this type when
we are done with it. */ we are done with it. */
range_type = create_static_range_type (NULL, range_type = create_static_range_type (NULL,
TYPE_TARGET_TYPE (range_type), range_type->target_type (),
low_bound, low_bound,
new_length + low_bound - 1); new_length + low_bound - 1);
deprecated_set_value_type (arg2, deprecated_set_value_type (arg2,
@ -686,7 +686,7 @@ value_reinterpret_cast (struct type *type, struct value *arg)
{ {
is_ref = 1; is_ref = 1;
arg = value_addr (arg); arg = value_addr (arg);
dest_type = lookup_pointer_type (TYPE_TARGET_TYPE (dest_type)); dest_type = lookup_pointer_type (dest_type->target_type ());
real_type = lookup_pointer_type (real_type); real_type = lookup_pointer_type (real_type);
} }
@ -827,11 +827,11 @@ value_dynamic_cast (struct type *type, struct value *arg)
if (resolved_type->code () != TYPE_CODE_PTR if (resolved_type->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (resolved_type)) && !TYPE_IS_REFERENCE (resolved_type))
error (_("Argument to dynamic_cast must be a pointer or reference type")); error (_("Argument to dynamic_cast must be a pointer or reference type"));
if (TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_VOID if (resolved_type->target_type ()->code () != TYPE_CODE_VOID
&& TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_STRUCT) && resolved_type->target_type ()->code () != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast must be pointer to class or `void *'")); error (_("Argument to dynamic_cast must be pointer to class or `void *'"));
class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type)); class_type = check_typedef (resolved_type->target_type ());
if (resolved_type->code () == TYPE_CODE_PTR) if (resolved_type->code () == TYPE_CODE_PTR)
{ {
if (arg_type->code () != TYPE_CODE_PTR if (arg_type->code () != TYPE_CODE_PTR
@ -840,7 +840,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
error (_("Argument to dynamic_cast does not have pointer type")); error (_("Argument to dynamic_cast does not have pointer type"));
if (arg_type->code () == TYPE_CODE_PTR) if (arg_type->code () == TYPE_CODE_PTR)
{ {
arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type)); arg_type = check_typedef (arg_type->target_type ());
if (arg_type->code () != TYPE_CODE_STRUCT) if (arg_type->code () != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does " error (_("Argument to dynamic_cast does "
"not have pointer to class type")); "not have pointer to class type"));
@ -889,19 +889,19 @@ value_dynamic_cast (struct type *type, struct value *arg)
/* dynamic_cast<void *> means to return a pointer to the /* dynamic_cast<void *> means to return a pointer to the
most-derived object. */ most-derived object. */
if (resolved_type->code () == TYPE_CODE_PTR if (resolved_type->code () == TYPE_CODE_PTR
&& TYPE_TARGET_TYPE (resolved_type)->code () == TYPE_CODE_VOID) && resolved_type->target_type ()->code () == TYPE_CODE_VOID)
return value_at_lazy (type, addr); return value_at_lazy (type, addr);
tem = value_at (type, addr); tem = value_at (type, addr);
type = value_type (tem); type = value_type (tem);
/* The first dynamic check specified in 5.2.7. */ /* The first dynamic check specified in 5.2.7. */
if (is_public_ancestor (arg_type, TYPE_TARGET_TYPE (resolved_type))) if (is_public_ancestor (arg_type, resolved_type->target_type ()))
{ {
if (class_types_same_p (rtti_type, TYPE_TARGET_TYPE (resolved_type))) if (class_types_same_p (rtti_type, resolved_type->target_type ()))
return tem; return tem;
result = NULL; result = NULL;
if (dynamic_cast_check_1 (TYPE_TARGET_TYPE (resolved_type), if (dynamic_cast_check_1 (resolved_type->target_type (),
value_contents_for_printing (tem).data (), value_contents_for_printing (tem).data (),
value_embedded_offset (tem), value_embedded_offset (tem),
value_address (tem), tem, value_address (tem), tem,
@ -917,7 +917,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
/* The second dynamic check specified in 5.2.7. */ /* The second dynamic check specified in 5.2.7. */
result = NULL; result = NULL;
if (is_public_ancestor (arg_type, rtti_type) if (is_public_ancestor (arg_type, rtti_type)
&& dynamic_cast_check_2 (TYPE_TARGET_TYPE (resolved_type), && dynamic_cast_check_2 (resolved_type->target_type (),
value_contents_for_printing (tem).data (), value_contents_for_printing (tem).data (),
value_embedded_offset (tem), value_embedded_offset (tem),
value_address (tem), tem, value_address (tem), tem,
@ -947,7 +947,7 @@ value_one (struct type *type)
} }
else if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) else if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ())
{ {
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1)); struct type *eltype = check_typedef (type1->target_type ());
int i; int i;
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
@ -1515,7 +1515,7 @@ value_coerce_array (struct value *arg1)
if (VALUE_LVAL (arg1) != lval_memory) if (VALUE_LVAL (arg1) != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), return value_from_pointer (lookup_pointer_type (type->target_type ()),
value_address (arg1)); value_address (arg1));
} }
@ -1556,11 +1556,11 @@ value_addr (struct value *arg1)
allows &(&X) to get the location containing the reference. allows &(&X) to get the location containing the reference.
Do the same to its enclosing type for consistency. */ Do the same to its enclosing type for consistency. */
struct type *type_ptr struct type *type_ptr
= lookup_pointer_type (TYPE_TARGET_TYPE (type)); = lookup_pointer_type (type->target_type ());
struct type *enclosing_type struct type *enclosing_type
= check_typedef (value_enclosing_type (arg1)); = check_typedef (value_enclosing_type (arg1));
struct type *enclosing_type_ptr struct type *enclosing_type_ptr
= lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type)); = lookup_pointer_type (enclosing_type->target_type ());
arg2 = value_copy (arg1); arg2 = value_copy (arg1);
deprecated_set_value_type (arg2, type_ptr); deprecated_set_value_type (arg2, type_ptr);
@ -1648,7 +1648,7 @@ value_ind (struct value *arg1)
/* We may be pointing to something embedded in a larger object. /* We may be pointing to something embedded in a larger object.
Get the real type of the enclosing object. */ Get the real type of the enclosing object. */
enc_type = check_typedef (value_enclosing_type (arg1)); enc_type = check_typedef (value_enclosing_type (arg1));
enc_type = TYPE_TARGET_TYPE (enc_type); enc_type = enc_type->target_type ();
CORE_ADDR base_addr; CORE_ADDR base_addr;
if (check_typedef (enc_type)->code () == TYPE_CODE_FUNC if (check_typedef (enc_type)->code () == TYPE_CODE_FUNC
@ -1811,7 +1811,7 @@ typecmp (bool staticp, bool varargs, int nargs,
if (TYPE_IS_REFERENCE (tt1) if (TYPE_IS_REFERENCE (tt1)
/* We should be doing hairy argument matching, as below. */ /* We should be doing hairy argument matching, as below. */
&& (check_typedef (TYPE_TARGET_TYPE (tt1))->code () && (check_typedef (tt1->target_type ())->code ()
== tt2->code ())) == tt2->code ()))
{ {
if (tt2->code () == TYPE_CODE_ARRAY) if (tt2->code () == TYPE_CODE_ARRAY)
@ -1829,13 +1829,13 @@ typecmp (bool staticp, bool varargs, int nargs,
and the argument will be a pointer to a char. */ and the argument will be a pointer to a char. */
while (TYPE_IS_REFERENCE (tt1) || tt1->code () == TYPE_CODE_PTR) while (TYPE_IS_REFERENCE (tt1) || tt1->code () == TYPE_CODE_PTR)
{ {
tt1 = check_typedef ( TYPE_TARGET_TYPE (tt1) ); tt1 = check_typedef ( tt1->target_type () );
} }
while (tt2->code () == TYPE_CODE_ARRAY while (tt2->code () == TYPE_CODE_ARRAY
|| tt2->code () == TYPE_CODE_PTR || tt2->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (tt2)) || TYPE_IS_REFERENCE (tt2))
{ {
tt2 = check_typedef (TYPE_TARGET_TYPE (tt2)); tt2 = check_typedef (tt2->target_type ());
} }
if (tt1->code () == tt2->code ()) if (tt1->code () == tt2->code ())
continue; continue;
@ -3580,13 +3580,13 @@ value_struct_elt_for_reference (struct type *domain, int offset,
else else
{ {
struct type *p = check_typedef (value_type (this_v)); struct type *p = check_typedef (value_type (this_v));
p = check_typedef (TYPE_TARGET_TYPE (p)); p = check_typedef (p->target_type ());
if (get_baseclass_offset (p, curtype, this_v, if (get_baseclass_offset (p, curtype, this_v,
&boff, &isvirt)) &boff, &isvirt))
mem_offset += boff; mem_offset += boff;
} }
} }
tmp = lookup_pointer_type (TYPE_TARGET_TYPE (type)); tmp = lookup_pointer_type (type->target_type ());
result = value_from_pointer (tmp, result = value_from_pointer (tmp,
value_as_long (v) + mem_offset); value_as_long (v) + mem_offset);
return value_ind (result); return value_ind (result);
@ -3602,7 +3602,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
/* Perform all necessary dereferencing. */ /* Perform all necessary dereferencing. */
while (intype && intype->code () == TYPE_CODE_PTR) while (intype && intype->code () == TYPE_CODE_PTR)
intype = TYPE_TARGET_TYPE (intype); intype = intype->target_type ();
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i) for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
{ {
@ -4014,12 +4014,12 @@ value_slice (struct value *array, int lowbound, int length)
/* FIXME-type-allocation: need a way to free this type when we are /* FIXME-type-allocation: need a way to free this type when we are
done with it. */ done with it. */
slice_range_type = create_static_range_type (NULL, slice_range_type = create_static_range_type (NULL,
TYPE_TARGET_TYPE (range_type), range_type->target_type (),
lowbound, lowbound,
lowbound + length - 1); lowbound + length - 1);
{ {
struct type *element_type = TYPE_TARGET_TYPE (array_type); struct type *element_type = array_type->target_type ();
LONGEST offset LONGEST offset
= (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type)); = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
@ -4052,7 +4052,7 @@ value_literal_complex (struct value *arg1,
struct type *type) struct type *type)
{ {
struct value *val; struct value *val;
struct type *real_type = TYPE_TARGET_TYPE (type); struct type *real_type = type->target_type ();
val = allocate_value (type); val = allocate_value (type);
arg1 = value_cast (real_type, arg1); arg1 = value_cast (real_type, arg1);
@ -4074,7 +4074,7 @@ struct value *
value_real_part (struct value *value) value_real_part (struct value *value)
{ {
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value_type (value));
struct type *ttype = TYPE_TARGET_TYPE (type); struct type *ttype = type->target_type ();
gdb_assert (type->code () == TYPE_CODE_COMPLEX); gdb_assert (type->code () == TYPE_CODE_COMPLEX);
return value_from_component (value, ttype, 0); return value_from_component (value, ttype, 0);
@ -4086,7 +4086,7 @@ struct value *
value_imaginary_part (struct value *value) value_imaginary_part (struct value *value)
{ {
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value_type (value));
struct type *ttype = TYPE_TARGET_TYPE (type); struct type *ttype = type->target_type ();
gdb_assert (type->code () == TYPE_CODE_COMPLEX); gdb_assert (type->code () == TYPE_CODE_COMPLEX);
return value_from_component (value, ttype, return value_from_component (value, ttype,
@ -4098,11 +4098,11 @@ value_imaginary_part (struct value *value)
static struct value * static struct value *
cast_into_complex (struct type *type, struct value *val) cast_into_complex (struct type *type, struct value *val)
{ {
struct type *real_type = TYPE_TARGET_TYPE (type); struct type *real_type = type->target_type ();
if (value_type (val)->code () == TYPE_CODE_COMPLEX) if (value_type (val)->code () == TYPE_CODE_COMPLEX)
{ {
struct type *val_real_type = TYPE_TARGET_TYPE (value_type (val)); struct type *val_real_type = value_type (val)->target_type ();
struct value *re_val = allocate_value (val_real_type); struct value *re_val = allocate_value (val_real_type);
struct value *im_val = allocate_value (val_real_type); struct value *im_val = allocate_value (val_real_type);
int len = TYPE_LENGTH (val_real_type); int len = TYPE_LENGTH (val_real_type);

View File

@ -298,7 +298,7 @@ val_print_scalar_type_p (struct type *type)
type = check_typedef (type); type = check_typedef (type);
while (TYPE_IS_REFERENCE (type)) while (TYPE_IS_REFERENCE (type))
{ {
type = TYPE_TARGET_TYPE (type); type = type->target_type ();
type = check_typedef (type); type = check_typedef (type);
} }
switch (type->code ()) switch (type->code ())
@ -456,7 +456,7 @@ generic_val_print_array (struct value *val,
generic_val_print_decorations *decorations) generic_val_print_decorations *decorations)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
struct type *unresolved_elttype = TYPE_TARGET_TYPE (type); struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype); struct type *elttype = check_typedef (unresolved_elttype);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
@ -491,7 +491,7 @@ generic_value_print_ptr (struct value *val, struct ui_file *stream,
else else
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
CORE_ADDR addr = unpack_pointer (type, valaddr); CORE_ADDR addr = unpack_pointer (type, valaddr);
@ -544,7 +544,7 @@ generic_val_print_ref (struct type *type,
struct value *original_value, struct value *original_value,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL; struct value *deref_val = NULL;
const int value_is_synthetic const int value_is_synthetic
= value_bits_synthetic_pointer (original_value, = value_bits_synthetic_pointer (original_value,
@ -565,7 +565,7 @@ generic_val_print_ref (struct type *type,
gdb_assert (embedded_offset == 0); gdb_assert (embedded_offset == 0);
} }
else else
deref_val = value_at (TYPE_TARGET_TYPE (type), deref_val = value_at (type->target_type (),
unpack_pointer (type, valaddr + embedded_offset)); unpack_pointer (type, valaddr + embedded_offset));
} }
/* Else, original_value isn't a synthetic reference or we don't have to print /* Else, original_value isn't a synthetic reference or we don't have to print
@ -900,7 +900,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
printer. */ printer. */
while (type->code () == TYPE_CODE_RANGE) while (type->code () == TYPE_CODE_RANGE)
{ {
type = check_typedef (TYPE_TARGET_TYPE (type)); type = check_typedef (type->target_type ());
val = value_cast (type, val); val = value_cast (type, val);
} }
@ -1938,11 +1938,11 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (value_type (val));
elttype = TYPE_TARGET_TYPE (type); elttype = type->target_type ();
eltlen = type_length_units (check_typedef (elttype)); eltlen = type_length_units (check_typedef (elttype));
index_type = type->index_type (); index_type = type->index_type ();
if (index_type->code () == TYPE_CODE_RANGE) if (index_type->code () == TYPE_CODE_RANGE)
index_type = TYPE_TARGET_TYPE (index_type); index_type = index_type->target_type ();
if (get_array_bounds (type, &low_bound, &high_bound)) if (get_array_bounds (type, &low_bound, &high_bound))
{ {

View File

@ -1199,7 +1199,7 @@ value_actual_type (struct value *value, int resolve_simple_types,
/* If result's target type is TYPE_CODE_STRUCT, proceed to /* If result's target type is TYPE_CODE_STRUCT, proceed to
fetch its rtti type. */ fetch its rtti type. */
if (result->is_pointer_or_reference () if (result->is_pointer_or_reference ()
&& (check_typedef (TYPE_TARGET_TYPE (result))->code () && (check_typedef (result->target_type ())->code ()
== TYPE_CODE_STRUCT) == TYPE_CODE_STRUCT)
&& !value_optimized_out (value)) && !value_optimized_out (value))
{ {
@ -3802,7 +3802,7 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
{ {
gdb_assert (original_type->is_pointer_or_reference ()); gdb_assert (original_type->is_pointer_or_reference ());
struct type *original_target_type = TYPE_TARGET_TYPE (original_type); struct type *original_target_type = original_type->target_type ();
gdb::array_view<const gdb_byte> view; gdb::array_view<const gdb_byte> view;
struct type *resolved_original_target_type struct type *resolved_original_target_type
= resolve_dynamic_type (original_target_type, view, = resolve_dynamic_type (original_target_type, view,
@ -3834,7 +3834,7 @@ coerce_ref (struct value *arg)
return arg; return arg;
enc_type = check_typedef (value_enclosing_type (arg)); enc_type = check_typedef (value_enclosing_type (arg));
enc_type = TYPE_TARGET_TYPE (enc_type); enc_type = enc_type->target_type ();
CORE_ADDR addr = unpack_pointer (value_type (arg), value_contents (arg).data ()); CORE_ADDR addr = unpack_pointer (value_type (arg), value_contents (arg).data ());
retval = value_at_lazy (enc_type, addr); retval = value_at_lazy (enc_type, addr);

View File

@ -610,7 +610,7 @@ xstormy16_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_TARGET_TYPE (type)->code (); enum type_code target = type->target_type ()->code ();
CORE_ADDR addr CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
@ -629,7 +629,7 @@ xstormy16_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr) struct type *type, gdb_byte *buf, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_TARGET_TYPE (type)->code (); enum type_code target = type->target_type ()->code ();
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
{ {