Remove the macro, replace all uses by calls to type::target_type.
Change-Id: Ie51d3e1e22f94130176d6abd723255282bb6d1ed
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)
return -1;
}
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
(target_type, fundamental_type);
case TYPE_CODE_COMPLEX:
{
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),
buf))
if (!ada_is_modular_type (type_arg))
error (_("'modulus must be applied to modular type"));
write_int (pstate, ada_modulus (type_arg),
- TYPE_TARGET_TYPE (type_arg));
+ type_arg->target_type ());
}
;
ada_typedef_target_type (struct type *type)
{
while (type->code () == TYPE_CODE_TYPEDEF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
return type;
}
{
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;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
return type;
}
if (type != NULL
&& (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF))
- return ada_check_typedef (TYPE_TARGET_TYPE (type));
+ return ada_check_typedef (type->target_type ());
else
return type;
}
{
r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
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;
}
if (p_bounds_type
&& 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 ())
p_bounds = value_cast (lookup_pointer_type
if (data_type
&& 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;
while (type != NULL
&& (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
return ada_is_direct_array_type (type);
}
type = ada_check_typedef (type);
return (type->code () == TYPE_CODE_ARRAY
|| (type->code () == TYPE_CODE_PTR
- && (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()
+ && (ada_check_typedef (type->target_type ())->code ()
== TYPE_CODE_ARRAY)));
}
type = desc_base_type (type);
/* The structure's first field is a pointer to an array, so this
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)
type = ada_typedef_target_type (type);
/* Now we can see if the array elements are packed. */
gdb_assert (is_thick_pntr (type));
/* The structure's first field is a pointer to an array, so this
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. */
return TYPE_FIELD_BITSIZE (type, 0);
}
new_type = alloc_type_copy (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);
create_array_type (new_type, new_elt_type, index_type);
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
return 0;
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)
{
LONGEST elt_len = recursively_update_array_bitsize (elt_type);
(long) idx);
bits = TYPE_FIELD_BITSIZE (elt_type, 0);
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;
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)
error (_("too many subscripts (%d expected)"), k);
if (type->code () != TYPE_CODE_ARRAY)
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));
get_discrete_bounds (type->index_type (), &lwb, &upb);
arr = value_ptradd (arr, pos_atr (ind[k]) - lwb);
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
return value_ind (arr);
int low, int high)
{
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
= create_static_range_type (NULL, base_index_type, low, high);
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),
TYPE_FIELD_BITSIZE (type0, 0));
int base_low = ada_discrete_type_low_bound (type0->index_type ());
ULONGEST stride = TYPE_FIELD_BITSIZE (slice_type, 0) / 8;
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;
return value_at_lazy (slice_type, base);
ada_value_slice (struct value *array, int low, int high)
{
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
= create_static_range_type (NULL, type->index_type (), low, high);
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_FIELD_BITSIZE (type, 0));
gdb::optional<LONGEST> low_pos, high_pos;
while (type->code () == TYPE_CODE_ARRAY)
{
arity += 1;
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
}
return arity;
k = nindices;
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;
}
return p_array_type;
{
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
of array types. If one of these types has a name, then
it is not another dimension of the outer array, but
for (i = 1; i < n; i += 1)
{
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
has a target type of TYPE_CODE_UNDEF. We compensate here, but
perhaps stabsread.c would make more sense. */
return (LONGEST) - which;
if (arr_type->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (arr_type);
+ type = arr_type->target_type ();
else
type = arr_type;
struct type *elt_type = check_typedef (type);
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 ();
}
{
struct type *base_type;
if (index_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (index_type);
+ base_type = index_type->target_type ();
else
base_type = index_type;
struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_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);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
}
gdb_printf (stream, ")");
}
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () != TYPE_CODE_VOID)
{
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);
}
}
atype = ada_check_typedef (atype);
if (ftype->code () == TYPE_CODE_REF)
- ftype = TYPE_TARGET_TYPE (ftype);
+ ftype = ftype->target_type ();
if (atype->code () == TYPE_CODE_REF)
- atype = TYPE_TARGET_TYPE (atype);
+ atype = atype->target_type ();
switch (ftype->code ())
{
case TYPE_CODE_PTR:
if (atype->code () != TYPE_CODE_PTR)
return 0;
- atype = TYPE_TARGET_TYPE (atype);
+ atype = atype->target_type ();
/* This can only happen if the actual argument is 'null'. */
if (atype->code () == TYPE_CODE_INT && TYPE_LENGTH (atype) == 0)
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_ENUM:
case TYPE_CODE_RANGE:
return 1;
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
return_type = get_base_type (func_type);
if (return_type == NULL)
case TYPE_CODE_FIXED_POINT:
return 1;
case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || numeric_type_p (TYPE_TARGET_TYPE (type)));
+ return (type == type->target_type ()
+ || numeric_type_p (type->target_type ()));
default:
return 0;
}
case TYPE_CODE_INT:
return 1;
case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || integer_type_p (TYPE_TARGET_TYPE (type)));
+ return (type == type->target_type ()
+ || integer_type_p (type->target_type ()));
default:
return 0;
}
t1 = t = ada_check_typedef (value_type (arg));
if (t->code () == TYPE_CODE_REF)
{
- t1 = TYPE_TARGET_TYPE (t);
+ t1 = t->target_type ();
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
while (t->code () == TYPE_CODE_PTR)
{
- t1 = TYPE_TARGET_TYPE (t);
+ t1 = t->target_type ();
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
if (ada_is_tagged_type (t1, 0)
|| (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.
If not found then let's look in the fixed type. */
struct type *formal_type = ada_check_typedef (formal_type0);
struct type *formal_target =
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 =
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)
&& actual_target->code () == TYPE_CODE_ARRAY)
if (type->code () != TYPE_CODE_PTR)
return 0;
- name = TYPE_TARGET_TYPE (type)->name ();
+ name = type->target_type ()->name ();
if (name == NULL)
return 0;
return 0;
else
{
- const char *name = ada_type_name (TYPE_TARGET_TYPE (type));
+ const char *name = ada_type_name (type->target_type ());
return (name != NULL
&& strcmp (name, "ada__tags__dispatch_table") == 0);
/* If the _parent field is a pointer, then dereference it. */
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. */
parent_type = ada_get_base_type (parent_type);
return (field_type->code () == TYPE_CODE_UNION
|| (is_dynamic_field (type, field_num)
- && (TYPE_TARGET_TYPE (field_type)->code ()
+ && (field_type->target_type ()->code ()
== TYPE_CODE_UNION)));
}
const char *discrim_start;
if (type0->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (type0);
+ type = type0->target_type ();
else
type = type0;
type = ada_check_typedef (type);
if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
if (type == NULL
{
const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address;
- struct type *field_type =
- TYPE_TARGET_TYPE (type->field (f).type ());
+ struct type *field_type = type->field (f).type ()->target_type ();
if (dval0 == NULL)
{
no runtime values. Useless for use in values, but that's OK,
since the results are used only for type determinations. Works on both
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. */
static struct type *
return type0;
/* Likewise if we already have computed the static approximation. */
- if (TYPE_TARGET_TYPE (type0) != NULL)
- return TYPE_TARGET_TYPE (type0);
+ if (type0->target_type () != NULL)
+ return type0->target_type ();
/* Don't clone TYPE0 until we are sure we are going to need a copy. */
type = type0;
if (is_dynamic_field (type0, f))
{
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
new_type = static_unwrap_type (field_type);
struct type *var_type;
if (var_type0->code () == TYPE_CODE_PTR)
- var_type = TYPE_TARGET_TYPE (var_type0);
+ var_type = var_type0->target_type ();
else
var_type = var_type0;
return empty_record (var_type);
else if (is_dynamic_field (var_type, which))
return to_fixed_record_type
- (TYPE_TARGET_TYPE (var_type->field (which).type ()),
- valaddr, address, dval);
+ (var_type->field (which).type ()->target_type(), valaddr, address, dval);
else if (variant_field_index (var_type->field (which).type ()) >= 0)
return
to_fixed_record_type
if (!ada_is_redundant_range_encoding (this_layer->index_type (),
desc_type->field (i).type ()))
return 0;
- this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
+ this_layer = check_typedef (this_layer->target_type ());
}
return 1;
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
depend on the contents of the array in properly constructed
elt_type0 = type0;
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
depend on the contents of the array in properly constructed
result = create_array_type (alloc_type_copy (elt_type0),
result, range_type);
- elt_type0 = TYPE_TARGET_TYPE (elt_type0);
+ elt_type0 = elt_type0->target_type ();
}
}
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
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);
TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
{
gdb_assert (discrete_type_p (type));
if (type->code () == TYPE_CODE_RANGE)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_ENUM)
{
if (val < 0 || val >= type->num_fields ())
}
/* 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. */
static struct value *
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 i;
that the size of val's elements is smaller than the size
of type's element. */
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 (is_integral_type (TYPE_TARGET_TYPE (value_type (val))));
- gdb_assert (TYPE_LENGTH (TYPE_TARGET_TYPE (type))
- > TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))));
+ gdb_assert (is_integral_type (value_type (val)->target_type ()));
+ gdb_assert (TYPE_LENGTH (type->target_type ())
+ > TYPE_LENGTH (value_type (val)->target_type ()));
if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds"));
if (!ada_same_array_size_p (type, type2))
error (_("cannot assign arrays of different length"));
- if (is_integral_type (TYPE_TARGET_TYPE (type))
- && is_integral_type (TYPE_TARGET_TYPE (type2))
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
- < TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
+ if (is_integral_type (type->target_type ())
+ && is_integral_type (type2->target_type ())
+ && TYPE_LENGTH (type2->target_type ())
+ < TYPE_LENGTH (type->target_type ()))
{
/* Allow implicit promotion of the array elements to
a wider type. */
return ada_promote_array_of_integrals (type, val);
}
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
- != TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
+ if (TYPE_LENGTH (type2->target_type ())
+ != TYPE_LENGTH (type->target_type ()))
error (_("Incompatible types in assignment"));
deprecated_set_value_type (val, type);
}
the user is really asking for the size of the actual object,
not the size of the pointer. */
if (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
/* If this is a reference to an aligner type, then remove all
the aligners. */
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
- (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)))
error (_("cannot slice a packed array"));
/* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */
while (value_type (array)->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (value_type (array))->code ()
+ && (value_type (array)->target_type ()->code ()
== TYPE_CODE_PTR))
array = value_ind (array);
struct type *type0 = ada_check_typedef (value_type (array));
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
{
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,
longest_to_int (low_bound),
struct type *rhs_type = check_typedef (value_type (rhs));
struct type *elt_type = nullptr;
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);
}
else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr)
struct type *lhs_type = check_typedef (value_type (lhs));
struct type *elt_type = nullptr;
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);
}
else
a reference type, find its underlying type. */
struct type *type = value_type (arg1);
while (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
arg1 = value_binop (arg1, arg2, std::get<0> (m_storage));
/* We need to special-case the result with a range.
a reference should mostly be transparent to the user. */
if (ada_is_tagged_type (type, 0)
|| (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
type is dynamic and can only be determined by inspecting the
if ((type->code () == TYPE_CODE_REF
|| 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,
EVAL_NORMAL);
{
type = to_static_fixed_type
(ada_aligned_type
- (ada_check_typedef (TYPE_TARGET_TYPE (type))));
+ (ada_check_typedef (type->target_type ())));
}
return value_zero (type, lval_memory);
}
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:
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
break;
case TYPE_CODE_ARRAY:
break;
case TYPE_CODE_STRUCT:
if (noside != EVAL_AVOID_SIDE_EFFECTS)
callee = ada_value_ind (callee);
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
break;
default:
error (_("cannot subscript or call something of type `%s'"),
case TYPE_CODE_FUNC:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_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);
case TYPE_CODE_INTERNAL_FUNCTION:
case TYPE_CODE_PTR: /* Pointer to array */
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);
if (type == NULL)
error (_("element type of array unknown"));
gdb_assert (raw_type->name () != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (raw_type);
+ base_type = raw_type->target_type ();
else
base_type = raw_type;
gdb::unique_xmalloc_ptr<char> watch_location_expression
(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);
return xstrprintf ("{%s} %s", name.c_str (), core_addr_to_string (addr));
}
bounds_type = type->field (bounds_fieldno).type ();
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)
error (_("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
struct type *idxtype = NULL;
if (type->code () == TYPE_CODE_ARRAY)
- eltype = check_typedef (TYPE_TARGET_TYPE (type));
+ eltype = check_typedef (type->target_type ());
if (eltype != NULL
&& eltype->code () == TYPE_CODE_PTR)
idxtype = check_typedef (type->index_type ());
if (type->code () != TYPE_CODE_RANGE)
return 0;
- subtype = TYPE_TARGET_TYPE (type);
+ subtype = type->target_type ();
if (subtype == NULL)
return 0;
array ('["00"]' .. '["ff"]') of ... */
while (type_is_full_subrange_of_target_type (type))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
switch (type->code ())
gdb_assert (name != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (raw_type);
+ base_type = raw_type->target_type ();
else
base_type = raw_type;
name, then it is not another dimension of the outer
array, but rather the element type of the outermost
array. */
- arr_type = TYPE_TARGET_TYPE (arr_type);
+ arr_type = arr_type->target_type ();
if (arr_type->name () != nullptr)
break;
}
n_indices = range_desc_type->num_fields ();
for (k = 0, arr_type = type;
k < n_indices;
- k += 1, arr_type = TYPE_TARGET_TYPE (arr_type))
+ k += 1, arr_type = arr_type->target_type ())
{
if (k > 0)
gdb_printf (stream, ", ");
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)
return;
}
{
int i, len = type->num_fields ();
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () == TYPE_CODE_VOID)
gdb_printf (stream, "procedure");
else
gdb_printf (stream, "function");
gdb_printf (stream, ")");
}
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
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 ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
+ ada_print_type (type->target_type (), "", stream, 0, 0, flags);
}
}
if (type->code () != TYPE_CODE_PTR
|| strstr (varstring, "___XVL") == nullptr)
gdb_printf (stream, "access ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ ada_print_type (type->target_type (), "", stream, show, level,
flags);
break;
case TYPE_CODE_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);
break;
case TYPE_CODE_ARRAY:
of an enumerated type, where the underlying value of the
first element is typically 0, we might test the low bound
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. */
struct value *mark = value_mark ();
LONGEST low = 0;
- elttype = TYPE_TARGET_TYPE (type);
+ elttype = type->target_type ();
index_type = type->index_type ();
{
}
if (index_type->code () == TYPE_CODE_RANGE)
- index_type = TYPE_TARGET_TYPE (index_type);
+ index_type = index_type->target_type ();
i = 0;
annotate_array_section_begin (i, elttype);
break;
case TYPE_CODE_RANGE:
- ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream);
+ ada_print_scalar (type->target_type (), val, stream);
return;
case TYPE_CODE_UNDEF:
const struct value_print_options *options)
{
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 len;
const struct value_print_options *options)
{
if (!options->format
- && TYPE_TARGET_TYPE (value_type (val))->code () == TYPE_CODE_INT
- && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))) == 0)
+ && value_type (val)->target_type ()->code () == TYPE_CODE_INT
+ && TYPE_LENGTH (value_type (val)->target_type ()) == 0)
{
gdb_puts ("null", stream);
return;
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (type->code () == TYPE_CODE_RANGE
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR))
+ && (type->target_type ()->code () == TYPE_CODE_ENUM
+ || type->target_type ()->code () == TYPE_CODE_BOOL
+ || type->target_type ()->code () == TYPE_CODE_CHAR))
{
/* For enum-valued ranges, we want to recurse, because we'll end
up printing the constant's name rather than its numeric
value. Character and fixed-point types are also printed
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);
common_val_print (val, stream, recurse + 1, options,
language_def (language_ada));
of the object value would be confusing to an Ada programmer.
So, for Ada values, we print the actual dereferenced value
regardless. */
- struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val;
CORE_ADDR deref_val_int;
/* If it is a pointer, indicate what it points to; but not for
"void *" pointers. */
if (type->code () == TYPE_CODE_PTR
- && !(TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_INT
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == 0))
+ && !(type->target_type ()->code () == TYPE_CODE_INT
+ && TYPE_LENGTH (type->target_type ()) == 0))
{
/* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
- || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT
- || TYPE_TARGET_TYPE (type)->is_unsigned ())
+ if (TYPE_LENGTH (type->target_type ()) != sizeof (char)
+ || type->target_type ()->code () != TYPE_CODE_INT
+ || type->target_type ()->is_unsigned ())
{
gdb_printf (stream, "(");
type_print (type, "", stream, -1);
/* Decode parent_type by the equivalent pointer to (decoded)
array. */
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 = lookup_pointer_type (parent_type);
}
type = value_type (value);
}
else
- type = TYPE_TARGET_TYPE (parent_type);
+ type = parent_type->target_type ();
if (child_value)
*child_value = value;
type = value_type (value);
}
else
- type = TYPE_TARGET_TYPE (parent_type);
+ type = parent_type->target_type ();
if (child_value)
*child_value = value;
the struct/union type. We handle this situation by dereferencing
the (value, type) couple. */
if ((*type)->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT
- || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION)
+ && ((*type)->target_type ()->code () == TYPE_CODE_STRUCT
+ || (*type)->target_type ()->code () == TYPE_CODE_UNION)
&& *value != nullptr
&& value_as_address (*value) != 0
- && !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type))
- && !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type)))
+ && !ada_is_array_descriptor_type ((*type)->target_type ())
+ && !ada_is_constrained_packed_array_type ((*type)->target_type ()))
ada_varobj_ind (*value, *type, value, type);
/* If this is a tagged type, we need to transform it a bit in order
ada_varobj_get_ptr_number_of_children (struct value *parent_value,
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
you cannot print what they point to. */
/* If the index type is a range type, find the base type. */
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
|| index_type->code () == TYPE_CODE_BOOL)
? value_type (var->value.get ()) : var->type);
if (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (ada_is_access_to_unconstrained_array (type))
{
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. */
amd64_classify (subtype, theclass);
/* __m128, __m128i and __m128d are returned via XMM0. */
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)
{
regnum = AMD64_XMM0_REGNUM;
int count;
unsigned unitlen;
- count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
+ count = arm_vfp_cprc_sub_candidate (t->target_type (),
base_type);
if (count == -1)
return -1;
applies. */
ftype = check_typedef (value_type (function));
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);
/* Set the return address. For the ARM, the return breakpoint is
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
- target_type = TYPE_TARGET_TYPE (arg_type);
+ target_type = arg_type->target_type ();
typecode = arg_type->code ();
val = value_contents (args[argnum]).data ();
avr_convert_iaddr_to_raw (addr));
}
/* Is it a code address? */
- else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD)
+ else if (type->target_type ()->code () == TYPE_CODE_FUNC
+ || type->target_type ()->code () == TYPE_CODE_METHOD)
{
/* A code pointer is word (16 bits) addressed. We shift the address down
by 1 bit to convert it to a pointer. */
return avr_make_iaddr (addr);
}
/* Is it a code address? */
- else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
- || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
+ else if (type->target_type ()->code () == TYPE_CODE_FUNC
+ || type->target_type ()->code () == TYPE_CODE_METHOD
+ || TYPE_CODE_SPACE (type->target_type ()))
{
/* A code pointer is word (16 bits) addressed so we shift it up
by 1 bit to convert it to an address. */
int string_trace = 0;
if (ax->trace_string
&& 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'))
string_trace = 1;
}
if (type->code () == TYPE_CODE_RANGE)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
switch (type->code ())
{
are no longer an lvalue. */
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->kind = axs_rvalue;
static void
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)
{
gdb_assert (value1->type->is_pointer_or_reference ());
gdb_assert (value2->type->is_pointer_or_reference ());
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type))
- != TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type)))
+ if (TYPE_LENGTH (value1->type->target_type ())
+ != TYPE_LENGTH (value2->type->target_type ()))
error (_("\
First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type."));
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
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)
error (_("Attempt to dereference a generic pointer."));
value->kind = ((value->type->code () == TYPE_CODE_FUNC)
{
/* Get the return type of the resolver. */
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
is the type of the pointed-to function. */
if (resolver_ret_type->code () == TYPE_CODE_PTR)
{
struct type *resolved_type
- = TYPE_TARGET_TYPE (resolver_ret_type);
+ = resolver_ret_type->target_type ();
if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
return resolved_type;
}
{
operation_up real
= (make_operation<long_const_operation>
- (TYPE_TARGET_TYPE ($1.type), 0));
+ ($1.type->target_type (), 0));
operation_up imag
= (make_operation<long_const_operation>
- (TYPE_TARGET_TYPE ($1.type), $1.val));
+ ($1.type->target_type (), $1.val));
pstate->push_new<complex_operation>
(std::move (real), std::move (imag), $1.type);
}
exp : COMPLEX_FLOAT
{
- struct type *underlying
- = TYPE_TARGET_TYPE ($1.type);
+ struct type *underlying = $1.type->target_type ();
float_data val;
target_float_from_host_double (val.data (),
or a reference type, the result is the size of
the referenced 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>
(int_type, TYPE_LENGTH (type));
}
/* Call for side effects. */
check_typedef (elttype);
- if (TYPE_TARGET_TYPE (elttype))
- elttype = TYPE_TARGET_TYPE (elttype);
+ if (elttype->target_type ())
+ elttype = elttype->target_type ();
else
{
/* Perhaps check_typedef did not update the target type. In
int err, width;
unsigned int fetchlimit;
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;
enum bfd_endian byte_order
= type_byte_order (type);
if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{
struct type *element_type
- = check_typedef (TYPE_TARGET_TYPE (expect_type));
+ = check_typedef (expect_type->target_type ());
if (element_type->code () == TYPE_CODE_INT
|| element_type->code () == TYPE_CODE_CHAR)
type = check_typedef (type);
while (type->code () == TYPE_CODE_REF)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
type = check_typedef (type);
}
case TYPE_CODE_ARRAY:
{
/* 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
&& TYPE_LENGTH (array_target_type) > 0
&& c_textual_element_type (array_target_type, 0));
return true;
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);
}
default:
gdb_assert (nargs > 0);
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))
gdb_printf (stream, " const");
switch (type->code ())
{
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,
podata);
gdb_printf (stream, "*");
break;
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);
name = TYPE_SELF_TYPE (type)->name ();
if (name)
break;
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,
podata);
gdb_printf (stream, "(");
case TYPE_CODE_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,
podata);
gdb_printf (stream, type->code () == TYPE_CODE_REF ? "&" : "&&");
case TYPE_CODE_METHOD:
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,
podata);
if (passed_a_ptr)
break;
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,
language, flags, podata);
if (passed_a_ptr)
break;
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,
language, flags, podata);
break;
plongest (high_bound - low_bound + 1));
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);
}
break;
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);
break;
case TYPE_CODE_METHODPTR:
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);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_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);
break;
gdb_printf (stream, ")");
if (!demangled_args)
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);
break;
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);
break;
gdb_printf (stream, "virtual ");
else if (TYPE_FN_FIELD_STATIC_P (f, j))
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. */
gdb_printf (stream,
&& !is_type_conversion_operator (type, i, j))
{
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);
gdb_puts (" ", stream);
/* Dereference the typedef declaration itself. */
gdb_assert (target->code () == TYPE_CODE_TYPEDEF);
- target = TYPE_TARGET_TYPE (target);
+ target = target->target_type ();
if (need_access_label)
{
{
case TYPE_CODE_TYPEDEF:
/* 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_TARGET_TYPE (type) == NULL);
+ gdb_assert (type->target_type () == NULL);
fprintf_styled (stream, metadata_style.style (),
_("<unnamed typedef>"));
break;
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- c_type_print_base_1 (TYPE_TARGET_TYPE (type),
+ c_type_print_base_1 (type->target_type (),
stream, show, level, language, flags, podata);
break;
case TYPE_CODE_ARRAY:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
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);
break;
print too much than too little; but conversely not to
print something egregiously outside the current
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)
gdb_printf (stream, ": %s ", underlying->name ());
/* Peel a single typedef. If the typedef doesn't have a target
type, we use check_typedef and hope the result is ok -- it
might be for C++, where wchar_t is a built-in type. */
- if (TYPE_TARGET_TYPE (iter_type))
- iter_type = TYPE_TARGET_TYPE (iter_type);
+ if (iter_type->target_type ())
+ iter_type = iter_type->target_type ();
else
iter_type = check_typedef (iter_type);
}
struct type *type = check_typedef (value_type (val));
CORE_ADDR address = value_address (val);
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);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
}
else
{
- struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
+ struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype);
CORE_ADDR addr = unpack_pointer (type, valaddr);
are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL
- && TYPE_TARGET_TYPE (original_type)->name () != NULL
- && (strcmp (TYPE_TARGET_TYPE (original_type)->name (),
+ && original_type->target_type ()->name () != NULL
+ && (strcmp (original_type->target_type ()->name (),
"char") == 0
- || textual_name (TYPE_TARGET_TYPE (original_type)->name ())))
+ || textual_name (original_type->target_type ()->name ())))
{
/* Print nothing. */
}
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);
enum type_code refcode = TYPE_CODE_UNDEF;
check_typedef and here, we want to show the true
declared type of the variable. */
if (ctype)
- *ctype = TYPE_TARGET_TYPE (type);
+ *ctype = type->target_type ();
if (cfull_expression)
*cfull_expression = string_printf ("*(%s)", parent_expression.c_str ());
/* Strip top-level references. */
while (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
switch (type->code ())
{
static void
patch_type (struct type *type, struct type *real_type)
{
- struct type *target = TYPE_TARGET_TYPE (type);
- struct type *real_target = TYPE_TARGET_TYPE (real_type);
+ struct type *target = type->target_type ();
+ struct type *real_target = real_type->target_type ();
int field_size = real_target->num_fields () * sizeof (struct field);
TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
if (real_sym->aclass () == LOC_TYPEDEF
&& real_sym->domain () == VAR_DOMAIN
&& 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 ();
int hash = hashname (name);
references work themselves out via the magic of
coff_lookup_type. */
if (sym->type ()->code () == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) == 0
- && TYPE_TARGET_TYPE (sym->type ())->code ()
+ && TYPE_LENGTH (sym->type ()->target_type ()) == 0
+ && sym->type ()->target_type ()->code ()
!= TYPE_CODE_UNDEF)
{
int i = hashname (sym->linkage_name ());
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
switch (type->code ())
{
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
type->index_type (), sym);
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
- TYPE_TARGET_TYPE (type), sym);
+ type->target_type (), sym);
break;
case TYPE_CODE_UNION:
static gcc_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);
}
gcc_type element_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)
return context->plugin ().error (_("array type with non-constant"
struct gcc_type_array array;
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
want to fallback to the type of the cast just before the
static gcc_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);
}
compile_cplus_convert_reference (compile_cplus_instance *instance,
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;
switch (type->code ())
compile_cplus_convert_pointer (compile_cplus_instance *instance,
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);
}
struct type *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)
{
gcc_type class_type = instance->convert_type (containing_class);
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
(class_type, member_type);
struct type *type, bool strip_artificial)
{
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
want to fallback to the type of the cast just before the
compile_cplus_convert_complex (compile_cplus_instance *instance,
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);
}
gdb_ptr_type = check_typedef (gdb_ptr_type);
if (gdb_ptr_type->code () != TYPE_CODE_PTR)
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))
{
switch (gdb_type_from_ptr->code ())
{
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;
case TYPE_CODE_FUNC:
break;
objfile_name (objfile));
}
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\" "
"in compiled module \"%s\"."),
COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL,
regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
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)
error (_("Invalid type code %d of dereferenced first parameter "
"of function \"%s\" in compiled module \"%s\"."),
"module \"%s\"."),
func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION,
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 "
"module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
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.
This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */
struct type *last = otype;
/* Find the last typedef for the type. */
- while (TYPE_TARGET_TYPE (last) != NULL
- && (TYPE_TARGET_TYPE (last)->code ()
+ while (last->target_type () != NULL
+ && (last->target_type ()->code ()
== TYPE_CODE_TYPEDEF))
- last = TYPE_TARGET_TYPE (last);
+ last = last->target_type ();
/* If there is only one typedef for this anonymous type,
do not substitute it. */
if (type->code () == TYPE_CODE_TYPEDEF)
type = check_typedef (type);
else
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
type_name = type->name ();
structures. Nowadays it points directly to the structure. */
if (type->code () == TYPE_CODE_PTR)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
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 */
|| type->code () == TYPE_CODE_PTR) /* if using thunks */
{
{
struct type **first_dont_print;
int i;
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
first_dont_print
= (struct type **) obstack_base (&dont_print_stat_array_obstack);
base_type = copy_type (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 = TYPE_TARGET_TYPE (inner_array);
+ inner_array->set_target_type (copy_type (inner_array->target_type ()));
+ inner_array = inner_array->target_type ();
}
- el_type = TYPE_TARGET_TYPE (inner_array);
+ el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr));
else
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);
}
if (lang_this.symbol == NULL)
return {};
- type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ()));
+ type = check_typedef (lang_this.symbol->type ()->target_type ());
classname = type->name ();
nested = name;
}
length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
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,
valaddr + type->field (1).loc_bitpos () / 8
+ embedded_offset);
union call_site_parameter_u kind_u)
{
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 value *outer_val, *target_val, *val;
struct call_site_parameter *parameter;
entry value. */
if (!TYPE_IS_REFERENCE (checked_type)
- || TYPE_TARGET_TYPE (checked_type) == NULL)
+ || checked_type->target_type () == NULL)
return outer_val;
target_val = dwarf_entry_parameter_to_value (parameter,
if (bytes != NULL)
{
if (byte_offset >= 0
- && byte_offset + TYPE_LENGTH (TYPE_TARGET_TYPE (type)) <= len)
+ && byte_offset + TYPE_LENGTH (type->target_type ()) <= len)
{
bytes += byte_offset;
- result = value_from_contents (TYPE_TARGET_TYPE (type), bytes);
+ result = value_from_contents (type->target_type (), bytes);
}
else
invalid_synthetic_pointer ();
}
else
- result = allocate_optimized_out_value (TYPE_TARGET_TYPE (type));
+ result = allocate_optimized_out_value (type->target_type ());
return result;
}
return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
baton.size, baton.per_cu,
baton.per_objfile,
- TYPE_TARGET_TYPE (type),
+ type->target_type (),
byte_offset);
else
return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu,
if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
&& 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");
}
}
/* TYPE is the domain of this method, and THIS_TYPE is the type
of the method itself (TYPE_CODE_METHOD). */
smash_to_method_type (fnp->type, type,
- TYPE_TARGET_TYPE (this_type),
+ this_type->target_type (),
this_type->fields (),
this_type->num_fields (),
this_type->has_varargs ());
}
else
{
- fnp->fcontext
- = TYPE_TARGET_TYPE (this_type->field (0).type ());
+ fnp->fcontext = this_type->field (0).type ()->target_type ();
}
}
}
pfn_type = type->field (0).type ();
if (pfn_type == NULL
|| pfn_type->code () != TYPE_CODE_PTR
- || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
+ || pfn_type->target_type ()->code () != TYPE_CODE_FUNC)
return;
/* Look for the "this" argument. */
- pfn_type = TYPE_TARGET_TYPE (pfn_type);
+ pfn_type = pfn_type->target_type ();
if (pfn_type->num_fields () == 0
/* || pfn_type->field (0).type () == NULL */
|| pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
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);
- 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->has_varargs ());
smash_to_methodptr_type (type, new_type);
range_bounds *current_bounds = index_type->bounds ();
/* 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)
{
/* Maybe we don't need to rewrite this array. */
because those may be referenced in other contexts where this
rewriting is undesirable. */
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)
type->field (0).set_type (lookup_pointer_type (new_ary_type));
}
can tell us the reality. However, we defer to a local size
attribute if one exists, because this lets the compiler override
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);
type->set_is_unsigned (underlying_type->is_unsigned ());
iter->main_type->dyn_prop_list = nullptr;
iter->set_index_type
(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 *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->has_varargs ());
type = lookup_methodptr_type (new_type);
base_type = copy_type (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 = TYPE_TARGET_TYPE (inner_array);
+ inner_array->set_target_type (copy_type (inner_array->target_type ()));
+ inner_array = inner_array->target_type ();
}
- el_type = TYPE_TARGET_TYPE (inner_array);
+ el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, NULL));
thread_info *thread = inferior_thread ();
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
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 value *func_func;
struct value *value;
{
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
switch (type->code ())
{
ftype = resolved_type;
}
- type *return_type = TYPE_TARGET_TYPE (ftype);
+ type *return_type = ftype->target_type ();
if (return_type == NULL)
return_type = default_return_type;
value *callee = evaluate_with_coercion (exp, noside);
struct type *type = value_type (callee);
if (type->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
for (int i = 0; i < args.size (); ++i)
{
if (i < type->num_fields ())
if (a1_type->code () == TYPE_CODE_METHODPTR)
{
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
callee = cplus_method_ptr_to_value (&lhs, rhs);
struct type *type_ptr
= lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
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. */
lhs = value_cast (type_ptr, lhs);
type = check_typedef (type);
if (!type->is_pointer_or_reference ())
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
if (type->code () == TYPE_CODE_UNION
type = check_typedef (type);
return (type != nullptr
&& 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. */
struct value_print_options opts;
get_user_print_options (&opts);
- if (opts.objectprint && TYPE_TARGET_TYPE (arg_type)
- && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT))
+ if (opts.objectprint && arg_type->target_type ()
+ && (arg_type->target_type ()->code () == TYPE_CODE_STRUCT))
{
real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc);
{
case TYPE_CODE_METHODPTR:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (TYPE_TARGET_TYPE (type), not_lval);
+ return value_zero (type->target_type (), not_lval);
else
{
arg2 = cplus_method_ptr_to_value (&arg1, 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);
return value_ind (arg3);
}
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
return value_subscript (arg1, value_as_long (arg2));
}
in the inferior, but being able to print accurate type
information seems worth the risk. */
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 ()
/* In C you can dereference an array to get the 1st elt. */
|| type->code () == TYPE_CODE_ARRAY)
- return value_zero (TYPE_TARGET_TYPE (type),
+ return value_zero (type->target_type (),
lval_memory);
else if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
struct type *callee_type = value_type (called_method);
if (callee_type && callee_type->code () == TYPE_CODE_PTR)
- callee_type = TYPE_TARGET_TYPE (callee_type);
- callee_type = TYPE_TARGET_TYPE (callee_type);
+ callee_type = callee_type->target_type ();
+ callee_type = callee_type->target_type ();
if (callee_type)
{
&& type->code () == TYPE_CODE_ARRAY)
{
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);
int element_size = TYPE_LENGTH (check_typedef (element_type));
LONGEST low_bound, high_bound, index;
/* Get targettype of elementtype. */
while (check_type->code () == TYPE_CODE_RANGE
|| 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))
error (_("(power)set type with unknown size"));
different types. Also check if type of element is "compatible"
with element type of powerset. */
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)
- 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 ())
|| (range_low_type->code () == TYPE_CODE_ENUM
&& (range_low_type != range_high_type)))
struct type *type = check_typedef (value_type (x));
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);
else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
return value_zero (lookup_pointer_type (value_type (x)),
{
struct value *val = address_of_variable (var,
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);
}
type = check_typedef (type);
if (exp->language_defn->la_language == language_cplus
&& (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));
}
struct type *type = check_typedef (value_type (val));
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)
{
type = type->index_type ();
if (!type->is_pointer_or_reference ()
&& type->code () != TYPE_CODE_ARRAY)
error (_("Attempt to take contents of a non-pointer value."));
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (is_dynamic_type (type))
type = value_type (value_ind (val));
/* FIXME: This should be size_t. */
enum noside noside) override
{
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);
return eval_op_ind (expect_type, exp, noside, val);
}
error ("unable to read array bounds");
/* 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 ();
if (m_stride == 0)
m_stride = type_length_units (elt_type);
m_nss++;
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,
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
recurse while peeling off one more dimension of the array. */
}
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
within this dimension. */
value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */
- array_type = TYPE_TARGET_TYPE (array_type);
+ array_type = array_type->target_type ();
}
return result;
}
/* 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");
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)
++ndimen;
struct type *pointer_target_type;
if (pointer_type->code () == TYPE_CODE_PTR)
- pointer_target_type = TYPE_TARGET_TYPE (pointer_type);
+ pointer_target_type = pointer_type->target_type ();
else
pointer_target_type = pointer_type;
struct type *target_target_type;
if (target_type->code () == TYPE_CODE_PTR)
- target_target_type = TYPE_TARGET_TYPE (target_type);
+ target_target_type = target_type->target_type ();
else
target_target_type = target_type;
if (pointer_stride == 0)
pointer_stride
= type_length_units (check_typedef
- (TYPE_TARGET_TYPE (pointer_type))) * 8;
+ (pointer_type->target_type ())) * 8;
target_stride = target_range->bounds ()->bit_stride ();
if (target_stride == 0)
target_stride
= type_length_units (check_typedef
- (TYPE_TARGET_TYPE (target_type))) * 8;
+ (target_type->target_type ())) * 8;
if (pointer_stride != target_stride)
break;
}
/* 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);
value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */
- val_type = TYPE_TARGET_TYPE (val_type);
+ val_type = val_type->target_type ();
}
return result;
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,
TYPE_LENGTH (type));
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. */
for (int i = 0; i < ndimensions; ++i)
{
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
array slice off as this type, then as we process the requested slice
error (_("stride must not be 0"));
/* 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 ();
LONGEST lb = f77_get_lowerbound (dim_type);
LONGEST ub = f77_get_upperbound (dim_type);
= value_as_long (ops[i]->evaluate_with_coercion (exp, noside));
/* 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 ();
LONGEST lb = f77_get_lowerbound (dim_type);
LONGEST ub = f77_get_upperbound (dim_type);
struct type *new_range
= create_range_type_with_stride ((struct type *) NULL,
- TYPE_TARGET_TYPE (d.index),
+ d.index->target_type (),
&p_low, &p_high, 0, &p_stride,
true);
array_slice_type
struct type *new_range
= create_range_type_with_stride ((struct type *) NULL,
- TYPE_TARGET_TYPE (d.index),
+ d.index->target_type (),
&p_low, &p_high, 0, &p_stride,
true);
repacked_array_type
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
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
|| target_type->code () == TYPE_CODE_STRING
error ("failed to get range bounds");
/* 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 ();
if (stride == 0)
stride = type_length_units (elt_type);
if (stride < 0 && lowerbound < upperbound)
offset = (upperbound - lowerbound) * stride;
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. */
type = check_typedef (type);
return (type->code () == TYPE_CODE_STRING
|| (type->code () == TYPE_CODE_ARRAY
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR));
+ && type->target_type ()->code () == TYPE_CODE_CHAR));
}
/* See language.h. */
|| code == TYPE_CODE_ARRAY
|| ((code == TYPE_CODE_PTR
|| code == TYPE_CODE_REF)
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || (TYPE_TARGET_TYPE (type)->code ()
+ && (type->target_type ()->code () == TYPE_CODE_FUNC
+ || (type->target_type ()->code ()
== TYPE_CODE_METHOD)
- || (TYPE_TARGET_TYPE (type)->code ()
+ || (type->target_type ()->code ()
== TYPE_CODE_ARRAY))))))
gdb_puts (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
switch (type->code ())
{
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;
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)
gdb_printf (stream, "(");
break;
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;
case TYPE_CODE_UNDEF:
print_rank_only = true;
}
- if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
+ if (type->target_type ()->code () == TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (type->target_type (), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
}
}
- if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
+ if (type->target_type ()->code () != TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (type->target_type (), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
case TYPE_CODE_PTR:
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);
gdb_printf (stream, " )");
break;
{
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,
arrayprint_recurse_level, false);
if (passed_a_ptr)
switch (type->code ())
{
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;
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;
case TYPE_CODE_FUNC:
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ f_type_print_base (type->target_type (), stream, show, level);
break;
case TYPE_CODE_PTR:
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;
case TYPE_CODE_REF:
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;
case TYPE_CODE_VOID:
This function also works for strings which behave very
similarly to arrays. */
- if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRING)
- f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type));
+ if (type->target_type ()->code () == TYPE_CODE_ARRAY
+ || type->target_type ()->code () == TYPE_CODE_STRING)
+ f77_get_dynamic_length_of_aggregate (type->target_type ());
/* Recursion ends here, start setting up lengths. */
lower_bound = f77_get_lowerbound (type);
TYPE_LENGTH (type) =
(upper_bound - lower_bound + 1)
- * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
+ * TYPE_LENGTH (check_typedef (type->target_type ()));
}
/* Per-dimension statistics. */
LONGEST offset1, LONGEST offset2)
{
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. */
struct type *range_type = check_typedef (type)->index_type ();
/* CALC is used to calculate the offsets for each element. */
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++)
{
/* Use the index and the stride to work out a new offset. */
break;
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);
else
{
- struct type *ch_type = TYPE_TARGET_TYPE (type);
+ struct type *ch_type = type->target_type ();
f77_get_dynamic_length_of_aggregate (type);
printstr (stream, ch_type, valaddr,
int want_space = 0;
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 (want_space)
gdb_puts (" ", stream);
- val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
+ val_print_string (type->target_type (), NULL, addr, -1,
stream, options);
}
return;
else if (abi == FRV_ABI_FDPIC
&& len == 4
&& 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
of entry points. */
{
if (type != NULL)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type != NULL)
type = check_typedef (type);
}
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
- = discrete_position (TYPE_TARGET_TYPE (type), low);
+ = discrete_position (type->target_type (), low);
if (low_pos.has_value ())
low = *low_pos;
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
- = discrete_position (TYPE_TARGET_TYPE (type), high);
+ = discrete_position (type->target_type (), high);
if (high_pos.has_value ())
high = *high_pos;
discrete_position (struct type *type, LONGEST val)
{
if (type->code () == TYPE_CODE_RANGE)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_ENUM)
{
if (!get_discrete_bounds (range_type, &low_bound, &high_bound))
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
empty arrays with the high_bound being smaller than the low_bound.
In such cases, the array length should be zero. */
/* Find the innermost array type, in case the array is
multi-dimensional. */
inner_array = array_type;
- while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
- inner_array = TYPE_TARGET_TYPE (inner_array);
+ while (inner_array->target_type ()->code () == TYPE_CODE_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)
{
type_instance_flags flags
if (type->code () != TYPE_CODE_PTR
&& type->code () != TYPE_CODE_REF)
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
if (type->code () != TYPE_CODE_STRUCT
/* We only want to recognize references at the outermost level. */
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
dynamic, even if the type itself is statically defined.
of the range type are static. It allows us to assume that
the subtype of a static range type is also static. */
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:
if (is_dynamic_type_internal (type->index_type (), 0))
return 1;
/* ... 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;
/* ... or if it has a dynamic stride... */
if (array_type_has_dynamic_stride (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);
LONGEST bias = dyn_range_type->bounds ()->bias;
static_range_type = create_range_type_with_stride
range_type
= 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)
{
ary_dim = copy_type (ary_dim);
rank - 1, resolve_p);
}
else
- elt_type = TYPE_TARGET_TYPE (type);
+ elt_type = type->target_type ();
prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE);
if (prop != NULL && resolve_p)
function. In this case the resolved type should not be an
array, but should instead be that of an array element. */
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
= TYPE_MAIN_TYPE (dynamic_array_type)->dyn_prop_list;
if (prop_list != nullptr)
and so on, until eventually, we have the element type at the
end of the chain. Create all the additional array types here
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;
for (int i = 1; i < rank; i++)
{
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 = 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 = check_typedef (TYPE_TARGET_TYPE (tmp_type)))
+ tmp_type = check_typedef (tmp_type->target_type ()))
++rank;
}
{
resolved_type = copy_type (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));
}
else
{
struct property_addr_info pinfo;
- pinfo.type = check_typedef (TYPE_TARGET_TYPE (type));
+ pinfo.type = check_typedef (type->target_type ());
pinfo.valaddr = {};
if (addr_stack->valaddr.data () != NULL)
pinfo.addr = extract_typed_address (addr_stack->valaddr.data (),
resolved_type = copy_type (type);
resolved_type->set_target_type
- (resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type),
+ (resolve_dynamic_type_internal (type->target_type (),
&pinfo, top_level));
break;
}
stripped. If necessary a new qualified form of the underlying type
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
there was no name for the typedef in the debug info.
while (type->code () == TYPE_CODE_TYPEDEF)
{
- if (!TYPE_TARGET_TYPE (type))
+ if (!type->target_type ())
{
const char *name;
struct symbol *sym;
else /* TYPE_CODE_UNDEF */
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.
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 ())
{
mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
/* MTYPE may currently be a function (TYPE_CODE_FUNC).
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] == '.');
mtype->set_is_stub (false);
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
case TYPE_CODE_ARRAY:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
- align = type_align (TYPE_TARGET_TYPE (type));
+ align = type_align (type->target_type ());
break;
case TYPE_CODE_STRUCT:
return
(t != NULL
&& t->code () == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (t)->code () != TYPE_CODE_VOID);
+ && t->target_type ()->code () != TYPE_CODE_VOID);
}
int
&& t->index_type ()->code () == TYPE_CODE_RANGE)
{
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))
return (high_bound == low_bound
of the same type. */
if (a->code () == TYPE_CODE_PTR
|| a->code () == TYPE_CODE_REF)
- return types_equal (TYPE_TARGET_TYPE (a),
- TYPE_TARGET_TYPE (b));
+ return types_equal (a->target_type (),
+ b->target_type ());
/* Well, damnit, if the names are exactly the same, I'll say they
are exactly the same. This happens when we generate method
if (a->num_fields () != b->num_fields ())
return false;
- if (!types_equal (TYPE_TARGET_TYPE (a), TYPE_TARGET_TYPE (b)))
+ if (!types_equal (a->target_type (), b->target_type ()))
return false;
for (i = 0; i < a->num_fields (); ++i)
}
}
- if (TYPE_TARGET_TYPE (type1) != NULL)
+ if (type1->target_type () != NULL)
{
- if (TYPE_TARGET_TYPE (type2) == NULL)
+ if (type2->target_type () == NULL)
return false;
- worklist->emplace_back (TYPE_TARGET_TYPE (type1),
- TYPE_TARGET_TYPE (type2));
+ worklist->emplace_back (type1->target_type (),
+ type2->target_type ());
}
- else if (TYPE_TARGET_TYPE (type2) != NULL)
+ else if (type2->target_type () != NULL)
return false;
return true;
/* Allowed pointer conversions are:
(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;
/* (b) pointer to ancestor-pointer conversion. */
- rank.subrank = distance_to_ancestor (TYPE_TARGET_TYPE (parm),
- TYPE_TARGET_TYPE (arg),
+ rank.subrank = distance_to_ancestor (parm->target_type (),
+ arg->target_type (),
0);
if (rank.subrank >= 0)
return sum_ranks (BASE_PTR_CONVERSION_BADNESS, rank);
return INCOMPATIBLE_TYPE_BADNESS;
case TYPE_CODE_ARRAY:
{
- struct type *t1 = TYPE_TARGET_TYPE (parm);
- struct type *t2 = TYPE_TARGET_TYPE (arg);
+ struct type *t1 = parm->target_type ();
+ struct type *t2 = arg->target_type ();
if (types_equal (t1, t2))
{
return INCOMPATIBLE_TYPE_BADNESS;
}
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:
if (value != NULL && value_type (value)->code () == TYPE_CODE_INT)
{
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
- return rank_one_type (TYPE_TARGET_TYPE (parm),
- TYPE_TARGET_TYPE (arg), NULL);
+ return rank_one_type (parm->target_type (),
+ arg->target_type (), NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
switch (arg->code ())
{
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:
return INCOMPATIBLE_TYPE_BADNESS;
}
lvalue references. */
if (parm->code () == TYPE_CODE_RVALUE_REF)
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;
else
return INCOMPATIBLE_TYPE_BADNESS;
/* For pointers and references, compare target type. */
if (parm->is_pointer_or_reference ())
{
- t1 = TYPE_TARGET_TYPE (parm);
- t2 = TYPE_TARGET_TYPE (arg);
+ t1 = parm->target_type ();
+ t2 = arg->target_type ();
}
/* Make sure they are CV equal, too. */
references. */
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));
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));
if (overload_debug)
{
gdb_printf ("%*sgdbarch %s\n", spaces, "",
host_address_to_string (type->arch_owner ()));
gdb_printf ("%*starget_type %s\n", spaces, "",
- host_address_to_string (TYPE_TARGET_TYPE (type)));
- if (TYPE_TARGET_TYPE (type) != NULL)
+ host_address_to_string (type->target_type ()));
+ 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, "",
host_address_to_string (TYPE_POINTER_TYPE (type)));
/* Copy pointers to other types. */
- if (TYPE_TARGET_TYPE (type))
+ if (type->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.
is_fixed_point_type (struct type *type)
{
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);
return type->code () == TYPE_CODE_FIXED_POINT;
struct type *type = this;
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);
gdb_assert (type->code () == TYPE_CODE_FIXED_POINT);
Regardless of the language, GDB represents multidimensional
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
- of instances of TYPE_TARGET_TYPE (T) laid out sequentially in
+ of instances of T->target_type () laid out sequentially in
memory.
Row-major languages like C lay out multi-dimensional arrays so
}
/* 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
user. */
allocate_fixed_point_type_info (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_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
fcontext = TYPE_VPTR_BASETYPE (type);
context = lookup_pointer_type (fcontext);
/* 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));
/* With older versions of g++, the vtbl field pointed to an array
of structures. Nowadays it points directly to the structure. */
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
array of structures. */
nameless types) or have the same name. This is ugly, and a more
elegant solution should be devised (which would probably just push
the ugliness into symbol reading unless we change the stabs format). */
- if (TYPE_TARGET_TYPE (fieldtype) == basetype)
+ if (fieldtype->target_type () == basetype)
return 1;
if (basetype->name () != NULL
- && TYPE_TARGET_TYPE (fieldtype)->name () != NULL
+ && fieldtype->target_type ()->name () != NULL
&& strcmp (basetype->name (),
- TYPE_TARGET_TYPE (fieldtype)->name ()) == 0)
+ fieldtype->target_type ()->name ()) == 0)
return 1;
return 0;
}
self_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr)));
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. */
gdbarch = self_type->arch ();
/* In the non_lvalue case, a reference might have slipped through
here. */
if (type->code () == TYPE_CODE_REF)
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
/* Ignore top-level cv-qualifiers. */
type = make_cv_type (0, 0, type, NULL);
if (arg_type->code () != expected)
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)))
return false;
/* For arrays, make the decision based on the element type. */
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
= gnuv3_pass_by_reference (field_type);
&& type1->code () == TYPE_CODE_INT
&& 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);
/* Print the type of "abc" as "string", not char[4]. */
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);
return;
{
struct gdbarch *gdbarch = type->arch ();
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;
/* 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
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
- return TYPE_TARGET_TYPE (realtype);
+ return realtype->target_type ();
default:
/* This is done to preserve existing behaviour. PR 20769.
E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */
/* 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
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);
value = value_at_lazy (type, ls_smob->address);
}
/* If TYPE is a reference, return the target; otherwise return 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
exception. */
if (type->code () != TYPE_CODE_PTR
&& type->code () != TYPE_CODE_REF)
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
/* If this is not a struct, union, or enum type, raise TypeError
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
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>
if (((type->code () == TYPE_CODE_PTR)
|| (type->code () == TYPE_CODE_REF))
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
+ && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{
struct value *target;
int was_pointer = type->code () == TYPE_CODE_PTR;
length = array_length;
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);
}
else if (length != array_length)
specified length. */
if (length > array_length)
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 + length - 1);
}
/* If we are passing a function pointer, make sure we pass a function
descriptor instead of the function entry address. */
if (type->code () == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
+ && type->target_type ()->code () == TYPE_CODE_FUNC)
{
ULONGEST codeptr, fptr;
&& TYPE_LENGTH (type) == 16)
return 1;
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
|| type->code () == TYPE_CODE_UNION)
{
struct type *type = check_typedef (value_type (function));
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
artificial flag of the first parameter ('this' pointer). */
break;
case TYPE_CODE_ARRAY:
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);
break;
case TYPE_CODE_STRUCT:
return 0;
case TYPE_CODE_ARRAY:
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:
{
int i;
/* Special handling for function parameters. */
if (len == 8
&& 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];
ULONGEST faddr = extract_unsigned_integer
convert it back to a reference. This will issue an error
if the value was not previously in memory - in some cases
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 ());
return new_value;
}
because they are passed by value. */
if (current_language->c_style_arrays_p ())
if (!type->is_vector ())
- type = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+ type = lookup_pointer_type (type->target_type ());
break;
case TYPE_CODE_UNDEF:
case TYPE_CODE_PTR:
else if (ftype->code () == TYPE_CODE_PTR)
{
funaddr = value_as_address (function);
- ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
+ ftype = check_typedef (ftype->target_type ());
if (ftype->code () == TYPE_CODE_FUNC
|| ftype->code () == TYPE_CODE_METHOD)
funaddr = gdbarch_convert_from_func_ptr_addr
target_ftype = find_gnu_ifunc_target_type (resolver_addr);
if (target_ftype != NULL)
{
- value_type = TYPE_TARGET_TYPE (check_typedef (target_ftype));
+ value_type = check_typedef (target_ftype)->target_type ();
ftype = target_ftype;
}
}
}
else
- value_type = TYPE_TARGET_TYPE (ftype);
+ value_type = ftype->target_type ();
}
else if (ftype->code () == TYPE_CODE_INT)
{
prototyped. Can we respect TYPE_VARARGS? Probably not. */
if (ftype->code () == TYPE_CODE_METHOD)
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)
{
/* Calling a no-debug function with the return type
struct value *value;
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);
if (is_nocall_function (check_typedef (::value_type (function))))
/* We're done. */
set_finished ();
- rv->type = TYPE_TARGET_TYPE (function->type ());
+ rv->type = function->type ()->target_type ();
if (rv->type == NULL)
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
struct type * type, const gdb_byte * buf)
{
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
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD
- || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
+ || TYPE_CODE_SPACE (type->target_type ()))
addr = insn_addr_from_ptr (addr);
return addr;
struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
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)
addr = insn_ptr_from_addr (addr);
/* Skip typedefs. */
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. */
if (type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION)
return 1;
/* Skip typedefs of field type. */
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 (ftype->code () == TYPE_CODE_FLT
|| ftype->code () == TYPE_CODE_INT)
CORE_ADDR addr) const
{
/* 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);
return xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr));
}
type = check_typedef (type);
while (type->code () == TYPE_CODE_REF)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
type = check_typedef (type);
}
return (type->code () == TYPE_CODE_STRING);
break;
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);
if (target_len < regsize)
}
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
return value_subscript (arg1, value_as_long (arg2));
}
type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY
&& 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
&& (elttype->code () == TYPE_CODE_INT
{
if (type->bounds ()->high.const_val () == type->bounds ()->low.const_val ())
{
- /* FIXME: TYPE_TARGET_TYPE used to be TYPE_DOMAIN_TYPE but that was
- wrong. Not sure if TYPE_TARGET_TYPE is correct though. */
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ /* FIXME: type::target_type used to be TYPE_DOMAIN_TYPE but that was
+ wrong. Not sure if type::target_type is correct though. */
+ m2_print_type (type->target_type (), "", stream, show, level,
flags);
}
else
{
- struct type *target = TYPE_TARGET_TYPE (type);
+ struct type *target = type->target_type ();
gdb_printf (stream, "[");
print_type_scalar (target, type->bounds ()->low.const_val (), stream);
gdb_puts (type->name (), 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. */
int show, int level, const struct type_print_options *flags)
{
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)
{
if (type->index_type () != 0)
}
else
gdb_puts (pulongest ((TYPE_LENGTH (type)
- / TYPE_LENGTH (TYPE_TARGET_TYPE (type)))),
+ / TYPE_LENGTH (type->target_type ()))),
stream);
}
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
else
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
int level, const struct type_print_options *flags)
{
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
{
gdb_printf (stream, "PROCEDURE ");
m2_type_name (type, stream);
- if (TYPE_TARGET_TYPE (type) == NULL
- || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () == NULL
+ || type->target_type ()->code () != TYPE_CODE_VOID)
{
int i, len = type->num_fields ();
m2_print_type (type->field (i).type (), "", stream, -1, 0, flags);
}
gdb_printf (stream, ") : ");
- if (TYPE_TARGET_TYPE (type) != NULL)
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
+ if (type->target_type () != NULL)
+ m2_print_type (type->target_type (), "", stream, 0, 0, flags);
else
type_print_unknown_return_type (stream);
}
struct ui_file *stream, int show, int level,
int print_high)
{
- struct type *target = TYPE_TARGET_TYPE (type);
+ struct type *target = type->target_type ();
if (type->num_fields () == 0)
return;
if (len == 0)
return 0;
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 ();
h1 = type->field (len - 1).type ()->bounds ()->high.const_val ();
/*
* check if we have a structure with exactly two fields named
* _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.
*/
if (type->num_fields () != 2)
if (show > 0)
{
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);
}
return 1;
return;
}
- target = TYPE_TARGET_TYPE (range);
+ target = range->target_type ();
if (get_discrete_bounds (range, &field_low, &field_high))
{
range = type->field (field).type ()->index_type ();
if (!get_discrete_bounds (range, &field_low, &field_high))
break;
- target = TYPE_TARGET_TYPE (range);
+ target = range->target_type ();
}
}
if (element_seen)
(type->field (0).loc_bitpos () / 8) +
valaddr);
- val = value_at_lazy (TYPE_TARGET_TYPE (type->field (0).type ()),
+ val = value_at_lazy (type->field (0).type ()->target_type (),
addr);
len = unpack_field_as_long (type, valaddr, 1);
struct ui_file *stream)
{
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;
if (elttype->code () == TYPE_CODE_FUNC)
{
if (want_space)
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);
}
{
struct gdbarch *gdbarch = type->arch ();
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_puts (paddress (gdbarch, addr), stream);
if (elttype->code () != TYPE_CODE_UNDEF)
{
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);
}
switch (type->code ())
{
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);
/* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (elttype) == 1 &&
len = temp_len;
}
- printstr (stream, TYPE_TARGET_TYPE (type), valaddr, len,
+ printstr (stream, type->target_type (), valaddr, len,
NULL, 0, options);
}
else
break;
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);
break;
}
/* Dereference function pointer types. */
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 ||
func_type->code () == TYPE_CODE_METHOD);
enum type_code target_code;
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)
{
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)
{
const bool is_vector = code == TYPE_CODE_ARRAY && type->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;
/* According to m68k_return_in_memory in the m68k GCC back-end,
dereference them. */
while (tp->code () == TYPE_CODE_PTR
|| 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.
Any type may be returned from cross_ref if file indirect entries
if (processing_gcc_compilation == 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);
}
/* Dereference function pointer types. */
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. */
gdb_assert (func_type->code () == TYPE_CODE_FUNC
return (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& get_array_bounds (type, &lowb, &highb)
- && TYPE_TARGET_TYPE (type)->code () == code
- && TYPE_TARGET_TYPE (type)->is_unsigned () == flag_unsigned
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == el_length
+ && type->target_type ()->code () == code
+ && type->target_type ()->is_unsigned () == flag_unsigned
+ && TYPE_LENGTH (type->target_type ()) == el_length
&& TYPE_LENGTH (type) == length
&& highb - lowb + 1 == n);
};
{
struct lval_closure *c = (struct lval_closure *) value_computed_closure (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 elsize = TYPE_LENGTH (eltype);
int n, i, j = 0;
struct value *mark = value_mark ();
struct lval_closure *c = (struct lval_closure *) value_computed_closure (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 elsize = TYPE_LENGTH (eltype);
int n, i, j = 0;
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */
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 start = offset / elsize;
int endrest = (offset + length) % elsize;
int *indices, int n)
{
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;
/* Check if a single component of a vector is requested which means
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;
int i;
if (!t1_is_vec || !t2_is_vec)
error (_("Vector operations are not supported on scalar types"));
- eltype1 = check_typedef (TYPE_TARGET_TYPE (type1));
- eltype2 = check_typedef (TYPE_TARGET_TYPE (type2));
+ eltype1 = check_typedef (type1->target_type ());
+ eltype2 = check_typedef (type2->target_type ());
if (!get_array_bounds (type1,&lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2))
value_vector_widen will error if the scalar value is
truncated by the cast. To avoid the error, cast (and
possibly truncate) here. */
- eltype = check_typedef (TYPE_TARGET_TYPE (to_type));
+ eltype = check_typedef (to_type->target_type ());
arg = value_cast (eltype, arg);
return value_vector_widen (arg, type);
Cannot perform conditional operation on incompatible types"));
}
- eltype2 = check_typedef (TYPE_TARGET_TYPE (type2));
- eltype3 = check_typedef (TYPE_TARGET_TYPE (type3));
+ eltype2 = check_typedef (type2->target_type ());
+ eltype3 = check_typedef (type3->target_type ());
if (!get_array_bounds (type1, &lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2)
exp : exp '^' %prec UNARY
{ pstate->wrap<unop_ind_operation> ();
if (current_type)
- current_type = TYPE_TARGET_TYPE (current_type); }
+ current_type = current_type->target_type (); }
;
exp : '@' exp %prec UNARY
while (current_type->code ()
== TYPE_CODE_PTR)
current_type =
- TYPE_TARGET_TYPE (current_type);
+ current_type->target_type ();
current_type = lookup_struct_elt_type (
current_type, $2.ptr, 0);
}
while (current_type->code ()
== TYPE_CODE_PTR)
current_type =
- TYPE_TARGET_TYPE (current_type);
+ current_type->target_type ();
current_type = lookup_struct_elt_type (
current_type, $2.ptr, 0);
}
{ pop_current_type ();
pstate->wrap2<subscript_operation> ();
if (current_type)
- current_type = TYPE_TARGET_TYPE (current_type); }
+ current_type = current_type->target_type (); }
;
exp : exp '('
(pstate->pop (), std::move (args));
pop_current_type ();
if (current_type)
- current_type = TYPE_TARGET_TYPE (current_type);
+ current_type = current_type->target_type ();
}
;
{
/* Allow automatic dereference of classes. */
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))
pstate->wrap<unop_ind_operation> ();
}
{
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> ();
}
}
if (string_pos)
*string_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
if (char_type)
- *char_type = TYPE_TARGET_TYPE (type->field (1).type ());
+ *char_type = type->field (1).type ()->target_type ();
if (arrayname)
*arrayname = type->field (1).name ();
return 2;
/* FIXME: how can I detect wide chars in GPC ?? */
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)
- *char_type = TYPE_TARGET_TYPE (*char_type);
+ *char_type = (*char_type)->target_type ();
}
if (arrayname)
*arrayname = type->field (2).name ();
{
case TYPE_CODE_PTR:
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);
break; /* Pointer should be handled normally
in pascal. */
case TYPE_CODE_METHOD:
if (passed_a_ptr)
gdb_printf (stream, "(");
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, "function ");
}
break;
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);
gdb_printf (stream, "&");
break;
if (passed_a_ptr)
gdb_printf (stream, "(");
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, "function ");
}
if (passed_a_ptr)
gdb_printf (stream, "(");
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)
gdb_printf (stream, "[%s..%s] ",
plongest (type->bounds ()->low.const_val ()),
int demangled_args,
const struct type_print_options *flags) const
{
- if (TYPE_TARGET_TYPE (type) == NULL
- || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () == NULL
+ || type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, " : ");
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ type_print_varspec_prefix (type->target_type (),
stream, 0, 0, flags);
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0,
+ type_print_base (type->target_type (), stream, show, 0,
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);
}
}
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type),
+ type_print_varspec_suffix (type->target_type (),
stream, 0, 1, 0, flags);
break;
/* void pointer */
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",
stream);
case TYPE_CODE_TYPEDEF:
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
- type_print_base (TYPE_TARGET_TYPE (type), stream, show, level,
+ type_print_base (type->target_type (), stream, show, level,
flags);
break;
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;
case TYPE_CODE_FUNC:
print_spaces (level + 4, stream);
if (TYPE_FN_FIELD_STATIC_P (f, j))
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. */
gdb_printf (stream, "<undefined type> %s;\n",
{
gdb_printf (stream, "destructor ");
}
- else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0
- && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID)
+ else if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
+ && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
+ != TYPE_CODE_VOID))
{
gdb_printf (stream, "function ");
}
type_print_method_args (physname, method_name, stream);
- if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0
- && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID)
+ if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
+ && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
+ != TYPE_CODE_VOID))
{
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);
}
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
/* this probably does not work for enums. */
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);
gdb_puts ("..", stream);
if (get_array_bounds (type, &low_bound, &high_bound))
{
len = high_bound - low_bound + 1;
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ elttype = check_typedef (type->target_type ());
eltlen = TYPE_LENGTH (elttype);
/* If 's' format is used, try to print out as string.
If no format is given, print as string if element type
len = temp_len;
}
- printstr (stream, TYPE_TARGET_TYPE (type), valaddr, len,
+ printstr (stream, type->target_type (), valaddr, len,
NULL, 0, options);
i = len;
}
print_address_demangle (options, gdbarch, addr, stream, demangle);
break;
}
- check_typedef (TYPE_TARGET_TYPE (type));
+ check_typedef (type->target_type ());
addr = unpack_pointer (type, valaddr);
print_unpacked_pointer:
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ elttype = check_typedef (type->target_type ());
if (elttype->code () == TYPE_CODE_FUNC)
{
}
else
{
- wtype = TYPE_TARGET_TYPE (type);
+ wtype = type->target_type ();
}
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, recurse + 1, options,
type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR
&& type->name () == NULL
- && TYPE_TARGET_TYPE (type)->name () != NULL
- && strcmp (TYPE_TARGET_TYPE (type)->name (), "char") == 0)
+ && type->target_type ()->name () != NULL
+ && strcmp (type->target_type ()->name (), "char") == 0)
{
/* Print nothing. */
}
{
if (type->code () == TYPE_CODE_PTR)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
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. */
|| type->code () == TYPE_CODE_PTR) /* If using thunks. */
ftype = check_typedef (ftype);
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
&& TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL);
{
/* OpenCL vectors shorter than 16 bytes are passed as if
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);
for (i = 0; i < nelt; i++)
&& TYPE_LENGTH (type) < 16
&& 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);
for (i = 0; i < nelt; i++)
break;
case TYPE_CODE_COMPLEX:
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT)
{
LONGEST count, low_bound, high_bound;
count = ppc64_aggregate_candidate
- (TYPE_TARGET_TYPE (type), field_type);
+ (type->target_type (), field_type);
if (count == -1)
return -1;
|| type->code () == TYPE_CODE_REF))
{
struct type *target_type
- = check_typedef (TYPE_TARGET_TYPE (type));
+ = check_typedef (type->target_type ());
if (target_type->code () == TYPE_CODE_FUNC
|| target_type->code () == TYPE_CODE_METHOD)
if (type->code () == TYPE_CODE_COMPLEX)
{
/* 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,
int i, nelt;
if (TYPE_LENGTH (type) < 16)
- eltype = check_typedef (TYPE_TARGET_TYPE (type));
+ eltype = check_typedef (type->target_type ());
else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
/* Complex types are returned as if two independent scalars. */
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++)
{
&& opencl_abi)
{
if (TYPE_LENGTH (valtype) < 16)
- eltype = check_typedef (TYPE_TARGET_TYPE (valtype));
+ eltype = check_typedef (valtype->target_type ());
else
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
if (valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector ()
&& TYPE_LENGTH (valtype) <= 8
- && TYPE_TARGET_TYPE (valtype)->code () == TYPE_CODE_INT
- && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
+ && valtype->target_type ()->code () == TYPE_CODE_INT
+ && TYPE_LENGTH (valtype->target_type ()) == 1)
{
int regnum = tdep->ppc_gp0_regnum + 3;
int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
if (function != nullptr)
{
struct type *ret_type =
- check_typedef (TYPE_TARGET_TYPE (function->type ()));
+ check_typedef (function->type ()->target_type ());
/* Remember only non-void return types. */
if (ret_type->code () != TYPE_CODE_VOID)
/* 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
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);
val = value_at_lazy (type, self_string->address);
}
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
- return TYPE_TARGET_TYPE (realtype);
+ return realtype->target_type ();
default:
/* This is done to preserve existing behaviour. PR 20769.
E.g., gdb.parse_and_eval("my_int_variable").lazy_string().type. */
if (!type->is_pointer_or_reference ())
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
/* If this is not a struct, union, or enum type, raise TypeError
{
struct type *type = ((type_object *) self)->type;
- if (!TYPE_TARGET_TYPE (type))
+ if (!type->target_type ())
{
PyErr_SetString (PyExc_RuntimeError,
_("Type does not have a target."));
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. */
{
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
}
catch (const gdb_exception &except)
{
type = check_typedef (type);
if (type->is_pointer_or_reference ()
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
+ && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{
struct value *target;
int was_pointer = type->code () == TYPE_CODE_PTR;
length = array_length;
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);
}
else if (length != array_length)
specified length. */
if (length > array_length)
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 + length - 1);
}
val_type = value_type (v);
val_type = check_typedef (val_type);
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 ();
if ((type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION)
/* If TYPE is a reference, return the target; otherwise return 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
of applying the operation specified by OPCODE to the given
struct type *ftype = check_typedef (value_type (function));
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. */
if (return_method == return_method_struct)
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
/* Is it a code address? */
- if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
- || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))
+ if (type->target_type ()->code () == TYPE_CODE_FUNC
+ || type->target_type ()->code () == TYPE_CODE_METHOD
+ || TYPE_CODE_SPACE (type->target_type ())
|| TYPE_LENGTH (type) == 4)
return rl78_make_instruction_address (addr);
else
struct type *type = check_typedef (value_type (val));
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,
options);
else
gdb_printf (stream, "[]");
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,
llen - 1);
struct value *array = allocate_value_lazy (array_type);
{
LONGEST low_bound, high_bound;
- if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
- && rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type)))
- && get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound,
+ if (type->target_type ()->code () == TYPE_CODE_ARRAY
+ && rust_u8_type_p (type->target_type ()->target_type ())
+ && get_array_bounds (type->target_type (), &low_bound,
&high_bound))
{
/* We have a pointer to a byte string, so just print
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);
struct gdbarch *arch = type->arch ();
}
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,
&opts);
break;
byte string, hence the choice of "ASCII" as the
encoding. */
gdb_puts ("b", stream);
- printstr (stream, TYPE_TARGET_TYPE (type),
+ printstr (stream, type->target_type (),
value_contents_for_printing (val).data (),
high_bound - low_bound + 1, "ASCII", 0, &opts);
}
}
gdb_puts (")", stream);
/* 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);
- rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream,
+ rust_internal_print_type (type->target_type (), "", stream,
-1, 0, flags, false, podata);
}
break;
LONGEST low_bound, high_bound;
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,
podata);
/* We currently can't distinguish between pointers and
references. */
gdb_puts ("*mut ", stream);
- type_print (TYPE_TARGET_TYPE (type), "", stream, 0);
+ type_print (type->target_type (), "", stream, 0);
}
}
break;
{
struct type *base_type = nullptr;
if (type->code () == TYPE_CODE_ARRAY)
- base_type = TYPE_TARGET_TYPE (type);
+ base_type = type->target_type ();
else if (rust_slice_type_p (type))
{
for (int i = 0; i < type->num_fields (); ++i)
{
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;
}
}
error (_("Could not find 'data_ptr' in slice type"));
}
else if (type->code () == TYPE_CODE_PTR)
- base_type = TYPE_TARGET_TYPE (type);
+ base_type = type->target_type ();
else
error (_("Cannot subscript non-array type"));
args[i + 1] = ops[i]->evaluate (nullptr, exp, noside);
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);
}
type = check_typedef (type);
return ((type->code () == TYPE_CODE_STRING)
|| (type->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
- && rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type)))
- && get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound,
+ && (type->target_type ()->code () == TYPE_CODE_ARRAY
+ && rust_u8_type_p (type->target_type ()->target_type ())
+ && get_array_bounds (type->target_type (), &low_bound,
&high_bound)))
|| (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type)
gdb::unique_xmalloc_ptr<char> watch_location_expression
(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);
return xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr),
name.c_str ());
/* Dereference function pointer types. */
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. */
gdb_assert (func_type->code () == TYPE_CODE_FUNC
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
|| func_type->code () == TYPE_CODE_UNION);
struct type *ftype = check_typedef (value_type (function));
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.gr = (return_method == return_method_struct) ? 3 : 2;
func_type = check_typedef (func_type);
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
&& TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{
/* 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;
/* Integer vectors are returned by memory if the vector size
is greater than 8 bytes long. */
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{
/* 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;
/* Integer vectors are passed by memory if the vector size
is greater than 8 bytes long. */
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)
|| (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
return 1;
{
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))
return 1;
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
if (thisfun != NULL)
- return_type = TYPE_TARGET_TYPE (thisfun->type ());
+ return_type = thisfun->type ()->target_type ();
if (return_type == NULL)
{
if (retval_expr->first_opcode () != UNOP_CAST
be typedefed; just be safe. */
t = check_typedef (t);
if (t->is_pointer_or_reference ())
- t = TYPE_TARGET_TYPE (t);
+ t = t->target_type ();
if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION)
/* Determine the type of this function. */
func_type = check_typedef (func_type);
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
|| func_type->code () == TYPE_CODE_METHOD);
because we do not want to dig past all typedefs. */
check_typedef (type);
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
value to fetch the dynamic type from. */
if (val != NULL && opts.objectprint)
{
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);
else if (type->code () == TYPE_CODE_STRUCT)
real_type = value_rtti_type (val, &full, &top, &using_enc);
break;
case TYPE_CODE_RANGE:
- print_type_scalar (TYPE_TARGET_TYPE (type), val, stream);
+ print_type_scalar (type->target_type (), val, stream);
return;
case TYPE_CODE_FIXED_POINT:
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)
return 0;
}
fld_type = type->field (0).type ();
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
&& TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
return 1;
struct type *ptr_target;
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);
if (sz == 0)
gdb_assert (type1->code () == TYPE_CODE_PTR);
gdb_assert (type2->code () == TYPE_CODE_PTR);
- if (TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)))
- != TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2))))
+ if (TYPE_LENGTH (check_typedef (type1->target_type ()))
+ != TYPE_LENGTH (check_typedef (type2->target_type ())))
error (_("First argument of `-' is a pointer and "
"second argument is neither\n"
"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)
{
warning (_("Type size unknown, assuming 1. "
LONGEST lowerbound)
{
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);
/* Fetch the bit stride and convert it to a byte stride, assuming 8 bits
type1 = check_typedef (type1);
if (TYPE_IS_REFERENCE (type1))
- type1 = check_typedef (TYPE_TARGET_TYPE (type1));
+ type1 = check_typedef (type1->target_type ());
type2 = check_typedef (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
|| type2->code () == TYPE_CODE_STRUCT);
return 0;
type1 = check_typedef (value_type (arg1));
if (TYPE_IS_REFERENCE (type1))
- type1 = check_typedef (TYPE_TARGET_TYPE (type1));
+ type1 = check_typedef (type1->target_type ());
return type1->code () == TYPE_CODE_STRUCT;
}
{
struct type *return_type;
- return_type
- = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
+ return_type = check_typedef (value_type (argvec[0]))->target_type ();
return value_zero (return_type, VALUE_LVAL (arg1));
}
return call_function_by_hand (argvec[0], NULL,
{
struct type *return_type;
- return_type
- = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
+ return_type = check_typedef (value_type (argvec[0]))->target_type ();
return value_zero (return_type, VALUE_LVAL (arg1));
}
return call_function_by_hand (argvec[0], NULL,
struct type *elttype1 = type1;
if (elttype1->code () == TYPE_CODE_ARRAY)
{
- elttype1 = TYPE_TARGET_TYPE (elttype1);
+ elttype1 = elttype1->target_type ();
if (!get_array_bounds (type1, &low1, &high1))
error (_("could not determine array bounds on left-hand-side of "
"array concatenation"));
struct type *elttype2 = type2;
if (elttype2->code () == TYPE_CODE_ARRAY)
{
- elttype2 = TYPE_TARGET_TYPE (elttype2);
+ elttype2 = elttype2->target_type ();
if (!get_array_bounds (type2, &low2, &high2))
error (_("could not determine array bounds on right-hand-side of "
"array concatenation"));
if (!get_array_bounds (vector_type, &low_bound, &high_bound))
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);
scalar_type = check_typedef (value_type (scalar_value));
|| !get_array_bounds (type2, &low_bound2, &high_bound2))
error (_("Could not determine the vector bounds"));
- eltype1 = check_typedef (TYPE_TARGET_TYPE (type1));
- eltype2 = check_typedef (TYPE_TARGET_TYPE (type2));
+ eltype1 = check_typedef (type1->target_type ());
+ eltype2 = check_typedef (type2->target_type ());
elsize = TYPE_LENGTH (eltype1);
if (eltype1->code () != eltype2->code ()
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
{
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;
LONGEST low_bound, high_bound;
val = value_from_longest (type, ~value_as_long (arg1));
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;
LONGEST low_bound, high_bound;
struct type *eltype = check_typedef (value_type (element));
if (eltype->code () == TYPE_CODE_RANGE)
- eltype = TYPE_TARGET_TYPE (eltype);
+ eltype = eltype->target_type ();
if (settype->code () != TYPE_CODE_SET)
error (_("Second argument of 'IN' has wrong type"));
if (eltype->code () != TYPE_CODE_INT
{
struct type *type1 = check_typedef (type);
struct type *type2 = check_typedef (value_type (arg2));
- struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1));
- struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2));
+ struct type *t1 = check_typedef (type1->target_type ());
+ struct type *t2 = check_typedef (type2->target_type ());
if (t1->code () == TYPE_CODE_STRUCT
&& t2->code () == TYPE_CODE_STRUCT
we generate value of the given reference. Nothing wrong with
that. */
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);
return value_ref (val, t1->code ());
where N is sizeof(OBJECT)/sizeof(TYPE). */
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));
if (element_length > 0 && type->bounds ()->high.kind () == PROP_UNDEFINED)
/* FIXME-type-allocation: need a way to free this type when
we are done with it. */
range_type = create_static_range_type (NULL,
- TYPE_TARGET_TYPE (range_type),
+ range_type->target_type (),
low_bound,
new_length + low_bound - 1);
deprecated_set_value_type (arg2,
{
is_ref = 1;
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);
}
if (resolved_type->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (resolved_type))
error (_("Argument to dynamic_cast must be a pointer or reference type"));
- if (TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_VOID
- && TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_STRUCT)
+ if (resolved_type->target_type ()->code () != TYPE_CODE_VOID
+ && resolved_type->target_type ()->code () != TYPE_CODE_STRUCT)
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 (arg_type->code () != TYPE_CODE_PTR
error (_("Argument to dynamic_cast does not have pointer type"));
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)
error (_("Argument to dynamic_cast does "
"not have pointer to class type"));
/* dynamic_cast<void *> means to return a pointer to the
most-derived object. */
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);
tem = value_at (type, addr);
type = value_type (tem);
/* 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;
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_embedded_offset (tem),
value_address (tem), tem,
/* The second dynamic check specified in 5.2.7. */
result = NULL;
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_embedded_offset (tem),
value_address (tem), tem,
}
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;
LONGEST low_bound, high_bound;
if (VALUE_LVAL (arg1) != lval_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));
}
allows &(&X) to get the location containing the reference.
Do the same to its enclosing type for consistency. */
struct type *type_ptr
- = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+ = lookup_pointer_type (type->target_type ());
struct type *enclosing_type
= check_typedef (value_enclosing_type (arg1));
struct type *enclosing_type_ptr
- = lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type));
+ = lookup_pointer_type (enclosing_type->target_type ());
arg2 = value_copy (arg1);
deprecated_set_value_type (arg2, type_ptr);
/* We may be pointing to something embedded in a larger object.
Get the real type of the enclosing object. */
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;
if (check_typedef (enc_type)->code () == TYPE_CODE_FUNC
if (TYPE_IS_REFERENCE (tt1)
/* We should be doing hairy argument matching, as below. */
- && (check_typedef (TYPE_TARGET_TYPE (tt1))->code ()
+ && (check_typedef (tt1->target_type ())->code ()
== tt2->code ()))
{
if (tt2->code () == TYPE_CODE_ARRAY)
and the argument will be a pointer to a char. */
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
|| tt2->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (tt2))
{
- tt2 = check_typedef (TYPE_TARGET_TYPE (tt2));
+ tt2 = check_typedef (tt2->target_type ());
}
if (tt1->code () == tt2->code ())
continue;
else
{
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,
&boff, &isvirt))
mem_offset += boff;
}
}
- tmp = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+ tmp = lookup_pointer_type (type->target_type ());
result = value_from_pointer (tmp,
value_as_long (v) + mem_offset);
return value_ind (result);
/* Perform all necessary dereferencing. */
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)
{
/* FIXME-type-allocation: need a way to free this type when we are
done with it. */
slice_range_type = create_static_range_type (NULL,
- TYPE_TARGET_TYPE (range_type),
+ range_type->target_type (),
lowbound,
lowbound + length - 1);
{
- struct type *element_type = TYPE_TARGET_TYPE (array_type);
+ struct type *element_type = array_type->target_type ();
LONGEST offset
= (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
struct type *type)
{
struct value *val;
- struct type *real_type = TYPE_TARGET_TYPE (type);
+ struct type *real_type = type->target_type ();
val = allocate_value (type);
arg1 = value_cast (real_type, arg1);
value_real_part (struct value *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);
return value_from_component (value, ttype, 0);
value_imaginary_part (struct value *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);
return value_from_component (value, ttype,
static struct value *
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)
{
- 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 *im_val = allocate_value (val_real_type);
int len = TYPE_LENGTH (val_real_type);
type = check_typedef (type);
while (TYPE_IS_REFERENCE (type))
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
type = check_typedef (type);
}
switch (type->code ())
generic_val_print_decorations *decorations)
{
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);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
else
{
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 ();
CORE_ADDR addr = unpack_pointer (type, valaddr);
struct value *original_value,
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;
const int value_is_synthetic
= value_bits_synthetic_pointer (original_value,
gdb_assert (embedded_offset == 0);
}
else
- deref_val = value_at (TYPE_TARGET_TYPE (type),
+ deref_val = value_at (type->target_type (),
unpack_pointer (type, valaddr + embedded_offset));
}
/* Else, original_value isn't a synthetic reference or we don't have to print
printer. */
while (type->code () == TYPE_CODE_RANGE)
{
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
val = value_cast (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));
index_type = type->index_type ();
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 result's target type is TYPE_CODE_STRUCT, proceed to
fetch its rtti type. */
if (result->is_pointer_or_reference ()
- && (check_typedef (TYPE_TARGET_TYPE (result))->code ()
+ && (check_typedef (result->target_type ())->code ()
== TYPE_CODE_STRUCT)
&& !value_optimized_out (value))
{
{
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;
struct type *resolved_original_target_type
= resolve_dynamic_type (original_target_type, view,
return 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 ());
retval = value_at_lazy (enc_type, addr);
struct type *type, const gdb_byte *buf)
{
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
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
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)
{