Turn value_type into method

This changes value_type to be a method of value.  Much of this patch
was written by script.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey 2023-01-31 07:52:09 -07:00
parent 7cf57bc5be
commit d0c9791728
107 changed files with 880 additions and 884 deletions

View file

@ -1800,7 +1800,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
continue; continue;
struct value *field = value_primitive_field (arg, 0, i, arg_type); struct value *field = value_primitive_field (arg, 0, i, arg_type);
struct type *field_type = check_typedef (value_type (field)); struct type *field_type = check_typedef (field->type ());
if (!pass_in_v_vfp_candidate (gdbarch, regcache, info, field_type, if (!pass_in_v_vfp_candidate (gdbarch, regcache, info, field_type,
field)) field))
@ -1875,7 +1875,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type, *fundamental_type; struct type *arg_type, *fundamental_type;
int len, elements; int len, elements;
arg_type = check_typedef (value_type (arg)); arg_type = check_typedef (arg->type ());
len = arg_type->length (); len = arg_type->length ();
/* If arg can be passed in v registers as per the AAPCS64, then do so if /* If arg can be passed in v registers as per the AAPCS64, then do so if
@ -2767,7 +2767,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID) if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
else else
memcpy (value_contents_raw (result_value).data (), reg_buf, regsize); memcpy (value_contents_raw (result_value).data (), reg_buf, regsize);

View file

@ -249,7 +249,7 @@ public:
enum noside noside) override enum noside noside) override
{ {
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
value *arg2 = std::get<2> (m_storage)->evaluate (value_type (arg1), value *arg2 = std::get<2> (m_storage)->evaluate (arg1->type (),
exp, noside); exp, noside);
return ada_equal_binop (expect_type, exp, noside, std::get<0> (m_storage), return ada_equal_binop (expect_type, exp, noside, std::get<0> (m_storage),
arg1, arg2); arg1, arg2);
@ -275,7 +275,7 @@ public:
value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
value *result = eval_op_binary (expect_type, exp, noside, OP, lhs, rhs); value *result = eval_op_binary (expect_type, exp, noside, OP, lhs, rhs);
return value_cast (value_type (lhs), result); return value_cast (lhs->type (), result);
} }
enum exp_opcode opcode () const override enum exp_opcode opcode () const override

View file

@ -303,7 +303,7 @@ ada_funcall (int nargs)
struct value *callee_v = callee->evaluate (nullptr, struct value *callee_v = callee->evaluate (nullptr,
pstate->expout.get (), pstate->expout.get (),
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
callee_t = ada_check_typedef (value_type (callee_v)); callee_t = ada_check_typedef (callee_v->type ());
array_arity = ada_array_arity (callee_t); array_arity = ada_array_arity (callee_t);
} }
@ -503,7 +503,7 @@ exp1 : exp
= lhs->evaluate (nullptr, pstate->expout.get (), = lhs->evaluate (nullptr, pstate->expout.get (),
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
rhs = resolve (std::move (rhs), true, rhs = resolve (std::move (rhs), true,
value_type (lhs_val)); lhs_val->type ());
pstate->push_new<ada_assign_operation> pstate->push_new<ada_assign_operation>
(std::move (lhs), std::move (rhs)); (std::move (lhs), std::move (rhs));
} }

View file

@ -549,7 +549,7 @@ static struct value *
coerce_unspec_val_to_type (struct value *val, struct type *type) coerce_unspec_val_to_type (struct value *val, struct type *type)
{ {
type = ada_check_typedef (type); type = ada_check_typedef (type);
if (value_type (val) == type) if (val->type () == type)
return val; return val;
else else
{ {
@ -560,7 +560,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
else if (value_lazy (val) else if (value_lazy (val)
/* Be careful not to make a lazy not_lval value. */ /* Be careful not to make a lazy not_lval value. */
|| (VALUE_LVAL (val) != not_lval || (VALUE_LVAL (val) != not_lval
&& type->length () > value_type (val)->length ())) && type->length () > val->type ()->length ()))
result = allocate_value_lazy (type); result = allocate_value_lazy (type);
else else
{ {
@ -754,7 +754,7 @@ get_base_type (struct type *type)
struct value * struct value *
ada_get_decoded_value (struct value *value) ada_get_decoded_value (struct value *value)
{ {
struct type *type = ada_check_typedef (value_type (value)); struct type *type = ada_check_typedef (value->type ());
if (ada_is_array_descriptor_type (type) if (ada_is_array_descriptor_type (type)
|| (ada_is_constrained_packed_array_type (type) || (ada_is_constrained_packed_array_type (type)
@ -1756,7 +1756,7 @@ thin_descriptor_type (struct type *type)
static struct value * static struct value *
thin_data_pntr (struct value *val) thin_data_pntr (struct value *val)
{ {
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
struct type *data_type = desc_data_target_type (thin_descriptor_type (type)); struct type *data_type = desc_data_target_type (thin_descriptor_type (type));
data_type = lookup_pointer_type (data_type); data_type = lookup_pointer_type (data_type);
@ -1813,7 +1813,7 @@ desc_bounds_type (struct type *type)
static struct value * static struct value *
desc_bounds (struct value *arr) desc_bounds (struct value *arr)
{ {
struct type *type = ada_check_typedef (value_type (arr)); struct type *type = ada_check_typedef (arr->type ());
if (is_thin_pntr (type)) if (is_thin_pntr (type))
{ {
@ -1841,7 +1841,7 @@ desc_bounds (struct value *arr)
{ {
struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL, struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
_("Bad GNAT array descriptor")); _("Bad GNAT array descriptor"));
struct type *p_bounds_type = value_type (p_bounds); struct type *p_bounds_type = p_bounds->type ();
if (p_bounds_type if (p_bounds_type
&& p_bounds_type->code () == TYPE_CODE_PTR) && p_bounds_type->code () == TYPE_CODE_PTR)
@ -1916,7 +1916,7 @@ desc_data_target_type (struct type *type)
static struct value * static struct value *
desc_data (struct value *arr) desc_data (struct value *arr)
{ {
struct type *type = value_type (arr); struct type *type = arr->type ();
if (is_thin_pntr (type)) if (is_thin_pntr (type))
return thin_data_pntr (arr); return thin_data_pntr (arr);
@ -2105,20 +2105,20 @@ ada_is_bogus_array_descriptor (struct type *type)
static struct type * static struct type *
ada_type_of_array (struct value *arr, int bounds) ada_type_of_array (struct value *arr, int bounds)
{ {
if (ada_is_constrained_packed_array_type (value_type (arr))) if (ada_is_constrained_packed_array_type (arr->type ()))
return decode_constrained_packed_array_type (value_type (arr)); return decode_constrained_packed_array_type (arr->type ());
if (!ada_is_array_descriptor_type (value_type (arr))) if (!ada_is_array_descriptor_type (arr->type ()))
return value_type (arr); return arr->type ();
if (!bounds) if (!bounds)
{ {
struct type *array_type = struct type *array_type =
ada_check_typedef (desc_data_target_type (value_type (arr))); ada_check_typedef (desc_data_target_type (arr->type ()));
if (ada_is_unconstrained_packed_array_type (value_type (arr))) if (ada_is_unconstrained_packed_array_type (arr->type ()))
TYPE_FIELD_BITSIZE (array_type, 0) = TYPE_FIELD_BITSIZE (array_type, 0) =
decode_packed_array_bitsize (value_type (arr)); decode_packed_array_bitsize (arr->type ());
return array_type; return array_type;
} }
@ -2128,29 +2128,29 @@ ada_type_of_array (struct value *arr, int bounds)
int arity; int arity;
struct value *descriptor; struct value *descriptor;
elt_type = ada_array_element_type (value_type (arr), -1); elt_type = ada_array_element_type (arr->type (), -1);
arity = ada_array_arity (value_type (arr)); arity = ada_array_arity (arr->type ());
if (elt_type == NULL || arity == 0) if (elt_type == NULL || arity == 0)
return ada_check_typedef (value_type (arr)); return ada_check_typedef (arr->type ());
descriptor = desc_bounds (arr); descriptor = desc_bounds (arr);
if (value_as_long (descriptor) == 0) if (value_as_long (descriptor) == 0)
return NULL; return NULL;
while (arity > 0) while (arity > 0)
{ {
struct type *range_type = alloc_type_copy (value_type (arr)); struct type *range_type = alloc_type_copy (arr->type ());
struct type *array_type = alloc_type_copy (value_type (arr)); struct type *array_type = alloc_type_copy (arr->type ());
struct value *low = desc_one_bound (descriptor, arity, 0); struct value *low = desc_one_bound (descriptor, arity, 0);
struct value *high = desc_one_bound (descriptor, arity, 1); struct value *high = desc_one_bound (descriptor, arity, 1);
arity -= 1; arity -= 1;
create_static_range_type (range_type, value_type (low), create_static_range_type (range_type, low->type (),
longest_to_int (value_as_long (low)), longest_to_int (value_as_long (low)),
longest_to_int (value_as_long (high))); longest_to_int (value_as_long (high)));
elt_type = create_array_type (array_type, elt_type, range_type); elt_type = create_array_type (array_type, elt_type, range_type);
if (ada_is_unconstrained_packed_array_type (value_type (arr))) if (ada_is_unconstrained_packed_array_type (arr->type ()))
{ {
/* We need to store the element packed bitsize, as well as /* We need to store the element packed bitsize, as well as
recompute the array size, because it was previously recompute the array size, because it was previously
@ -2159,7 +2159,7 @@ ada_type_of_array (struct value *arr, int bounds)
LONGEST hi = value_as_long (high); LONGEST hi = value_as_long (high);
TYPE_FIELD_BITSIZE (elt_type, 0) = TYPE_FIELD_BITSIZE (elt_type, 0) =
decode_packed_array_bitsize (value_type (arr)); decode_packed_array_bitsize (arr->type ());
/* If the array has no element, then the size is already /* If the array has no element, then the size is already
zero, and does not need to be recomputed. */ zero, and does not need to be recomputed. */
if (lo < hi) if (lo < hi)
@ -2184,7 +2184,7 @@ ada_type_of_array (struct value *arr, int bounds)
struct value * struct value *
ada_coerce_to_simple_array_ptr (struct value *arr) ada_coerce_to_simple_array_ptr (struct value *arr)
{ {
if (ada_is_array_descriptor_type (value_type (arr))) if (ada_is_array_descriptor_type (arr->type ()))
{ {
struct type *arrType = ada_type_of_array (arr, 1); struct type *arrType = ada_type_of_array (arr, 1);
@ -2192,7 +2192,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr)
return NULL; return NULL;
return value_cast (arrType, value_copy (desc_data (arr))); return value_cast (arrType, value_copy (desc_data (arr)));
} }
else if (ada_is_constrained_packed_array_type (value_type (arr))) else if (ada_is_constrained_packed_array_type (arr->type ()))
return decode_constrained_packed_array (arr); return decode_constrained_packed_array (arr);
else else
return arr; return arr;
@ -2205,7 +2205,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr)
struct value * struct value *
ada_coerce_to_simple_array (struct value *arr) ada_coerce_to_simple_array (struct value *arr)
{ {
if (ada_is_array_descriptor_type (value_type (arr))) if (ada_is_array_descriptor_type (arr->type ()))
{ {
struct value *arrVal = ada_coerce_to_simple_array_ptr (arr); struct value *arrVal = ada_coerce_to_simple_array_ptr (arr);
@ -2213,7 +2213,7 @@ ada_coerce_to_simple_array (struct value *arr)
error (_("Bounds unavailable for null array pointer.")); error (_("Bounds unavailable for null array pointer."));
return value_ind (arrVal); return value_ind (arrVal);
} }
else if (ada_is_constrained_packed_array_type (value_type (arr))) else if (ada_is_constrained_packed_array_type (arr->type ()))
return decode_constrained_packed_array (arr); return decode_constrained_packed_array (arr);
else else
return arr; return arr;
@ -2501,10 +2501,10 @@ decode_constrained_packed_array (struct value *arr)
and "value_ind" routines to perform the dereferencing, as opposed and "value_ind" routines to perform the dereferencing, as opposed
to using "ada_coerce_ref" or "ada_value_ind". */ to using "ada_coerce_ref" or "ada_value_ind". */
arr = coerce_ref (arr); arr = coerce_ref (arr);
if (ada_check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) if (ada_check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
arr = value_ind (arr); arr = value_ind (arr);
type = decode_constrained_packed_array_type (value_type (arr)); type = decode_constrained_packed_array_type (arr->type ());
if (type == NULL) if (type == NULL)
{ {
error (_("can't unpack array")); error (_("can't unpack array"));
@ -2523,8 +2523,8 @@ decode_constrained_packed_array (struct value *arr)
type = resolve_dynamic_type (type, view, address); type = resolve_dynamic_type (type, view, address);
recursively_update_array_bitsize (type); recursively_update_array_bitsize (type);
if (type_byte_order (value_type (arr)) == BFD_ENDIAN_BIG if (type_byte_order (arr->type ()) == BFD_ENDIAN_BIG
&& ada_is_modular_type (value_type (arr))) && ada_is_modular_type (arr->type ()))
{ {
/* This is a (right-justified) modular type representing a packed /* This is a (right-justified) modular type representing a packed
array with no wrapper. In order to interpret the value through array with no wrapper. In order to interpret the value through
@ -2533,14 +2533,14 @@ decode_constrained_packed_array (struct value *arr)
int bit_size, bit_pos; int bit_size, bit_pos;
ULONGEST mod; ULONGEST mod;
mod = ada_modulus (value_type (arr)) - 1; mod = ada_modulus (arr->type ()) - 1;
bit_size = 0; bit_size = 0;
while (mod > 0) while (mod > 0)
{ {
bit_size += 1; bit_size += 1;
mod >>= 1; mod >>= 1;
} }
bit_pos = HOST_CHAR_BIT * value_type (arr)->length () - bit_size; bit_pos = HOST_CHAR_BIT * arr->type ()->length () - bit_size;
arr = ada_value_primitive_packed_val (arr, NULL, arr = ada_value_primitive_packed_val (arr, NULL,
bit_pos / HOST_CHAR_BIT, bit_pos / HOST_CHAR_BIT,
bit_pos % HOST_CHAR_BIT, bit_pos % HOST_CHAR_BIT,
@ -2566,7 +2566,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
bits = 0; bits = 0;
elt_total_bit_offset = 0; elt_total_bit_offset = 0;
elt_type = ada_check_typedef (value_type (arr)); elt_type = ada_check_typedef (arr->type ());
for (i = 0; i < arity; i += 1) for (i = 0; i < arity; i += 1)
{ {
if (elt_type->code () != TYPE_CODE_ARRAY if (elt_type->code () != TYPE_CODE_ARRAY
@ -2877,15 +2877,15 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
static struct value * static struct value *
ada_value_assign (struct value *toval, struct value *fromval) ada_value_assign (struct value *toval, struct value *fromval)
{ {
struct type *type = value_type (toval); struct type *type = toval->type ();
int bits = value_bitsize (toval); int bits = value_bitsize (toval);
toval = ada_coerce_ref (toval); toval = ada_coerce_ref (toval);
fromval = ada_coerce_ref (fromval); fromval = ada_coerce_ref (fromval);
if (ada_is_direct_array_type (value_type (toval))) if (ada_is_direct_array_type (toval->type ()))
toval = ada_coerce_to_simple_array (toval); toval = ada_coerce_to_simple_array (toval);
if (ada_is_direct_array_type (value_type (fromval))) if (ada_is_direct_array_type (fromval->type ()))
fromval = ada_coerce_to_simple_array (fromval); fromval = ada_coerce_to_simple_array (fromval);
if (!deprecated_value_modifiable (toval)) if (!deprecated_value_modifiable (toval))
@ -2909,11 +2909,11 @@ ada_value_assign (struct value *toval, struct value *fromval)
read_memory (to_addr, buffer, len); read_memory (to_addr, buffer, len);
from_size = value_bitsize (fromval); from_size = value_bitsize (fromval);
if (from_size == 0) if (from_size == 0)
from_size = value_type (fromval)->length () * TARGET_CHAR_BIT; from_size = fromval->type ()->length () * TARGET_CHAR_BIT;
const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG; const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
ULONGEST from_offset = 0; ULONGEST from_offset = 0;
if (is_big_endian && is_scalar_type (value_type (fromval))) if (is_big_endian && is_scalar_type (fromval->type ()))
from_offset = from_size - bits; from_offset = from_size - bits;
copy_bitwise (buffer, value_bitpos (toval), copy_bitwise (buffer, value_bitpos (toval),
value_contents (fromval).data (), from_offset, value_contents (fromval).data (), from_offset,
@ -2954,20 +2954,20 @@ value_assign_to_component (struct value *container, struct value *component,
value_bitpos (component) - value_bitpos (container); value_bitpos (component) - value_bitpos (container);
int bits; int bits;
val = value_cast (value_type (component), val); val = value_cast (component->type (), val);
if (value_bitsize (component) == 0) if (value_bitsize (component) == 0)
bits = TARGET_CHAR_BIT * value_type (component)->length (); bits = TARGET_CHAR_BIT * component->type ()->length ();
else else
bits = value_bitsize (component); bits = value_bitsize (component);
if (type_byte_order (value_type (container)) == BFD_ENDIAN_BIG) if (type_byte_order (container->type ()) == BFD_ENDIAN_BIG)
{ {
int src_offset; int src_offset;
if (is_scalar_type (check_typedef (value_type (component)))) if (is_scalar_type (check_typedef (component->type ())))
src_offset src_offset
= value_type (component)->length () * TARGET_CHAR_BIT - bits; = component->type ()->length () * TARGET_CHAR_BIT - bits;
else else
src_offset = 0; src_offset = 0;
copy_bitwise ((value_contents_writeable (container).data () copy_bitwise ((value_contents_writeable (container).data ()
@ -3004,7 +3004,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
elt = ada_coerce_to_simple_array (arr); elt = ada_coerce_to_simple_array (arr);
elt_type = ada_check_typedef (value_type (elt)); elt_type = ada_check_typedef (elt->type ());
if (elt_type->code () == TYPE_CODE_ARRAY if (elt_type->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (elt_type, 0) > 0) && TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
return value_subscript_packed (elt, arity, ind); return value_subscript_packed (elt, arity, ind);
@ -3019,7 +3019,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
elt = value_subscript (elt, pos_atr (ind[k])); elt = value_subscript (elt, pos_atr (ind[k]));
if (ada_is_access_to_unconstrained_array (saved_elt_type) if (ada_is_access_to_unconstrained_array (saved_elt_type)
&& value_type (elt)->code () != TYPE_CODE_TYPEDEF) && elt->type ()->code () != TYPE_CODE_TYPEDEF)
{ {
/* The element is a typedef to an unconstrained array, /* The element is a typedef to an unconstrained array,
except that the value_subscript call stripped the except that the value_subscript call stripped the
@ -3036,7 +3036,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
deprecated_set_value_type (elt, saved_elt_type); deprecated_set_value_type (elt, saved_elt_type);
} }
elt_type = ada_check_typedef (value_type (elt)); elt_type = ada_check_typedef (elt->type ());
} }
return elt; return elt;
@ -3124,7 +3124,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
static struct value * static struct value *
ada_value_slice (struct value *array, int low, int high) ada_value_slice (struct value *array, int low, int high)
{ {
struct type *type = ada_check_typedef (value_type (array)); struct type *type = ada_check_typedef (array->type ());
struct type *base_index_type = type->index_type ()->target_type (); struct type *base_index_type = type->index_type ()->target_type ();
struct type *index_type struct type *index_type
= create_static_range_type (NULL, type->index_type (), low, high); = create_static_range_type (NULL, type->index_type (), low, high);
@ -3332,7 +3332,7 @@ ada_array_bound (struct value *arr, int n, int which)
{ {
struct type *arr_type; struct type *arr_type;
if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
arr = value_ind (arr); arr = value_ind (arr);
arr_type = value_enclosing_type (arr); arr_type = value_enclosing_type (arr);
@ -3356,7 +3356,7 @@ ada_array_length (struct value *arr, int n)
struct type *arr_type, *index_type; struct type *arr_type, *index_type;
int low, high; int low, high;
if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR) if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
arr = value_ind (arr); arr = value_ind (arr);
arr_type = value_enclosing_type (arr); arr_type = value_enclosing_type (arr);
@ -3984,7 +3984,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
else else
{ {
struct type *ftype = ada_check_typedef (func_type->field (i).type ()); struct type *ftype = ada_check_typedef (func_type->field (i).type ());
struct type *atype = ada_check_typedef (value_type (actuals[i])); struct type *atype = ada_check_typedef (actuals[i]->type ());
if (!ada_type_match (ftype, atype)) if (!ada_type_match (ftype, atype))
return 0; return 0;
@ -4185,9 +4185,9 @@ static int
possible_user_operator_p (enum exp_opcode op, struct value *args[]) possible_user_operator_p (enum exp_opcode op, struct value *args[])
{ {
struct type *type0 = struct type *type0 =
(args[0] == NULL) ? NULL : ada_check_typedef (value_type (args[0])); (args[0] == NULL) ? NULL : ada_check_typedef (args[0]->type ());
struct type *type1 = struct type *type1 =
(args[1] == NULL) ? NULL : ada_check_typedef (value_type (args[1])); (args[1] == NULL) ? NULL : ada_check_typedef (args[1]->type ());
if (type0 == NULL) if (type0 == NULL)
return 0; return 0;
@ -4352,7 +4352,7 @@ ensure_lval (struct value *val)
if (VALUE_LVAL (val) == not_lval if (VALUE_LVAL (val) == not_lval
|| VALUE_LVAL (val) == lval_internalvar) || VALUE_LVAL (val) == lval_internalvar)
{ {
int len = ada_check_typedef (value_type (val))->length (); int len = ada_check_typedef (val->type ())->length ();
const CORE_ADDR addr = const CORE_ADDR addr =
value_as_long (value_allocate_space_in_inferior (len)); value_as_long (value_allocate_space_in_inferior (len));
@ -4384,7 +4384,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
int check_tag; int check_tag;
v = NULL; v = NULL;
t1 = t = ada_check_typedef (value_type (arg)); t1 = t = ada_check_typedef (arg->type ());
if (t->code () == TYPE_CODE_REF) if (t->code () == TYPE_CODE_REF)
{ {
t1 = t->target_type (); t1 = t->target_type ();
@ -4459,7 +4459,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
/* Resolve the dynamic type as well. */ /* Resolve the dynamic type as well. */
arg = value_from_contents_and_address (t1, nullptr, address); arg = value_from_contents_and_address (t1, nullptr, address);
t1 = value_type (arg); t1 = arg->type ();
if (find_struct_field (name, t1, 0, if (find_struct_field (name, t1, 0,
&field_type, &byte_offset, &bit_offset, &field_type, &byte_offset, &bit_offset,
@ -4501,7 +4501,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
struct value * struct value *
ada_convert_actual (struct value *actual, struct type *formal_type0) ada_convert_actual (struct value *actual, struct type *formal_type0)
{ {
struct type *actual_type = ada_check_typedef (value_type (actual)); struct type *actual_type = ada_check_typedef (actual->type ());
struct type *formal_type = ada_check_typedef (formal_type0); struct type *formal_type = ada_check_typedef (formal_type0);
struct type *formal_target = struct type *formal_target =
formal_type->code () == TYPE_CODE_PTR formal_type->code () == TYPE_CODE_PTR
@ -4527,7 +4527,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
{ {
struct value *val; struct value *val;
actual_type = ada_check_typedef (value_type (actual)); actual_type = ada_check_typedef (actual->type ());
val = allocate_value (actual_type); val = allocate_value (actual_type);
copy (value_contents (actual), value_contents_raw (val)); copy (value_contents (actual), value_contents_raw (val));
actual = ensure_lval (val); actual = ensure_lval (val);
@ -4588,15 +4588,15 @@ make_array_descriptor (struct type *type, struct value *arr)
struct value *bounds = allocate_value (bounds_type); struct value *bounds = allocate_value (bounds_type);
int i; int i;
for (i = ada_array_arity (ada_check_typedef (value_type (arr))); for (i = ada_array_arity (ada_check_typedef (arr->type ()));
i > 0; i -= 1) i > 0; i -= 1)
{ {
modify_field (value_type (bounds), modify_field (bounds->type (),
value_contents_writeable (bounds).data (), value_contents_writeable (bounds).data (),
ada_array_bound (arr, i, 0), ada_array_bound (arr, i, 0),
desc_bound_bitpos (bounds_type, i, 0), desc_bound_bitpos (bounds_type, i, 0),
desc_bound_bitsize (bounds_type, i, 0)); desc_bound_bitsize (bounds_type, i, 0));
modify_field (value_type (bounds), modify_field (bounds->type (),
value_contents_writeable (bounds).data (), value_contents_writeable (bounds).data (),
ada_array_bound (arr, i, 1), ada_array_bound (arr, i, 1),
desc_bound_bitpos (bounds_type, i, 1), desc_bound_bitpos (bounds_type, i, 1),
@ -4605,14 +4605,14 @@ make_array_descriptor (struct type *type, struct value *arr)
bounds = ensure_lval (bounds); bounds = ensure_lval (bounds);
modify_field (value_type (descriptor), modify_field (descriptor->type (),
value_contents_writeable (descriptor).data (), value_contents_writeable (descriptor).data (),
value_pointer (ensure_lval (arr), value_pointer (ensure_lval (arr),
desc_type->field (0).type ()), desc_type->field (0).type ()),
fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type)); fat_pntr_data_bitsize (desc_type));
modify_field (value_type (descriptor), modify_field (descriptor->type (),
value_contents_writeable (descriptor).data (), value_contents_writeable (descriptor).data (),
value_pointer (bounds, value_pointer (bounds,
desc_type->field (1).type ()), desc_type->field (1).type ()),
@ -6361,7 +6361,7 @@ ada_is_tag_type (struct type *type)
static struct type * static struct type *
ada_tag_type (struct value *val) ada_tag_type (struct value *val)
{ {
return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0); return ada_lookup_struct_elt_type (val->type (), "_tag", 1, 0);
} }
/* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95, /* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95,
@ -6435,7 +6435,7 @@ ada_tag_value_at_base_address (struct value *obj)
struct value *tag; struct value *tag;
CORE_ADDR base_address; CORE_ADDR base_address;
obj_type = value_type (obj); obj_type = obj->type ();
/* It is the responsability of the caller to deref pointers. */ /* It is the responsability of the caller to deref pointers. */
@ -6618,7 +6618,7 @@ ada_tag_name (struct value *tag)
{ {
gdb::unique_xmalloc_ptr<char> name; gdb::unique_xmalloc_ptr<char> name;
if (!ada_is_tag_type (value_type (tag))) if (!ada_is_tag_type (tag->type ()))
return NULL; return NULL;
/* It is perfectly possible that an exception be raised while trying /* It is perfectly possible that an exception be raised while trying
@ -7513,7 +7513,7 @@ ada_value_ind (struct value *val0)
{ {
struct value *val = value_ind (val0); struct value *val = value_ind (val0);
if (ada_is_tagged_type (value_type (val), 0)) if (ada_is_tagged_type (val->type (), 0))
val = ada_tag_value_at_base_address (val); val = ada_tag_value_at_base_address (val);
return ada_to_fixed_value (val); return ada_to_fixed_value (val);
@ -7525,13 +7525,13 @@ ada_value_ind (struct value *val0)
static struct value * static struct value *
ada_coerce_ref (struct value *val0) ada_coerce_ref (struct value *val0)
{ {
if (value_type (val0)->code () == TYPE_CODE_REF) if (val0->type ()->code () == TYPE_CODE_REF)
{ {
struct value *val = val0; struct value *val = val0;
val = coerce_ref (val); val = coerce_ref (val);
if (ada_is_tagged_type (value_type (val), 0)) if (ada_is_tagged_type (val->type (), 0))
val = ada_tag_value_at_base_address (val); val = ada_tag_value_at_base_address (val);
return ada_to_fixed_value (val); return ada_to_fixed_value (val);
@ -7832,7 +7832,7 @@ empty_record (struct type *templ)
the value of type TYPE at VALADDR or ADDRESS (see comments at the value of type TYPE at VALADDR or ADDRESS (see comments at
the beginning of this section) VAL according to GNAT conventions. the beginning of this section) VAL according to GNAT conventions.
DVAL0 should describe the (portion of a) record that contains any DVAL0 should describe the (portion of a) record that contains any
necessary discriminants. It should be NULL if value_type (VAL) is necessary discriminants. It should be NULL if VAL->type () is
an outer-level type (i.e., as opposed to a branch of a variant.) A an outer-level type (i.e., as opposed to a branch of a variant.) A
variant field (unless unchecked) is replaced by a particular branch variant field (unless unchecked) is replaced by a particular branch
of the variant. of the variant.
@ -7915,7 +7915,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
dval = value_from_contents_and_address_unresolved (rtype, dval = value_from_contents_and_address_unresolved (rtype,
valaddr, valaddr,
address); address);
rtype = value_type (dval); rtype = dval->type ();
} }
else else
dval = dval0; dval = dval0;
@ -8014,7 +8014,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
that is currently being constructed. */ that is currently being constructed. */
dval = value_from_contents_and_address_unresolved (rtype, valaddr, dval = value_from_contents_and_address_unresolved (rtype, valaddr,
address); address);
rtype = value_type (dval); rtype = dval->type ();
} }
else else
dval = dval0; dval = dval0;
@ -8175,7 +8175,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
if (dval0 == NULL) if (dval0 == NULL)
{ {
dval = value_from_contents_and_address (type, valaddr, address); dval = value_from_contents_and_address (type, valaddr, address);
type = value_type (dval); type = dval->type ();
} }
else else
dval = dval0; dval = dval0;
@ -8296,7 +8296,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
if (templ_type != NULL) if (templ_type != NULL)
var_type = templ_type; var_type = templ_type;
if (is_unchecked_variant (var_type, value_type (dval))) if (is_unchecked_variant (var_type, dval->type ()))
return var_type0; return var_type0;
which = ada_which_variant_applies (var_type, dval); which = ada_which_variant_applies (var_type, dval);
@ -8587,7 +8587,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
value_from_contents_and_address (fixed_record_type, value_from_contents_and_address (fixed_record_type,
valaddr, valaddr,
address); address);
fixed_record_type = value_type (obj); fixed_record_type = obj->type ();
if (real_type != NULL) if (real_type != NULL)
return to_fixed_record_type return to_fixed_record_type
(real_type, NULL, (real_type, NULL,
@ -8860,7 +8860,7 @@ struct value *
ada_to_fixed_value (struct value *val) ada_to_fixed_value (struct value *val)
{ {
val = unwrap_value (val); val = unwrap_value (val);
val = ada_to_fixed_value_create (value_type (val), value_address (val), val); val = ada_to_fixed_value_create (val->type (), value_address (val), val);
return val; return val;
} }
@ -8902,7 +8902,7 @@ static LONGEST
pos_atr (struct value *arg) pos_atr (struct value *arg)
{ {
struct value *val = coerce_ref (arg); struct value *val = coerce_ref (arg);
struct type *type = value_type (val); struct type *type = val->type ();
if (!discrete_type_p (type)) if (!discrete_type_p (type))
error (_("'POS only defined on discrete types")); error (_("'POS only defined on discrete types"));
@ -8951,7 +8951,7 @@ ada_val_atr (enum noside noside, struct type *type, struct value *arg)
if (!discrete_type_p (type)) if (!discrete_type_p (type))
error (_("'VAL only defined on discrete types")); error (_("'VAL only defined on discrete types"));
if (!integer_type_p (value_type (arg))) if (!integer_type_p (arg->type ()))
error (_("'VAL requires integral argument")); error (_("'VAL requires integral argument"));
return val_atr (type, value_as_long (arg)); return val_atr (type, value_as_long (arg));
@ -9199,12 +9199,12 @@ ada_enum_name (const char *name)
static struct value * static struct value *
unwrap_value (struct value *val) unwrap_value (struct value *val)
{ {
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
if (ada_is_aligner_type (type)) if (ada_is_aligner_type (type))
{ {
struct value *v = ada_value_struct_elt (val, "F", 0); struct value *v = ada_value_struct_elt (val, "F", 0);
struct type *val_type = ada_check_typedef (value_type (v)); struct type *val_type = ada_check_typedef (v->type ());
if (ada_type_name (val_type) == NULL) if (ada_type_name (val_type) == NULL)
val_type->set_name (ada_type_name (type)); val_type->set_name (ada_type_name (type));
@ -9273,10 +9273,10 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
of type's element. */ of type's element. */
gdb_assert (type->code () == TYPE_CODE_ARRAY); gdb_assert (type->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (type->target_type ())); gdb_assert (is_integral_type (type->target_type ()));
gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY); gdb_assert (val->type ()->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (value_type (val)->target_type ())); gdb_assert (is_integral_type (val->type ()->target_type ()));
gdb_assert (type->target_type ()->length () gdb_assert (type->target_type ()->length ()
> value_type (val)->target_type ()->length ()); > val->type ()->target_type ()->length ());
if (!get_array_bounds (type, &lo, &hi)) if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds")); error (_("unable to determine array bounds"));
@ -9302,7 +9302,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
static struct value * static struct value *
coerce_for_assign (struct type *type, struct value *val) coerce_for_assign (struct type *type, struct value *val)
{ {
struct type *type2 = value_type (val); struct type *type2 = val->type ();
if (type == type2) if (type == type2)
return val; return val;
@ -9314,7 +9314,7 @@ coerce_for_assign (struct type *type, struct value *val)
&& type->code () == TYPE_CODE_ARRAY) && type->code () == TYPE_CODE_ARRAY)
{ {
val = ada_value_ind (val); val = ada_value_ind (val);
type2 = value_type (val); type2 = val->type ();
} }
if (type2->code () == TYPE_CODE_ARRAY if (type2->code () == TYPE_CODE_ARRAY
@ -9348,8 +9348,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
arg2 = coerce_ref (arg2); arg2 = coerce_ref (arg2);
type1 = get_base_type (ada_check_typedef (value_type (arg1))); type1 = get_base_type (ada_check_typedef (arg1->type ()));
type2 = get_base_type (ada_check_typedef (value_type (arg2))); type2 = get_base_type (ada_check_typedef (arg2->type ()));
if (type1->code () != TYPE_CODE_INT if (type1->code () != TYPE_CODE_INT
|| type2->code () != TYPE_CODE_INT) || type2->code () != TYPE_CODE_INT)
@ -9405,7 +9405,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (type1); val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val).data (), store_unsigned_integer (value_contents_raw (val).data (),
value_type (val)->length (), val->type ()->length (),
type_byte_order (type1), v); type_byte_order (type1), v);
return val; return val;
} }
@ -9413,8 +9413,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
static int static int
ada_value_equal (struct value *arg1, struct value *arg2) ada_value_equal (struct value *arg1, struct value *arg2)
{ {
if (ada_is_direct_array_type (value_type (arg1)) if (ada_is_direct_array_type (arg1->type ())
|| ada_is_direct_array_type (value_type (arg2))) || ada_is_direct_array_type (arg2->type ()))
{ {
struct type *arg1_type, *arg2_type; struct type *arg1_type, *arg2_type;
@ -9426,8 +9426,8 @@ ada_value_equal (struct value *arg1, struct value *arg2)
arg1 = ada_coerce_to_simple_array (arg1); arg1 = ada_coerce_to_simple_array (arg1);
arg2 = ada_coerce_to_simple_array (arg2); arg2 = ada_coerce_to_simple_array (arg2);
arg1_type = ada_check_typedef (value_type (arg1)); arg1_type = ada_check_typedef (arg1->type ());
arg2_type = ada_check_typedef (value_type (arg2)); arg2_type = ada_check_typedef (arg2->type ());
if (arg1_type->code () != TYPE_CODE_ARRAY if (arg1_type->code () != TYPE_CODE_ARRAY
|| arg2_type->code () != TYPE_CODE_ARRAY) || arg2_type->code () != TYPE_CODE_ARRAY)
@ -9465,7 +9465,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
scoped_value_mark mark; scoped_value_mark mark;
struct value *elt; struct value *elt;
struct type *lhs_type = check_typedef (value_type (lhs)); struct type *lhs_type = check_typedef (lhs->type ());
if (lhs_type->code () == TYPE_CODE_ARRAY) if (lhs_type->code () == TYPE_CODE_ARRAY)
{ {
@ -9476,7 +9476,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
} }
else else
{ {
elt = ada_index_struct_field (index, lhs, 0, value_type (lhs)); elt = ada_index_struct_field (index, lhs, 0, lhs->type ());
elt = ada_to_fixed_value (elt); elt = ada_to_fixed_value (elt);
} }
@ -9528,17 +9528,17 @@ ada_aggregate_operation::assign_aggregate (struct value *container,
LONGEST low_index, high_index; LONGEST low_index, high_index;
container = ada_coerce_ref (container); container = ada_coerce_ref (container);
if (ada_is_direct_array_type (value_type (container))) if (ada_is_direct_array_type (container->type ()))
container = ada_coerce_to_simple_array (container); container = ada_coerce_to_simple_array (container);
lhs = ada_coerce_ref (lhs); lhs = ada_coerce_ref (lhs);
if (!deprecated_value_modifiable (lhs)) if (!deprecated_value_modifiable (lhs))
error (_("Left operand of assignment is not a modifiable lvalue.")); error (_("Left operand of assignment is not a modifiable lvalue."));
lhs_type = check_typedef (value_type (lhs)); lhs_type = check_typedef (lhs->type ());
if (ada_is_direct_array_type (lhs_type)) if (ada_is_direct_array_type (lhs_type))
{ {
lhs = ada_coerce_to_simple_array (lhs); lhs = ada_coerce_to_simple_array (lhs);
lhs_type = check_typedef (value_type (lhs)); lhs_type = check_typedef (lhs->type ());
low_index = lhs_type->bounds ()->low.const_val (); low_index = lhs_type->bounds ()->low.const_val ();
high_index = lhs_type->bounds ()->high.const_val (); high_index = lhs_type->bounds ()->high.const_val ();
} }
@ -9654,7 +9654,7 @@ ada_name_association::assign (struct value *container,
{ {
int index; int index;
if (ada_is_direct_array_type (value_type (lhs))) if (ada_is_direct_array_type (lhs->type ()))
index = longest_to_int (value_as_long (m_val->evaluate (nullptr, exp, index = longest_to_int (value_as_long (m_val->evaluate (nullptr, exp,
EVAL_NORMAL))); EVAL_NORMAL)));
else else
@ -9675,7 +9675,7 @@ ada_name_association::assign (struct value *container,
} }
index = 0; index = 0;
if (! find_struct_field (name, value_type (lhs), 0, if (! find_struct_field (name, lhs->type (), 0,
NULL, NULL, NULL, NULL, &index)) NULL, NULL, NULL, NULL, &index))
error (_("Unknown component name: %s."), name); error (_("Unknown component name: %s."), name);
} }
@ -9770,7 +9770,7 @@ ada_assign_operation::evaluate (struct type *expect_type,
except if the lhs of our assignment is a convenience variable. except if the lhs of our assignment is a convenience variable.
In the case of assigning to a convenience variable, the lhs In the case of assigning to a convenience variable, the lhs
should be exactly the result of the evaluation of the rhs. */ should be exactly the result of the evaluation of the rhs. */
struct type *type = value_type (arg1); struct type *type = arg1->type ();
if (VALUE_LVAL (arg1) == lval_internalvar) if (VALUE_LVAL (arg1) == lval_internalvar)
type = NULL; type = NULL;
value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside); value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside);
@ -9781,7 +9781,7 @@ ada_assign_operation::evaluate (struct type *expect_type,
/* Nothing. */ /* Nothing. */
} }
else else
arg2 = coerce_for_assign (value_type (arg1), arg2); arg2 = coerce_for_assign (arg1->type (), arg2);
return ada_value_assign (arg1, arg2); return ada_value_assign (arg1, arg2);
} }
@ -9831,7 +9831,7 @@ add_component_interval (LONGEST low, LONGEST high,
static struct value * static struct value *
ada_value_cast (struct type *type, struct value *arg2) ada_value_cast (struct type *type, struct value *arg2)
{ {
if (type == ada_check_typedef (value_type (arg2))) if (type == ada_check_typedef (arg2->type ()))
return arg2; return arg2;
return value_cast (type, arg2); return value_cast (type, arg2);
@ -10177,7 +10177,7 @@ ada_atr_size (struct type *expect_type,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
/* If the argument is a reference, then dereference its type, since /* If the argument is a reference, then dereference its type, since
the user is really asking for the size of the actual object, the user is really asking for the size of the actual object,
@ -10201,7 +10201,7 @@ ada_abs (struct type *expect_type,
struct value *arg1) struct value *arg1)
{ {
unop_promote (exp->language_defn, exp->gdbarch, &arg1); unop_promote (exp->language_defn, exp->gdbarch, &arg1);
if (value_less (arg1, value_zero (value_type (arg1), not_lval))) if (value_less (arg1, value_zero (arg1->type (), not_lval)))
return value_neg (arg1); return value_neg (arg1);
else else
return arg1; return arg1;
@ -10218,7 +10218,7 @@ ada_mult_binop (struct type *expect_type,
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_zero (value_type (arg1), not_lval); return value_zero (arg1->type (), not_lval);
} }
else else
{ {
@ -10267,24 +10267,24 @@ ada_ternop_slice (struct expression *exp,
/* If this is a reference to an aligner type, then remove all /* If this is a reference to an aligner type, then remove all
the aligners. */ the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF if (array->type ()->code () == TYPE_CODE_REF
&& ada_is_aligner_type (value_type (array)->target_type ())) && ada_is_aligner_type (array->type ()->target_type ()))
value_type (array)->set_target_type array->type ()->set_target_type
(ada_aligned_type (value_type (array)->target_type ())); (ada_aligned_type (array->type ()->target_type ()));
if (ada_is_any_packed_array_type (value_type (array))) if (ada_is_any_packed_array_type (array->type ()))
error (_("cannot slice a packed array")); error (_("cannot slice a packed array"));
/* If this is a reference to an array or an array lvalue, /* If this is a reference to an array or an array lvalue,
convert to a pointer. */ convert to a pointer. */
if (value_type (array)->code () == TYPE_CODE_REF if (array->type ()->code () == TYPE_CODE_REF
|| (value_type (array)->code () == TYPE_CODE_ARRAY || (array->type ()->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (array) == lval_memory)) && VALUE_LVAL (array) == lval_memory))
array = value_addr (array); array = value_addr (array);
if (noside == EVAL_AVOID_SIDE_EFFECTS if (noside == EVAL_AVOID_SIDE_EFFECTS
&& ada_is_array_descriptor_type (ada_check_typedef && ada_is_array_descriptor_type (ada_check_typedef
(value_type (array)))) (array->type ())))
return empty_array (ada_type_of_array (array, 0), low_bound, return empty_array (ada_type_of_array (array, 0), low_bound,
high_bound); high_bound);
@ -10292,8 +10292,8 @@ ada_ternop_slice (struct expression *exp,
/* If we have more than one level of pointer indirection, /* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */ dereference the value until we get only one level. */
while (value_type (array)->code () == TYPE_CODE_PTR while (array->type ()->code () == TYPE_CODE_PTR
&& (value_type (array)->target_type ()->code () && (array->type ()->target_type ()->code ()
== TYPE_CODE_PTR)) == TYPE_CODE_PTR))
array = value_ind (array); array = value_ind (array);
@ -10301,13 +10301,13 @@ ada_ternop_slice (struct expression *exp,
to avoid a SEGV when trying to get the index type or the target to avoid a SEGV when trying to get the index type or the target
type later down the road if the debug info generated by type later down the road if the debug info generated by
the compiler is incorrect or incomplete. */ the compiler is incorrect or incomplete. */
if (!ada_is_simple_array_type (value_type (array))) if (!ada_is_simple_array_type (array->type ()))
error (_("cannot take slice of non-array")); error (_("cannot take slice of non-array"));
if (ada_check_typedef (value_type (array))->code () if (ada_check_typedef (array->type ())->code ()
== TYPE_CODE_PTR) == TYPE_CODE_PTR)
{ {
struct type *type0 = ada_check_typedef (value_type (array)); struct type *type0 = ada_check_typedef (array->type ());
if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS) if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
return empty_array (type0->target_type (), low_bound, high_bound); return empty_array (type0->target_type (), low_bound, high_bound);
@ -10324,7 +10324,7 @@ ada_ternop_slice (struct expression *exp,
else if (noside == EVAL_AVOID_SIDE_EFFECTS) else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return array; return array;
else if (high_bound < low_bound) else if (high_bound < low_bound)
return empty_array (value_type (array), low_bound, high_bound); return empty_array (array->type (), low_bound, high_bound);
else else
return ada_value_slice (array, longest_to_int (low_bound), return ada_value_slice (array, longest_to_int (low_bound),
longest_to_int (high_bound)); longest_to_int (high_bound));
@ -10343,9 +10343,9 @@ ada_binop_in_bounds (struct expression *exp, enum noside noside,
return value_zero (type, not_lval); return value_zero (type, not_lval);
} }
struct type *type = ada_index_type (value_type (arg2), n, "range"); struct type *type = ada_index_type (arg2->type (), n, "range");
if (!type) if (!type)
type = value_type (arg1); type = arg1->type ();
value *arg3 = value_from_longest (type, ada_array_bound (arg2, n, 1)); value *arg3 = value_from_longest (type, ada_array_bound (arg2, n, 1));
arg2 = value_from_longest (type, ada_array_bound (arg2, n, 0)); arg2 = value_from_longest (type, ada_array_bound (arg2, n, 0));
@ -10369,7 +10369,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
if (type_arg == NULL) if (type_arg == NULL)
type_arg = value_type (arg1); type_arg = arg1->type ();
if (ada_is_constrained_packed_array_type (type_arg)) if (ada_is_constrained_packed_array_type (type_arg))
type_arg = decode_constrained_packed_array_type (type_arg); type_arg = decode_constrained_packed_array_type (type_arg);
@ -10397,7 +10397,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
{ {
arg1 = ada_coerce_ref (arg1); arg1 = ada_coerce_ref (arg1);
if (ada_is_constrained_packed_array_type (value_type (arg1))) if (ada_is_constrained_packed_array_type (arg1->type ()))
arg1 = ada_coerce_to_simple_array (arg1); arg1 = ada_coerce_to_simple_array (arg1);
struct type *type; struct type *type;
@ -10405,7 +10405,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
type = builtin_type (exp->gdbarch)->builtin_int; type = builtin_type (exp->gdbarch)->builtin_int;
else else
{ {
type = ada_index_type (value_type (arg1), tem, type = ada_index_type (arg1->type (), tem,
ada_attribute_name (op)); ada_attribute_name (op));
if (type == NULL) if (type == NULL)
type = builtin_type (exp->gdbarch)->builtin_int; type = builtin_type (exp->gdbarch)->builtin_int;
@ -10496,7 +10496,7 @@ ada_binop_minmax (struct type *expect_type,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (value_type (arg1), not_lval); return value_zero (arg1->type (), not_lval);
else else
{ {
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@ -10513,12 +10513,12 @@ ada_binop_exp (struct type *expect_type,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (value_type (arg1), not_lval); return value_zero (arg1->type (), not_lval);
else else
{ {
/* For integer exponentiation operations, /* For integer exponentiation operations,
only promote the first argument. */ only promote the first argument. */
if (is_integral_type (value_type (arg2))) if (is_integral_type (arg2->type ()))
unop_promote (exp->language_defn, exp->gdbarch, &arg1); unop_promote (exp->language_defn, exp->gdbarch, &arg1);
else else
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@ -10723,12 +10723,12 @@ ada_concat_operation::evaluate (struct type *expect_type,
if (dynamic_cast<ada_string_operation *> (lhs_expr.get ()) != nullptr) if (dynamic_cast<ada_string_operation *> (lhs_expr.get ()) != nullptr)
{ {
rhs = rhs_expr->evaluate (nullptr, exp, noside); rhs = rhs_expr->evaluate (nullptr, exp, noside);
lhs = lhs_expr->evaluate (value_type (rhs), exp, noside); lhs = lhs_expr->evaluate (rhs->type (), exp, noside);
} }
else if (dynamic_cast<ada_char_operation *> (lhs_expr.get ()) != nullptr) else if (dynamic_cast<ada_char_operation *> (lhs_expr.get ()) != nullptr)
{ {
rhs = rhs_expr->evaluate (nullptr, exp, noside); rhs = rhs_expr->evaluate (nullptr, exp, noside);
struct type *rhs_type = check_typedef (value_type (rhs)); struct type *rhs_type = check_typedef (rhs->type ());
struct type *elt_type = nullptr; struct type *elt_type = nullptr;
if (rhs_type->code () == TYPE_CODE_ARRAY) if (rhs_type->code () == TYPE_CODE_ARRAY)
elt_type = rhs_type->target_type (); elt_type = rhs_type->target_type ();
@ -10737,12 +10737,12 @@ ada_concat_operation::evaluate (struct type *expect_type,
else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr) else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr)
{ {
lhs = lhs_expr->evaluate (nullptr, exp, noside); lhs = lhs_expr->evaluate (nullptr, exp, noside);
rhs = rhs_expr->evaluate (value_type (lhs), exp, noside); rhs = rhs_expr->evaluate (lhs->type (), exp, noside);
} }
else if (dynamic_cast<ada_char_operation *> (rhs_expr.get ()) != nullptr) else if (dynamic_cast<ada_char_operation *> (rhs_expr.get ()) != nullptr)
{ {
lhs = lhs_expr->evaluate (nullptr, exp, noside); lhs = lhs_expr->evaluate (nullptr, exp, noside);
struct type *lhs_type = check_typedef (value_type (lhs)); struct type *lhs_type = check_typedef (lhs->type ());
struct type *elt_type = nullptr; struct type *elt_type = nullptr;
if (lhs_type->code () == TYPE_CODE_ARRAY) if (lhs_type->code () == TYPE_CODE_ARRAY)
elt_type = lhs_type->target_type (); elt_type = lhs_type->target_type ();
@ -10789,18 +10789,18 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
return x - y; return x - y;
}; };
if (value_type (arg1)->code () == TYPE_CODE_PTR) if (arg1->type ()->code () == TYPE_CODE_PTR)
return (value_from_longest return (value_from_longest
(value_type (arg1), (arg1->type (),
do_op (value_as_long (arg1), value_as_long (arg2)))); do_op (value_as_long (arg1), value_as_long (arg2))));
if (value_type (arg2)->code () == TYPE_CODE_PTR) if (arg2->type ()->code () == TYPE_CODE_PTR)
return (value_from_longest return (value_from_longest
(value_type (arg2), (arg2->type (),
do_op (value_as_long (arg1), value_as_long (arg2)))); do_op (value_as_long (arg1), value_as_long (arg2))));
/* Preserve the original type for use by the range case below. /* Preserve the original type for use by the range case below.
We cannot cast the result to a reference type, so if ARG1 is We cannot cast the result to a reference type, so if ARG1 is
a reference type, find its underlying type. */ a reference type, find its underlying type. */
struct type *type = value_type (arg1); struct type *type = arg1->type ();
while (type->code () == TYPE_CODE_REF) while (type->code () == TYPE_CODE_REF)
type = type->target_type (); type = type->target_type ();
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@ -10826,7 +10826,7 @@ ada_unop_atr_operation::evaluate (struct type *expect_type,
{ {
value *tem = std::get<0> (m_storage)->evaluate (nullptr, exp, value *tem = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
type_arg = value_type (tem); type_arg = tem->type ();
} }
else else
val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@ -11011,7 +11011,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
{ {
value *arg1 = std::get<0> (m_storage)->evaluate (expect_type, exp, noside); value *arg1 = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
struct type *type = ada_check_typedef (value_type (arg1)); struct type *type = ada_check_typedef (arg1->type ());
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
if (ada_is_array_descriptor_type (type)) if (ada_is_array_descriptor_type (type))
@ -11039,7 +11039,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
{ {
arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_NORMAL); EVAL_NORMAL);
type = value_type (ada_value_ind (arg1)); type = ada_value_ind (arg1)->type ();
} }
else else
{ {
@ -11066,7 +11066,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
error (_("Attempt to take contents of a non-pointer value.")); error (_("Attempt to take contents of a non-pointer value."));
} }
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */ arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1)); type = ada_check_typedef (arg1->type ());
if (type->code () == TYPE_CODE_INT) if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. If we were given /* GDB allows dereferencing an int. If we were given
@ -11098,7 +11098,7 @@ ada_structop_operation::evaluate (struct type *expect_type,
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *type; struct type *type;
struct type *type1 = value_type (arg1); struct type *type1 = arg1->type ();
if (ada_is_tagged_type (type1, 1)) if (ada_is_tagged_type (type1, 1))
{ {
@ -11114,7 +11114,7 @@ ada_structop_operation::evaluate (struct type *expect_type,
EVAL_NORMAL); EVAL_NORMAL);
arg1 = ada_value_struct_elt (arg1, str, 0); arg1 = ada_value_struct_elt (arg1, str, 0);
arg1 = unwrap_value (arg1); arg1 = unwrap_value (arg1);
type = value_type (ada_to_fixed_value (arg1)); type = ada_to_fixed_value (arg1)->type ();
} }
} }
else else
@ -11152,15 +11152,15 @@ ada_funcall_operation::evaluate (struct type *expect_type,
argvec[i] = args_up[i]->evaluate (nullptr, exp, noside); argvec[i] = args_up[i]->evaluate (nullptr, exp, noside);
if (ada_is_constrained_packed_array_type if (ada_is_constrained_packed_array_type
(desc_base_type (value_type (callee)))) (desc_base_type (callee->type ())))
callee = ada_coerce_to_simple_array (callee); callee = ada_coerce_to_simple_array (callee);
else if (value_type (callee)->code () == TYPE_CODE_ARRAY else if (callee->type ()->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (value_type (callee), 0) != 0) && TYPE_FIELD_BITSIZE (callee->type (), 0) != 0)
/* This is a packed array that has already been fixed, and /* This is a packed array that has already been fixed, and
therefore already coerced to a simple array. Nothing further therefore already coerced to a simple array. Nothing further
to do. */ to do. */
; ;
else if (value_type (callee)->code () == TYPE_CODE_REF) else if (callee->type ()->code () == TYPE_CODE_REF)
{ {
/* Make sure we dereference references so that all the code below /* Make sure we dereference references so that all the code below
feels like it's really handling the referenced value. Wrapping feels like it's really handling the referenced value. Wrapping
@ -11168,11 +11168,11 @@ ada_funcall_operation::evaluate (struct type *expect_type,
well. */ well. */
callee = ada_to_fixed_value (coerce_ref (callee)); callee = ada_to_fixed_value (coerce_ref (callee));
} }
else if (value_type (callee)->code () == TYPE_CODE_ARRAY else if (callee->type ()->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (callee) == lval_memory) && VALUE_LVAL (callee) == lval_memory)
callee = value_addr (callee); callee = value_addr (callee);
struct type *type = ada_check_typedef (value_type (callee)); struct type *type = ada_check_typedef (callee->type ());
/* Ada allows us to implicitly dereference arrays when subscripting /* Ada allows us to implicitly dereference arrays when subscripting
them. So, if this is an array typedef (encoding use for array them. So, if this is an array typedef (encoding use for array
@ -11196,7 +11196,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
break; break;
default: default:
error (_("cannot subscript or call something of type `%s'"), error (_("cannot subscript or call something of type `%s'"),
ada_type_name (value_type (callee))); ada_type_name (callee->type ()));
break; break;
} }
} }
@ -11320,7 +11320,7 @@ ada_ternop_slice_operation::resolve (struct expression *exp,
continue that here. */ continue that here. */
value *v = std::get<0> (m_storage)->evaluate (context_type, exp, value *v = std::get<0> (m_storage)->evaluate (context_type, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
if (ada_is_any_packed_array_type (value_type (v))) if (ada_is_any_packed_array_type (v->type ()))
error (_("cannot slice a packed array")); error (_("cannot slice a packed array"));
return false; return false;
} }
@ -11375,7 +11375,7 @@ scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
k = pend - str; k = pend - str;
} }
bound_val = ada_search_struct_field (bound, dval, 0, value_type (dval)); bound_val = ada_search_struct_field (bound, dval, 0, dval->type ());
if (bound_val == NULL) if (bound_val == NULL)
return 0; return 0;
@ -12025,7 +12025,7 @@ ada_exception_message_1 (void)
e_msg_val = ada_coerce_to_simple_array (e_msg_val); e_msg_val = ada_coerce_to_simple_array (e_msg_val);
gdb_assert (e_msg_val != NULL); gdb_assert (e_msg_val != NULL);
e_msg_len = value_type (e_msg_val)->length (); e_msg_len = e_msg_val->type ()->length ();
/* If the message string is empty, then treat it as if there was /* If the message string is empty, then treat it as if there was
no exception message. */ no exception message. */

View file

@ -457,7 +457,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
to extract the string from the fat string. */ to extract the string from the fat string. */
if (initialize_fieldnos) if (initialize_fieldnos)
{ {
struct type *type = value_type (val); struct type *type = val->type ();
struct type *bounds_type; struct type *bounds_type;
array_fieldno = ada_get_field_index (type, "P_ARRAY", 0); array_fieldno = ada_get_field_index (type, "P_ARRAY", 0);
@ -784,7 +784,7 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
value_subscript (entry_calls_value, value_subscript (entry_calls_value,
value_as_long (atc_nesting_level_value)); value_as_long (atc_nesting_level_value));
called_task_fieldno = called_task_fieldno =
ada_get_field_index (value_type (entry_calls_value_element), ada_get_field_index (entry_calls_value_element->type (),
"called_task", 0); "called_task", 0);
task_info->called_task = task_info->called_task =
value_as_address (value_field (entry_calls_value_element, value_as_address (value_field (entry_calls_value_element,

View file

@ -196,12 +196,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
(i * bitsize) / HOST_CHAR_BIT, (i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT, (i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype); bitsize, elttype);
if (check_typedef (value_type (v0))->length () if (check_typedef (v0->type ())->length ()
!= check_typedef (value_type (v1))->length ()) != check_typedef (v1->type ())->length ())
break; break;
if (!value_contents_eq (v0, value_embedded_offset (v0), if (!value_contents_eq (v0, value_embedded_offset (v0),
v1, value_embedded_offset (v1), v1, value_embedded_offset (v1),
check_typedef (value_type (v0))->length ())) check_typedef (v0->type ())->length ()))
break; break;
} }
@ -552,7 +552,7 @@ print_variant_part (struct value *value, int field_num,
int comma_needed, int comma_needed,
const struct language_defn *language) const struct language_defn *language)
{ {
struct type *type = value_type (value); struct type *type = value->type ();
struct type *var_type = type->field (field_num).type (); struct type *var_type = type->field (field_num).type ();
int which = ada_which_variant_applies (var_type, outer_value); int which = ada_which_variant_applies (var_type, outer_value);
@ -588,7 +588,7 @@ print_field_values (struct value *value, struct value *outer_value,
{ {
int i, len; int i, len;
struct type *type = value_type (value); struct type *type = value->type ();
len = type->num_fields (); len = type->num_fields ();
for (i = 0; i < len; i += 1) for (i = 0; i < len; i += 1)
@ -732,8 +732,8 @@ ada_value_print_ptr (struct value *val,
const struct value_print_options *options) const struct value_print_options *options)
{ {
if (!options->format if (!options->format
&& value_type (val)->target_type ()->code () == TYPE_CODE_INT && val->type ()->target_type ()->code () == TYPE_CODE_INT
&& value_type (val)->target_type ()->length () == 0) && val->type ()->target_type ()->length () == 0)
{ {
gdb_puts ("null", stream); gdb_puts ("null", stream);
return; return;
@ -741,7 +741,7 @@ ada_value_print_ptr (struct value *val,
common_val_print (val, stream, recurse, options, language_def (language_c)); common_val_print (val, stream, recurse, options, language_def (language_c));
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
if (ada_is_tag_type (type)) if (ada_is_tag_type (type))
{ {
gdb::unique_xmalloc_ptr<char> name = ada_tag_name (val); gdb::unique_xmalloc_ptr<char> name = ada_tag_name (val);
@ -758,7 +758,7 @@ static void
ada_value_print_num (struct value *val, struct ui_file *stream, int recurse, ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (type->code () == TYPE_CODE_RANGE if (type->code () == TYPE_CODE_RANGE
@ -838,7 +838,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
return; return;
} }
struct type *type = ada_check_typedef (value_type (value)); struct type *type = ada_check_typedef (value->type ());
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value_contents_for_printing (value).data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr; int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
@ -875,7 +875,7 @@ ada_val_print_struct_union (struct value *value,
int recurse, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
if (ada_is_bogus_array_descriptor (value_type (value))) if (ada_is_bogus_array_descriptor (value->type ()))
{ {
gdb_printf (stream, "(...?)"); gdb_printf (stream, "(...?)");
return; return;
@ -901,7 +901,7 @@ static void
ada_value_print_array (struct value *val, struct ui_file *stream, int recurse, ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
/* For an array of characters, print with string syntax. */ /* For an array of characters, print with string syntax. */
if (ada_is_string_type (type) if (ada_is_string_type (type)
@ -961,7 +961,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
deref_val = coerce_ref_if_computed (original_value); deref_val = coerce_ref_if_computed (original_value);
if (deref_val) if (deref_val)
{ {
if (ada_is_tagged_type (value_type (deref_val), 1)) if (ada_is_tagged_type (deref_val->type (), 1))
deref_val = ada_tag_value_at_base_address (deref_val); deref_val = ada_tag_value_at_base_address (deref_val);
common_val_print (deref_val, stream, recurse + 1, options, common_val_print (deref_val, stream, recurse + 1, options,
@ -979,7 +979,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
deref_val deref_val
= ada_value_ind (value_from_pointer (lookup_pointer_type (elttype), = ada_value_ind (value_from_pointer (lookup_pointer_type (elttype),
deref_val_int)); deref_val_int));
if (ada_is_tagged_type (value_type (deref_val), 1)) if (ada_is_tagged_type (deref_val->type (), 1))
deref_val = ada_tag_value_at_base_address (deref_val); deref_val = ada_tag_value_at_base_address (deref_val);
if (value_lazy (deref_val)) if (value_lazy (deref_val))
@ -997,7 +997,7 @@ void
ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse, ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
if (ada_is_array_descriptor_type (type) if (ada_is_array_descriptor_type (type)
|| (ada_is_constrained_packed_array_type (type) || (ada_is_constrained_packed_array_type (type)
@ -1018,7 +1018,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
else else
val = ada_to_fixed_value (val); val = ada_to_fixed_value (val);
type = value_type (val); type = val->type ();
struct type *saved_type = type; struct type *saved_type = type;
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
@ -1088,7 +1088,7 @@ ada_value_print (struct value *val0, struct ui_file *stream,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct value *val = ada_to_fixed_value (val0); struct value *val = ada_to_fixed_value (val0);
struct type *type = ada_check_typedef (value_type (val)); struct type *type = ada_check_typedef (val->type ());
struct value_print_options opts; struct value_print_options opts;
/* If it is a pointer, indicate what it points to; but not for /* If it is a pointer, indicate what it points to; but not for

View file

@ -66,7 +66,7 @@ ada_varobj_decode_var (struct value **value_ptr, struct type **type_ptr)
*value_ptr = ada_get_decoded_value (*value_ptr); *value_ptr = ada_get_decoded_value (*value_ptr);
if (*value_ptr != nullptr) if (*value_ptr != nullptr)
*type_ptr = ada_check_typedef (value_type (*value_ptr)); *type_ptr = ada_check_typedef ((*value_ptr)->type ());
else else
*type_ptr = ada_get_decoded_type (*type_ptr); *type_ptr = ada_get_decoded_type (*type_ptr);
} }
@ -102,7 +102,7 @@ ada_varobj_struct_elt (struct value *parent_value,
if (parent_value) if (parent_value)
{ {
value = value_field (parent_value, fieldno); value = value_field (parent_value, fieldno);
type = value_type (value); type = value->type ();
} }
else else
type = parent_type->field (fieldno).type (); type = parent_type->field (fieldno).type ();
@ -150,7 +150,7 @@ ada_varobj_ind (struct value *parent_value,
if (parent_value) if (parent_value)
{ {
value = ada_value_ind (parent_value); value = ada_value_ind (parent_value);
type = value_type (value); type = value->type ();
} }
else else
type = parent_type->target_type (); type = parent_type->target_type ();
@ -181,7 +181,7 @@ ada_varobj_simple_array_elt (struct value *parent_value,
value_from_longest (parent_type->index_type (), elt_index); value_from_longest (parent_type->index_type (), elt_index);
value = ada_value_subscript (parent_value, 1, &index_value); value = ada_value_subscript (parent_value, 1, &index_value);
type = value_type (value); type = value->type ();
} }
else else
type = parent_type->target_type (); type = parent_type->target_type ();
@ -221,7 +221,7 @@ ada_varobj_adjust_for_child_access (struct value **value,
if (*value != NULL && ada_is_tagged_type (*type, 1)) if (*value != NULL && ada_is_tagged_type (*type, 1))
{ {
*value = ada_tag_value_at_base_address (*value); *value = ada_tag_value_at_base_address (*value);
*type = value_type (*value); *type = (*value)->type ();
} }
} }
@ -943,7 +943,7 @@ static bool
ada_value_is_changeable_p (const struct varobj *var) ada_value_is_changeable_p (const struct varobj *var)
{ {
struct type *type = (var->value != nullptr struct type *type = (var->value != nullptr
? value_type (var->value.get ()) : var->type); ? var->value.get ()->type () : var->type);
if (type->code () == TYPE_CODE_REF) if (type->code () == TYPE_CODE_REF)
type = type->target_type (); type = type->target_type ();

View file

@ -319,7 +319,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++) for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
/* Cast argument to long if necessary as the compiler does it too. */ /* Cast argument to long if necessary as the compiler does it too. */
switch (arg_type->code ()) switch (arg_type->code ())

View file

@ -376,7 +376,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf + 1, 1); memcpy (buf, raw_buf + 1, 1);
else else
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
} }
else else
{ {
@ -386,7 +386,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf, 1); memcpy (buf, raw_buf, 1);
else else
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
} }
} }
else if (i386_dword_regnum_p (gdbarch, regnum)) else if (i386_dword_regnum_p (gdbarch, regnum))
@ -399,7 +399,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf, 4); memcpy (buf, raw_buf, 4);
else else
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
} }
else else
i386_pseudo_register_read_into_value (gdbarch, regcache, regnum, i386_pseudo_register_read_into_value (gdbarch, regcache, regnum,
@ -962,7 +962,7 @@ if (return_method == return_method_struct)
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
enum amd64_reg_class theclass[2]; enum amd64_reg_class theclass[2];
int needed_integer_regs = 0; int needed_integer_regs = 0;
@ -1046,7 +1046,7 @@ if (return_method == return_method_struct)
/* Write out the arguments to the stack. */ /* Write out the arguments to the stack. */
for (i = 0; i < num_stack_args; i++) for (i = 0; i < num_stack_args; i++)
{ {
struct type *type = value_type (stack_args[i]); struct type *type = stack_args[i]->type ();
const gdb_byte *valbuf = value_contents (stack_args[i]).data (); const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
int len = type->length (); int len = type->length ();

View file

@ -176,9 +176,9 @@ amd64_windows_adjust_args_passed_by_pointer (struct value **args,
int i; int i;
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
if (amd64_windows_passed_by_pointer (value_type (args[i]))) if (amd64_windows_passed_by_pointer (args[i]->type ()))
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
const gdb_byte *valbuf = value_contents (args[i]).data (); const gdb_byte *valbuf = value_contents (args[i]).data ();
const int len = type->length (); const int len = type->length ();
@ -204,7 +204,7 @@ static void
amd64_windows_store_arg_in_reg (struct regcache *regcache, amd64_windows_store_arg_in_reg (struct regcache *regcache,
struct value *arg, int regno) struct value *arg, int regno)
{ {
struct type *type = value_type (arg); struct type *type = arg->type ();
const gdb_byte *valbuf = value_contents (arg).data (); const gdb_byte *valbuf = value_contents (arg).data ();
gdb_byte buf[8]; gdb_byte buf[8];
@ -251,7 +251,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
int on_stack_p = 1; int on_stack_p = 1;
@ -294,7 +294,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
/* Write out the arguments to the stack. */ /* Write out the arguments to the stack. */
for (i = 0; i < num_stack_args; i++) for (i = 0; i < num_stack_args; i++)
{ {
struct type *type = value_type (stack_args[i]); struct type *type = stack_args[i]->type ();
const gdb_byte *valbuf = value_contents (stack_args[i]).data (); const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
write_memory (sp + element * 8, valbuf, type->length ()); write_memory (sp + element * 8, valbuf, type->length ());

View file

@ -761,7 +761,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
argument's size up to an integral number of words. */ argument's size up to an integral number of words. */
for (int i = 0; i < nargs; i++) for (int i = 0; i < nargs; i++)
{ {
unsigned int len = value_type (args[i])->length (); unsigned int len = args[i]->type ()->length ();
unsigned int space = align_up (len, 4); unsigned int space = align_up (len, 4);
total_space += space; total_space += space;
@ -776,7 +776,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte *data = memory_image; gdb_byte *data = memory_image;
for (int i = 0; i < nargs; i++) for (int i = 0; i < nargs; i++)
{ {
unsigned int len = value_type (args[i])->length (); unsigned int len = args[i]->type ()->length ();
unsigned int space = align_up (len, 4); unsigned int space = align_up (len, 4);
memcpy (data, value_contents (args[i]).data (), (size_t) len); memcpy (data, value_contents (args[i]).data (), (size_t) len);

View file

@ -4635,7 +4635,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Determine the type of this function and whether the VFP ABI /* Determine the type of this function and whether the VFP ABI
applies. */ applies. */
ftype = check_typedef (value_type (function)); ftype = check_typedef (function->type ());
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (ftype->target_type ()); ftype = check_typedef (ftype->target_type ());
use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype); use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
@ -4678,7 +4678,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int vfp_base_count; int vfp_base_count;
int may_use_core_reg = 1; int may_use_core_reg = 1;
arg_type = check_typedef (value_type (args[argnum])); arg_type = check_typedef (args[argnum]->type ());
len = arg_type->length (); len = arg_type->length ();
target_type = arg_type->target_type (); target_type = arg_type->target_type ();
typecode = arg_type->code (); typecode = arg_type->code ();
@ -9178,7 +9178,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
struct value **read_value, const gdb_byte *writebuf) struct value **read_value, const gdb_byte *writebuf)
{ {
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch); arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
struct type *func_type = function ? value_type (function) : NULL; struct type *func_type = function ? function->type () : NULL;
enum arm_vfp_cprc_base_type vfp_base_type; enum arm_vfp_cprc_base_type vfp_base_type;
int vfp_base_count; int vfp_base_count;

View file

@ -1298,7 +1298,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int last_regnum; int last_regnum;
int j; int j;
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
const bfd_byte *contents = value_contents (arg).data (); const bfd_byte *contents = value_contents (arg).data ();
int len = type->length (); int len = type->length ();

View file

@ -1585,7 +1585,7 @@ operation::generate_ax (struct expression *exp,
struct value *v = evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS); struct value *v = evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS);
ax_const_l (ax, value_as_long (v)); ax_const_l (ax, value_as_long (v));
value->kind = axs_rvalue; value->kind = axs_rvalue;
value->type = check_typedef (value_type (v)); value->type = check_typedef (v->type ());
} }
else else
{ {
@ -1745,7 +1745,7 @@ repeat_operation::do_generate_ax (struct expression *exp,
struct value *v struct value *v
= std::get<1> (m_storage)->evaluate (nullptr, exp, = std::get<1> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
if (value_type (v)->code () != TYPE_CODE_INT) if (v->type ()->code () != TYPE_CODE_INT)
error (_("Right operand of `@' must be an integer.")); error (_("Right operand of `@' must be an integer."));
int length = value_as_long (v); int length = value_as_long (v);
if (length <= 0) if (length <= 0)
@ -1862,7 +1862,7 @@ unop_memval_type_operation::do_generate_ax (struct expression *exp,
struct value *val struct value *val
= std::get<0> (m_storage)->evaluate (nullptr, exp, = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (val); struct type *type = val->type ();
std::get<1> (m_storage)->generate_ax (exp, ax, value); std::get<1> (m_storage)->generate_ax (exp, ax, value);
@ -1980,7 +1980,7 @@ unop_cast_type_operation::do_generate_ax (struct expression *exp,
struct value *val struct value *val
= std::get<0> (m_storage)->evaluate (nullptr, exp, = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
std::get<1> (m_storage)->generate_ax (exp, ax, value, value_type (val)); std::get<1> (m_storage)->generate_ax (exp, ax, value, val->type ());
} }
void void

View file

@ -1864,7 +1864,7 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
if (val == NULL) if (val == NULL)
return NULL; return NULL;
bit_val = allocate_value (value_type (val)); bit_val = allocate_value (val->type ());
unpack_value_bitfield (bit_val, unpack_value_bitfield (bit_val,
w->val_bitpos, w->val_bitpos,
@ -2078,7 +2078,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
if (VALUE_LVAL (v) == lval_memory if (VALUE_LVAL (v) == lval_memory
&& (v == val_chain[0] || ! value_lazy (v))) && (v == val_chain[0] || ! value_lazy (v)))
{ {
struct type *vtype = check_typedef (value_type (v)); struct type *vtype = check_typedef (v->type ());
/* We only watch structs and arrays if user asked /* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to for it explicitly, never if they just happen to
@ -2125,7 +2125,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next)) for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
; ;
*tmp = loc; *tmp = loc;
loc->gdbarch = value_type (v)->arch (); loc->gdbarch = v->type ()->arch ();
loc->pspace = frame_pspace; loc->pspace = frame_pspace;
loc->address loc->address
@ -2137,7 +2137,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
loc->length = ((bitpos % 8) + bitsize + 7) / 8; loc->length = ((bitpos % 8) + bitsize + 7) / 8;
} }
else else
loc->length = value_type (v)->length (); loc->length = v->type ()->length ();
loc->watchpoint_type = type; loc->watchpoint_type = type;
} }
@ -10317,7 +10317,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
w->cond_exp_valid_block = cond_exp_valid_block; w->cond_exp_valid_block = cond_exp_valid_block;
if (just_location) if (just_location)
{ {
struct type *t = value_type (val.get ()); struct type *t = val.get ()->type ();
CORE_ADDR addr = value_as_address (val.get ()); CORE_ADDR addr = value_as_address (val.get ());
w->exp_string_reparse w->exp_string_reparse
@ -10426,7 +10426,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
{ {
/* Ahh, memory we actually used! Check if we can cover /* Ahh, memory we actually used! Check if we can cover
it with hardware watchpoints. */ it with hardware watchpoints. */
struct type *vtype = check_typedef (value_type (v)); struct type *vtype = check_typedef (v->type ());
/* We only watch structs and arrays if user asked for it /* We only watch structs and arrays if user asked for it
explicitly, never if they just happen to appear in a explicitly, never if they just happen to appear in a
@ -10441,7 +10441,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
len = (target_exact_watchpoints len = (target_exact_watchpoints
&& is_scalar_type_recursive (vtype))? && is_scalar_type_recursive (vtype))?
1 : value_type (v)->length (); 1 : v->type ()->length ();
num_regs = target_region_ok_for_hw_watchpoint (vaddr, len); num_regs = target_region_ok_for_hw_watchpoint (vaddr, len);
if (!num_regs) if (!num_regs)

View file

@ -138,7 +138,7 @@ public:
value *lhs value *lhs
= std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside); = std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
value *rhs value *rhs
= std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp, = std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
noside); noside);
return FUNC (expect_type, exp, noside, OP, lhs, rhs); return FUNC (expect_type, exp, noside, OP, lhs, rhs);
} }

View file

@ -245,7 +245,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
{ {
int err, width; int err, width;
unsigned int fetchlimit; unsigned int fetchlimit;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
struct type *element_type = type->target_type (); struct type *element_type = type->target_type ();
int req_length = *length; int req_length = *length;
enum bfd_endian byte_order enum bfd_endian byte_order

View file

@ -235,7 +235,7 @@ c_value_print_array (struct value *val,
struct ui_file *stream, int recurse, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
CORE_ADDR address = value_address (val); CORE_ADDR address = value_address (val);
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
struct type *unresolved_elttype = type->target_type (); struct type *unresolved_elttype = type->target_type ();
@ -333,7 +333,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
return; return;
} }
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (options->vtblprint && cp_is_vtbl_ptr_type (type)) if (options->vtblprint && cp_is_vtbl_ptr_type (type))
@ -363,7 +363,7 @@ static void
c_value_print_struct (struct value *val, struct ui_file *stream, int recurse, c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint) if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint)
gdb_printf (stream, "{...}"); gdb_printf (stream, "{...}");
@ -405,7 +405,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
instead. Since we don't know whether the value is really instead. Since we don't know whether the value is really
intended to be used as an integer or a character, print intended to be used as an integer or a character, print
the character equivalent as well. */ the character equivalent as well. */
struct type *type = value_type (val); struct type *type = val->type ();
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (c_textual_element_type (type, options->format)) if (c_textual_element_type (type, options->format))
{ {
@ -422,7 +422,7 @@ void
c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = value_type (val); struct type *type = val->type ();
type = check_typedef (type); type = check_typedef (type);
switch (type->code ()) switch (type->code ())
@ -486,11 +486,11 @@ c_value_print (struct value *val, struct ui_file *stream,
C++: if it is a member pointer, we will take care C++: if it is a member pointer, we will take care
of that when we print it. */ of that when we print it. */
type = check_typedef (value_type (val)); type = check_typedef (val->type ());
if (type->is_pointer_or_reference ()) if (type->is_pointer_or_reference ())
{ {
struct type *original_type = value_type (val); struct type *original_type = val->type ();
/* Hack: remove (char *) for char strings. Their /* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. type is indicated by the quoted string anyway.
@ -541,7 +541,7 @@ c_value_print (struct value *val, struct ui_file *stream,
if (is_ref) if (is_ref)
val = value_ref (value_ind (val), refcode); val = value_ref (value_ind (val), refcode);
type = value_type (val); type = val->type ();
type_print (type, "", stream, -1); type_print (type, "", stream, -1);
gdb_printf (stream, ") "); gdb_printf (stream, ") ");
} }
@ -549,7 +549,7 @@ c_value_print (struct value *val, struct ui_file *stream,
{ {
/* normal case */ /* normal case */
gdb_printf (stream, "("); gdb_printf (stream, "(");
type_print (value_type (val), "", stream, -1); type_print (val->type (), "", stream, -1);
gdb_printf (stream, ") "); gdb_printf (stream, ") ");
} }
} }

View file

@ -245,7 +245,7 @@ static struct value *
value_struct_element_index (struct value *value, int type_index) value_struct_element_index (struct value *value, int type_index)
{ {
struct value *result = NULL; struct value *result = NULL;
struct type *type = value_type (value); struct type *type = value->type ();
type = check_typedef (type); type = check_typedef (type);

View file

@ -2190,7 +2190,7 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist,
if (argc != 1) if (argc != 1)
error (_("You can only provide one argument to %s"), fnname); error (_("You can only provide one argument to %s"), fnname);
struct type *type0 = check_typedef (value_type (argv[0])); struct type *type0 = check_typedef (argv[0]->type ());
if (type0->code () != TYPE_CODE_ARRAY if (type0->code () != TYPE_CODE_ARRAY
&& type0->code () != TYPE_CODE_STRING) && type0->code () != TYPE_CODE_STRING)

View file

@ -225,7 +225,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
/* Have everything. Open/write the data. */ /* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0) if (file_format == NULL || strcmp (file_format, "binary") == 0)
dump_binary_file (filename.get (), mode, value_contents (val).data (), dump_binary_file (filename.get (), mode, value_contents (val).data (),
value_type (val)->length ()); val->type ()->length ());
else else
{ {
CORE_ADDR vaddr; CORE_ADDR vaddr;
@ -242,7 +242,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
dump_bfd_file (filename.get (), mode, file_format, vaddr, dump_bfd_file (filename.get (), mode, file_format, vaddr,
value_contents (val).data (), value_contents (val).data (),
value_type (val)->length ()); val->type ()->length ());
} }
} }

View file

@ -37,7 +37,7 @@ get_ulongest (const char **pp, int trailer)
if (val != NULL) /* Value history reference */ if (val != NULL) /* Value history reference */
{ {
if (value_type (val)->code () == TYPE_CODE_INT) if (val->type ()->code () == TYPE_CODE_INT)
retval = value_as_long (val); retval = value_as_long (val);
else else
error (_("History value must have integer type.")); error (_("History value must have integer type."));
@ -96,7 +96,7 @@ get_number_trailer (const char **pp, int trailer)
if (val) /* Value history reference */ if (val) /* Value history reference */
{ {
if (value_type (val)->code () == TYPE_CODE_INT) if (val->type ()->code () == TYPE_CODE_INT)
retval = value_as_long (val); retval = value_as_long (val);
else else
{ {

View file

@ -111,7 +111,7 @@ value_rtti_type (struct value *v, int *full,
struct type *ret = NULL; struct type *ret = NULL;
if ((current_cp_abi.rtti_type) == NULL if ((current_cp_abi.rtti_type) == NULL
|| !HAVE_CPLUS_STRUCT (check_typedef (value_type (v)))) || !HAVE_CPLUS_STRUCT (check_typedef (v->type ())))
return NULL; return NULL;
try try
{ {

View file

@ -129,7 +129,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
int fields_seen = 0; int fields_seen = 0;
static int last_set_recurse = -1; static int last_set_recurse = -1;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (recurse == 0) if (recurse == 0)
{ {
@ -389,7 +389,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
int recurse, const struct value_print_options *options, int recurse, const struct value_print_options *options,
struct type **dont_print_vb) struct type **dont_print_vb)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
CORE_ADDR address = value_address (val); CORE_ADDR address = value_address (val);
struct type **last_dont_print struct type **last_dont_print
= (struct type **) obstack_next_free (&dont_print_vb_obstack); = (struct type **) obstack_next_free (&dont_print_vb_obstack);
@ -461,7 +461,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
base_val = value_from_contents_and_address (baseclass, base_val = value_from_contents_and_address (baseclass,
buf.data (), buf.data (),
address + boffset); address + boffset);
baseclass = value_type (base_val); baseclass = base_val->type ();
boffset = 0; boffset = 0;
} }
else else

View file

@ -821,7 +821,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int reg_demand; int reg_demand;
int i; int i;
len = value_type (args[argnum])->length (); len = args[argnum]->type ()->length ();
val = value_contents (args[argnum]).data (); val = value_contents (args[argnum]).data ();
/* How may registers worth of storage do we need for this argument? */ /* How may registers worth of storage do we need for this argument? */

View file

@ -806,7 +806,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type; struct type *arg_type;
const gdb_byte *val; const gdb_byte *val;
arg_type = check_typedef (value_type (args[argnum])); arg_type = check_typedef (args[argnum]->type ());
len = arg_type->length (); len = arg_type->length ();
val = value_contents (args[argnum]).data (); val = value_contents (args[argnum]).data ();

View file

@ -61,7 +61,7 @@ dynamic_array_type (struct type *type,
true_type = lookup_array_range_type (true_type, 0, length - 1); true_type = lookup_array_range_type (true_type, 0, length - 1);
ival = value_at (true_type, addr); ival = value_at (true_type, addr);
true_type = value_type (ival); true_type = ival->type ();
d_value_print_inner (ival, stream, recurse + 1, options); d_value_print_inner (ival, stream, recurse + 1, options);
return 0; return 0;
@ -77,7 +77,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
{ {
int ret; int ret;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:

View file

@ -724,7 +724,7 @@ info_mach_region_command (const char *exp, int from_tty)
expression_up expr = parse_expression (exp); expression_up expr = parse_expression (exp);
val = evaluate_expression (expr.get ()); val = evaluate_expression (expr.get ());
if (TYPE_IS_REFERENCE (value_type (val))) if (TYPE_IS_REFERENCE (val->type ()))
{ {
val = value_ind (val); val = value_ind (val);
} }

View file

@ -494,7 +494,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
} }
if (expr != NULL && expr->first_opcode () == OP_TYPE) if (expr != NULL && expr->first_opcode () == OP_TYPE)
type = value_type (evaluate_type (expr.get ())); type = evaluate_type (expr.get ())->type ();
args.emplace_back (type, std::move (type_str), std::move (expr)); args.emplace_back (type, std::move (type_str), std::move (expr));
} }

View file

@ -151,7 +151,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
piece_closure *c piece_closure *c
= (piece_closure *) value_computed_closure (v); = (piece_closure *) value_computed_closure (v);
gdb::byte_vector buffer; gdb::byte_vector buffer;
bool bits_big_endian = type_byte_order (value_type (v)) == BFD_ENDIAN_BIG; bool bits_big_endian = type_byte_order (v->type ()) == BFD_ENDIAN_BIG;
gdb_assert (!check_optimized || from == nullptr); gdb_assert (!check_optimized || from == nullptr);
if (from != nullptr) if (from != nullptr)
@ -174,18 +174,18 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
bits_to_skip += (8 * value_offset (value_parent (v)) bits_to_skip += (8 * value_offset (value_parent (v))
+ value_bitpos (v)); + value_bitpos (v));
if (from != nullptr if (from != nullptr
&& (type_byte_order (value_type (from)) && (type_byte_order (from->type ())
== BFD_ENDIAN_BIG)) == BFD_ENDIAN_BIG))
{ {
/* Use the least significant bits of FROM. */ /* Use the least significant bits of FROM. */
max_offset = 8 * value_type (from)->length (); max_offset = 8 * from->type ()->length ();
offset = max_offset - value_bitsize (v); offset = max_offset - value_bitsize (v);
} }
else else
max_offset = value_bitsize (v); max_offset = value_bitsize (v);
} }
else else
max_offset = 8 * value_type (v)->length (); max_offset = 8 * v->type ()->length ();
/* Advance to the first non-skipped piece. */ /* Advance to the first non-skipped piece. */
for (i = 0; i < c->pieces.size () && bits_to_skip >= c->pieces[i].size; i++) for (i = 0; i < c->pieces.size () && bits_to_skip >= c->pieces[i].size; i++)
@ -364,7 +364,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
gdbarch *objfile_gdbarch = c->per_objfile->objfile->arch (); gdbarch *objfile_gdbarch = c->per_objfile->objfile->arch ();
ULONGEST stack_value_size_bits ULONGEST stack_value_size_bits
= 8 * value_type (p->v.value)->length (); = 8 * p->v.value->type ()->length ();
/* Use zeroes if piece reaches beyond stack value. */ /* Use zeroes if piece reaches beyond stack value. */
if (p->offset + p->size > stack_value_size_bits) if (p->offset + p->size > stack_value_size_bits)
@ -507,7 +507,7 @@ indirect_pieced_value (value *value)
int i; int i;
dwarf_expr_piece *piece = NULL; dwarf_expr_piece *piece = NULL;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
if (type->code () != TYPE_CODE_PTR) if (type->code () != TYPE_CODE_PTR)
return NULL; return NULL;
@ -574,7 +574,7 @@ indirect_pieced_value (value *value)
static value * static value *
coerce_pieced_ref (const value *value) coerce_pieced_ref (const value *value)
{ {
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
if (value_bits_synthetic_pointer (value, value_embedded_offset (value), if (value_bits_synthetic_pointer (value, value_embedded_offset (value),
TARGET_CHAR_BIT * type->length ())) TARGET_CHAR_BIT * type->length ()))
@ -1012,7 +1012,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
case DWARF_VALUE_STACK: case DWARF_VALUE_STACK:
{ {
value *val = this->fetch (0); value *val = this->fetch (0);
size_t n = value_type (val)->length (); size_t n = val->type ()->length ();
size_t len = subobj_type->length (); size_t len = subobj_type->length ();
size_t max = type->length (); size_t max = type->length ();
@ -1144,7 +1144,7 @@ dwarf_expr_context::fetch_address (int n)
bfd_endian byte_order = gdbarch_byte_order (arch); bfd_endian byte_order = gdbarch_byte_order (arch);
ULONGEST result; ULONGEST result;
dwarf_require_integral (value_type (result_val)); dwarf_require_integral (result_val->type ());
result = extract_unsigned_integer (value_contents (result_val), byte_order); result = extract_unsigned_integer (value_contents (result_val), byte_order);
/* For most architectures, calling extract_unsigned_integer() alone /* For most architectures, calling extract_unsigned_integer() alone
@ -1157,7 +1157,7 @@ dwarf_expr_context::fetch_address (int n)
{ {
gdb_byte *buf = (gdb_byte *) alloca (this->m_addr_size); gdb_byte *buf = (gdb_byte *) alloca (this->m_addr_size);
type *int_type = get_unsigned_type (arch, type *int_type = get_unsigned_type (arch,
value_type (result_val)); result_val->type ());
store_unsigned_integer (buf, this->m_addr_size, byte_order, result); store_unsigned_integer (buf, this->m_addr_size, byte_order, result);
return gdbarch_integer_to_address (arch, int_type, buf); return gdbarch_integer_to_address (arch, int_type, buf);
@ -1929,18 +1929,18 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
{ {
case DW_OP_abs: case DW_OP_abs:
if (value_less (result_val, if (value_less (result_val,
value_zero (value_type (result_val), not_lval))) value_zero (result_val->type (), not_lval)))
result_val = value_neg (result_val); result_val = value_neg (result_val);
break; break;
case DW_OP_neg: case DW_OP_neg:
result_val = value_neg (result_val); result_val = value_neg (result_val);
break; break;
case DW_OP_not: case DW_OP_not:
dwarf_require_integral (value_type (result_val)); dwarf_require_integral (result_val->type ());
result_val = value_complement (result_val); result_val = value_complement (result_val);
break; break;
case DW_OP_plus_uconst: case DW_OP_plus_uconst:
dwarf_require_integral (value_type (result_val)); dwarf_require_integral (result_val->type ());
result = value_as_long (result_val); result = value_as_long (result_val);
op_ptr = safe_read_uleb128 (op_ptr, op_end, &reg); op_ptr = safe_read_uleb128 (op_ptr, op_end, &reg);
result += reg; result += reg;
@ -1977,14 +1977,14 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
first = fetch (0); first = fetch (0);
pop (); pop ();
if (! base_types_equal_p (value_type (first), value_type (second))) if (! base_types_equal_p (first->type (), second->type ()))
error (_("Incompatible types on DWARF stack")); error (_("Incompatible types on DWARF stack"));
switch (op) switch (op)
{ {
case DW_OP_and: case DW_OP_and:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
result_val = value_binop (first, second, BINOP_BITWISE_AND); result_val = value_binop (first, second, BINOP_BITWISE_AND);
break; break;
case DW_OP_div: case DW_OP_div:
@ -1996,7 +1996,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_mod: case DW_OP_mod:
{ {
int cast_back = 0; int cast_back = 0;
struct type *orig_type = value_type (first); struct type *orig_type = first->type ();
/* We have to special-case "old-style" untyped values /* We have to special-case "old-style" untyped values
-- these must have mod computed using unsigned -- these must have mod computed using unsigned
@ -2020,25 +2020,25 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = value_binop (first, second, BINOP_MUL); result_val = value_binop (first, second, BINOP_MUL);
break; break;
case DW_OP_or: case DW_OP_or:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
result_val = value_binop (first, second, BINOP_BITWISE_IOR); result_val = value_binop (first, second, BINOP_BITWISE_IOR);
break; break;
case DW_OP_plus: case DW_OP_plus:
result_val = value_binop (first, second, BINOP_ADD); result_val = value_binop (first, second, BINOP_ADD);
break; break;
case DW_OP_shl: case DW_OP_shl:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
result_val = value_binop (first, second, BINOP_LSH); result_val = value_binop (first, second, BINOP_LSH);
break; break;
case DW_OP_shr: case DW_OP_shr:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
if (!value_type (first)->is_unsigned ()) if (!first->type ()->is_unsigned ())
{ {
struct type *utype struct type *utype
= get_unsigned_type (arch, value_type (first)); = get_unsigned_type (arch, first->type ());
first = value_cast (utype, first); first = value_cast (utype, first);
} }
@ -2046,16 +2046,16 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = value_binop (first, second, BINOP_RSH); result_val = value_binop (first, second, BINOP_RSH);
/* Make sure we wind up with the same type we started /* Make sure we wind up with the same type we started
with. */ with. */
if (value_type (result_val) != value_type (second)) if (result_val->type () != second->type ())
result_val = value_cast (value_type (second), result_val); result_val = value_cast (second->type (), result_val);
break; break;
case DW_OP_shra: case DW_OP_shra:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
if (value_type (first)->is_unsigned ()) if (first->type ()->is_unsigned ())
{ {
struct type *stype struct type *stype
= get_signed_type (arch, value_type (first)); = get_signed_type (arch, first->type ());
first = value_cast (stype, first); first = value_cast (stype, first);
} }
@ -2063,12 +2063,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = value_binop (first, second, BINOP_RSH); result_val = value_binop (first, second, BINOP_RSH);
/* Make sure we wind up with the same type we started /* Make sure we wind up with the same type we started
with. */ with. */
if (value_type (result_val) != value_type (second)) if (result_val->type () != second->type ())
result_val = value_cast (value_type (second), result_val); result_val = value_cast (second->type (), result_val);
break; break;
case DW_OP_xor: case DW_OP_xor:
dwarf_require_integral (value_type (first)); dwarf_require_integral (first->type ());
dwarf_require_integral (value_type (second)); dwarf_require_integral (second->type ());
result_val = value_binop (first, second, BINOP_BITWISE_XOR); result_val = value_binop (first, second, BINOP_BITWISE_XOR);
break; break;
case DW_OP_le: case DW_OP_le:
@ -2142,7 +2142,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
offset = extract_signed_integer (op_ptr, 2, byte_order); offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2; op_ptr += 2;
val = fetch (0); val = fetch (0);
dwarf_require_integral (value_type (val)); dwarf_require_integral (val->type ());
if (value_as_long (val) != 0) if (value_as_long (val) != 0)
op_ptr += offset; op_ptr += offset;
pop (); pop ();
@ -2341,12 +2341,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
if (op == DW_OP_convert || op == DW_OP_GNU_convert) if (op == DW_OP_convert || op == DW_OP_GNU_convert)
result_val = value_cast (type, result_val); result_val = value_cast (type, result_val);
else if (type == value_type (result_val)) else if (type == result_val->type ())
{ {
/* Nothing. */ /* Nothing. */
} }
else if (type->length () else if (type->length ()
!= value_type (result_val)->length ()) != result_val->type ()->length ())
error (_("DW_OP_reinterpret has wrong size")); error (_("DW_OP_reinterpret has wrong size"));
else else
result_val result_val

View file

@ -1273,7 +1273,7 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
static struct value * static struct value *
entry_data_value_coerce_ref (const struct value *value) entry_data_value_coerce_ref (const struct value *value)
{ {
struct type *checked_type = check_typedef (value_type (value)); struct type *checked_type = check_typedef (value->type ());
struct value *target_val; struct value *target_val;
if (!TYPE_IS_REFERENCE (checked_type)) if (!TYPE_IS_REFERENCE (checked_type))

View file

@ -241,7 +241,7 @@ unop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
struct type *type1; struct type *type1;
*arg1 = coerce_ref (*arg1); *arg1 = coerce_ref (*arg1);
type1 = check_typedef (value_type (*arg1)); type1 = check_typedef ((*arg1)->type ());
if (is_integral_type (type1)) if (is_integral_type (type1))
{ {
@ -278,8 +278,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
*arg1 = coerce_ref (*arg1); *arg1 = coerce_ref (*arg1);
*arg2 = coerce_ref (*arg2); *arg2 = coerce_ref (*arg2);
type1 = check_typedef (value_type (*arg1)); type1 = check_typedef ((*arg1)->type ());
type2 = check_typedef (value_type (*arg2)); type2 = check_typedef ((*arg2)->type ());
if ((type1->code () != TYPE_CODE_FLT if ((type1->code () != TYPE_CODE_FLT
&& type1->code () != TYPE_CODE_DECFLOAT && type1->code () != TYPE_CODE_DECFLOAT
@ -628,7 +628,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
call an error. This can happen if somebody tries to turn call an error. This can happen if somebody tries to turn
a variable into a function call. */ a variable into a function call. */
type *ftype = value_type (callee); type *ftype = callee->type ();
if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION) if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION)
{ {
@ -672,7 +672,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
error (_("Expression of type other than " error (_("Expression of type other than "
"\"Function returning ...\" used as function")); "\"Function returning ...\" used as function"));
} }
switch (value_type (callee)->code ()) switch (callee->type ()->code ())
{ {
case TYPE_CODE_INTERNAL_FUNCTION: case TYPE_CODE_INTERNAL_FUNCTION:
return call_internal_function (exp->gdbarch, exp->language_defn, return call_internal_function (exp->gdbarch, exp->language_defn,
@ -697,7 +697,7 @@ operation::evaluate_funcall (struct type *expect_type,
std::vector<value *> vals (args.size ()); std::vector<value *> vals (args.size ());
value *callee = evaluate_with_coercion (exp, noside); value *callee = evaluate_with_coercion (exp, noside);
struct type *type = value_type (callee); struct type *type = callee->type ();
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
type = type->target_type (); type = type->target_type ();
for (int i = 0; i < args.size (); ++i) for (int i = 0; i < args.size (); ++i)
@ -836,7 +836,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
value *callee; value *callee;
type *a1_type = check_typedef (value_type (rhs)); type *a1_type = check_typedef (rhs->type ());
if (a1_type->code () == TYPE_CODE_METHODPTR) if (a1_type->code () == TYPE_CODE_METHODPTR)
{ {
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
@ -963,7 +963,7 @@ structop_base_operation::evaluate_funcall
/* value_struct_elt updates temp with the correct value of the /* value_struct_elt updates temp with the correct value of the
``this'' pointer if necessary, so modify it to reflect any ``this'' pointer if necessary, so modify it to reflect any
``this'' changes. */ ``this'' changes. */
vals[0] = value_from_longest (lookup_pointer_type (value_type (temp)), vals[0] = value_from_longest (lookup_pointer_type (temp->type ()),
value_address (temp) value_address (temp)
+ value_embedded_offset (temp)); + value_embedded_offset (temp));
} }
@ -1041,7 +1041,7 @@ structop_base_operation::complete (struct expression *exp,
value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (lhs); struct type *type = lhs->type ();
for (;;) for (;;)
{ {
type = check_typedef (type); type = check_typedef (type);
@ -1122,7 +1122,7 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp,
value *val = evaluate_var_msym_value (noside, msymbol.objfile, value *val = evaluate_var_msym_value (noside, msymbol.objfile,
msymbol.minsym); msymbol.minsym);
struct type *type = value_type (val); struct type *type = val->type ();
if (type->code () == TYPE_CODE_ERROR if (type->code () == TYPE_CODE_ERROR
&& (noside != EVAL_AVOID_SIDE_EFFECTS || !outermost_p)) && (noside != EVAL_AVOID_SIDE_EFFECTS || !outermost_p))
error_unknown_type (msymbol.minsym->print_name ()); error_unknown_type (msymbol.minsym->print_name ());
@ -1224,7 +1224,7 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_struct_elt (&arg1, {}, string, struct value *arg3 = value_struct_elt (&arg1, {}, string,
NULL, "structure"); NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3)); arg3 = value_zero (arg3->type (), VALUE_LVAL (arg3));
return arg3; return arg3;
} }
@ -1260,7 +1260,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
with rtti type in order to continue on with successful with rtti type in order to continue on with successful
lookup of member / method only available in the rtti type. */ lookup of member / method only available in the rtti type. */
{ {
struct type *arg_type = value_type (arg1); struct type *arg_type = arg1->type ();
struct type *real_type; struct type *real_type;
int full, using_enc; int full, using_enc;
LONGEST top; LONGEST top;
@ -1280,7 +1280,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_struct_elt (&arg1, {}, string, struct value *arg3 = value_struct_elt (&arg1, {}, string,
NULL, "structure pointer"); NULL, "structure pointer");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3)); arg3 = value_zero (arg3->type (), VALUE_LVAL (arg3));
return arg3; return arg3;
} }
@ -1294,7 +1294,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
long mem_offset; long mem_offset;
struct value *arg3; struct value *arg3;
struct type *type = check_typedef (value_type (arg2)); struct type *type = check_typedef (arg2->type ());
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_METHODPTR: case TYPE_CODE_METHODPTR:
@ -1303,13 +1303,13 @@ eval_op_member (struct type *expect_type, struct expression *exp,
else else
{ {
arg2 = cplus_method_ptr_to_value (&arg1, arg2); arg2 = cplus_method_ptr_to_value (&arg1, arg2);
gdb_assert (value_type (arg2)->code () == TYPE_CODE_PTR); gdb_assert (arg2->type ()->code () == TYPE_CODE_PTR);
return value_ind (arg2); return value_ind (arg2);
} }
case TYPE_CODE_MEMBERPTR: case TYPE_CODE_MEMBERPTR:
/* Now, convert these values to an address. */ /* Now, convert these values to an address. */
if (check_typedef (value_type (arg1))->code () != TYPE_CODE_PTR) if (check_typedef (arg1->type ())->code () != TYPE_CODE_PTR)
arg1 = value_addr (arg1); arg1 = value_addr (arg1);
arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)), arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)),
arg1, 1); arg1, 1);
@ -1335,11 +1335,11 @@ eval_op_add (struct type *expect_type, struct expression *exp,
{ {
if (binop_user_defined_p (BINOP_ADD, arg1, arg2)) if (binop_user_defined_p (BINOP_ADD, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside); return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside);
else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) else if (ptrmath_type_p (exp->language_defn, arg1->type ())
&& is_integral_or_integral_reference (value_type (arg2))) && is_integral_or_integral_reference (arg2->type ()))
return value_ptradd (arg1, value_as_long (arg2)); return value_ptradd (arg1, value_as_long (arg2));
else if (ptrmath_type_p (exp->language_defn, value_type (arg2)) else if (ptrmath_type_p (exp->language_defn, arg2->type ())
&& is_integral_or_integral_reference (value_type (arg1))) && is_integral_or_integral_reference (arg1->type ()))
return value_ptradd (arg2, value_as_long (arg1)); return value_ptradd (arg2, value_as_long (arg1));
else else
{ {
@ -1357,15 +1357,15 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
{ {
if (binop_user_defined_p (BINOP_SUB, arg1, arg2)) if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside); return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) else if (ptrmath_type_p (exp->language_defn, arg1->type ())
&& ptrmath_type_p (exp->language_defn, value_type (arg2))) && ptrmath_type_p (exp->language_defn, arg2->type ()))
{ {
/* FIXME -- should be ptrdiff_t */ /* FIXME -- should be ptrdiff_t */
struct type *type = builtin_type (exp->gdbarch)->builtin_long; struct type *type = builtin_type (exp->gdbarch)->builtin_long;
return value_from_longest (type, value_ptrdiff (arg1, arg2)); return value_from_longest (type, value_ptrdiff (arg1, arg2));
} }
else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) else if (ptrmath_type_p (exp->language_defn, arg1->type ())
&& is_integral_or_integral_reference (value_type (arg2))) && is_integral_or_integral_reference (arg2->type ()))
return value_ptradd (arg1, - value_as_long (arg2)); return value_ptradd (arg1, - value_as_long (arg2));
else else
{ {
@ -1400,7 +1400,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
{ {
struct value *v_one; struct value *v_one;
v_one = value_one (value_type (arg2)); v_one = value_one (arg2->type ());
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one);
return value_binop (arg1, v_one, op); return value_binop (arg1, v_one, op);
} }
@ -1409,7 +1409,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
/* For shift and integer exponentiation operations, /* For shift and integer exponentiation operations,
only promote the first argument. */ only promote the first argument. */
if ((op == BINOP_LSH || op == BINOP_RSH || op == BINOP_EXP) if ((op == BINOP_LSH || op == BINOP_RSH || op == BINOP_EXP)
&& is_integral_type (value_type (arg2))) && is_integral_type (arg2->type ()))
unop_promote (exp->language_defn, exp->gdbarch, &arg1); unop_promote (exp->language_defn, exp->gdbarch, &arg1);
else else
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@ -1435,7 +1435,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
then report this as an error. */ then report this as an error. */
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (type->code () != TYPE_CODE_ARRAY if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR) && type->code () != TYPE_CODE_PTR)
{ {
@ -1586,13 +1586,13 @@ eval_op_repeat (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
struct type *type = check_typedef (value_type (arg2)); struct type *type = check_typedef (arg2->type ());
if (type->code () != TYPE_CODE_INT if (type->code () != TYPE_CODE_INT
&& type->code () != TYPE_CODE_ENUM) && type->code () != TYPE_CODE_ENUM)
error (_("Non-integral right operand for \"@\" operator.")); error (_("Non-integral right operand for \"@\" operator."));
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
return allocate_repeat_value (value_type (arg1), return allocate_repeat_value (arg1->type (),
longest_to_int (value_as_long (arg2))); longest_to_int (value_as_long (arg2)));
} }
else else
@ -1671,7 +1671,7 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1) struct value *arg1)
{ {
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (type->code () == TYPE_CODE_METHODPTR if (type->code () == TYPE_CODE_METHODPTR
|| type->code () == TYPE_CODE_MEMBERPTR) || type->code () == TYPE_CODE_MEMBERPTR)
error (_("Attempt to dereference pointer " error (_("Attempt to dereference pointer "
@ -1680,7 +1680,7 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
return value_x_unop (arg1, UNOP_IND, noside); return value_x_unop (arg1, UNOP_IND, noside);
else if (noside == EVAL_AVOID_SIDE_EFFECTS) else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
type = check_typedef (value_type (arg1)); type = check_typedef (arg1->type ());
/* If the type pointed to is dynamic then in order to resolve the /* If the type pointed to is dynamic then in order to resolve the
dynamic properties we must actually dereference the pointer. dynamic properties we must actually dereference the pointer.
@ -1721,7 +1721,7 @@ eval_op_alignof (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1) struct value *arg1)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
/* FIXME: This should be size_t. */ /* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int; struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
ULONGEST align = type_align (type); ULONGEST align = type_align (type);
@ -1759,13 +1759,13 @@ eval_op_preinc (struct type *expect_type, struct expression *exp,
else else
{ {
struct value *arg2; struct value *arg2;
if (ptrmath_type_p (exp->language_defn, value_type (arg1))) if (ptrmath_type_p (exp->language_defn, arg1->type ()))
arg2 = value_ptradd (arg1, 1); arg2 = value_ptradd (arg1, 1);
else else
{ {
struct value *tmp = arg1; struct value *tmp = arg1;
arg2 = value_one (value_type (arg1)); arg2 = value_one (arg1->type ());
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD); arg2 = value_binop (tmp, arg2, BINOP_ADD);
} }
@ -1790,13 +1790,13 @@ eval_op_predec (struct type *expect_type, struct expression *exp,
else else
{ {
struct value *arg2; struct value *arg2;
if (ptrmath_type_p (exp->language_defn, value_type (arg1))) if (ptrmath_type_p (exp->language_defn, arg1->type ()))
arg2 = value_ptradd (arg1, -1); arg2 = value_ptradd (arg1, -1);
else else
{ {
struct value *tmp = arg1; struct value *tmp = arg1;
arg2 = value_one (value_type (arg1)); arg2 = value_one (arg1->type ());
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB); arg2 = value_binop (tmp, arg2, BINOP_SUB);
} }
@ -1823,13 +1823,13 @@ eval_op_postinc (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_non_lval (arg1); struct value *arg3 = value_non_lval (arg1);
struct value *arg2; struct value *arg2;
if (ptrmath_type_p (exp->language_defn, value_type (arg1))) if (ptrmath_type_p (exp->language_defn, arg1->type ()))
arg2 = value_ptradd (arg1, 1); arg2 = value_ptradd (arg1, 1);
else else
{ {
struct value *tmp = arg1; struct value *tmp = arg1;
arg2 = value_one (value_type (arg1)); arg2 = value_one (arg1->type ());
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD); arg2 = value_binop (tmp, arg2, BINOP_ADD);
} }
@ -1857,13 +1857,13 @@ eval_op_postdec (struct type *expect_type, struct expression *exp,
struct value *arg3 = value_non_lval (arg1); struct value *arg3 = value_non_lval (arg1);
struct value *arg2; struct value *arg2;
if (ptrmath_type_p (exp->language_defn, value_type (arg1))) if (ptrmath_type_p (exp->language_defn, arg1->type ()))
arg2 = value_ptradd (arg1, -1); arg2 = value_ptradd (arg1, -1);
else else
{ {
struct value *tmp = arg1; struct value *tmp = arg1;
arg2 = value_one (value_type (arg1)); arg2 = value_one (arg1->type ());
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB); arg2 = value_binop (tmp, arg2, BINOP_SUB);
} }
@ -1897,12 +1897,12 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside); return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside);
else if (op == BINOP_ADD && ptrmath_type_p (exp->language_defn, else if (op == BINOP_ADD && ptrmath_type_p (exp->language_defn,
value_type (arg1)) arg1->type ())
&& is_integral_type (value_type (arg2))) && is_integral_type (arg2->type ()))
arg2 = value_ptradd (arg1, value_as_long (arg2)); arg2 = value_ptradd (arg1, value_as_long (arg2));
else if (op == BINOP_SUB && ptrmath_type_p (exp->language_defn, else if (op == BINOP_SUB && ptrmath_type_p (exp->language_defn,
value_type (arg1)) arg1->type ())
&& is_integral_type (value_type (arg2))) && is_integral_type (arg2->type ()))
arg2 = value_ptradd (arg1, - value_as_long (arg2)); arg2 = value_ptradd (arg1, - value_as_long (arg2));
else else
{ {
@ -1911,7 +1911,7 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
/* For shift and integer exponentiation operations, /* For shift and integer exponentiation operations,
only promote the first argument. */ only promote the first argument. */
if ((op == BINOP_LSH || op == BINOP_RSH || op == BINOP_EXP) if ((op == BINOP_LSH || op == BINOP_RSH || op == BINOP_EXP)
&& is_integral_type (value_type (arg2))) && is_integral_type (arg2->type ()))
unop_promote (exp->language_defn, exp->gdbarch, &tmp); unop_promote (exp->language_defn, exp->gdbarch, &tmp);
else else
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
@ -2115,7 +2115,7 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
if (method) if (method)
{ {
if (value_type (method)->code () != TYPE_CODE_FUNC) if (method->type ()->code () != TYPE_CODE_FUNC)
error (_("method address has symbol information " error (_("method address has symbol information "
"with non-function type; skipping")); "with non-function type; skipping"));
@ -2127,11 +2127,11 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
function descriptors. */ function descriptors. */
if (struct_return) if (struct_return)
called_method called_method
= value_from_pointer (lookup_pointer_type (value_type (method)), = value_from_pointer (lookup_pointer_type (method->type ()),
value_as_address (msg_send_stret)); value_as_address (msg_send_stret));
else else
called_method called_method
= value_from_pointer (lookup_pointer_type (value_type (method)), = value_from_pointer (lookup_pointer_type (method->type ()),
value_as_address (msg_send)); value_as_address (msg_send));
} }
else else
@ -2153,7 +2153,7 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
it's opinion (ie. through "whatis"), it won't offer it's opinion (ie. through "whatis"), it won't offer
it. */ it. */
struct type *callee_type = value_type (called_method); struct type *callee_type = called_method->type ();
if (callee_type && callee_type->code () == TYPE_CODE_PTR) if (callee_type && callee_type->code () == TYPE_CODE_PTR)
callee_type = callee_type->target_type (); callee_type = callee_type->target_type ();
@ -2181,7 +2181,7 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
if (gnu_runtime && (method != NULL)) if (gnu_runtime && (method != NULL))
{ {
/* Function objc_msg_lookup returns a pointer. */ /* Function objc_msg_lookup returns a pointer. */
struct type *tem_type = value_type (called_method); struct type *tem_type = called_method->type ();
tem_type = lookup_pointer_type (lookup_function_type (tem_type)); tem_type = lookup_pointer_type (lookup_function_type (tem_type));
deprecated_set_value_type (called_method, tem_type); deprecated_set_value_type (called_method, tem_type);
called_method = call_function_by_hand (called_method, NULL, args); called_method = call_function_by_hand (called_method, NULL, args);
@ -2206,7 +2206,7 @@ eval_multi_subscript (struct type *expect_type, struct expression *exp,
else else
{ {
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
switch (type->code ()) switch (type->code ())
{ {
@ -2369,7 +2369,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
enum noside noside, int nargs) enum noside noside, int nargs)
{ {
const std::vector<operation_up> &in_args = std::get<2> (m_storage); const std::vector<operation_up> &in_args = std::get<2> (m_storage);
struct type *struct_type = check_typedef (value_type (struct_val)); struct type *struct_type = check_typedef (struct_val->type ());
struct type *field_type; struct type *field_type;
int fieldno = -1; int fieldno = -1;
@ -2408,7 +2408,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
/* Now actually set the field in struct_val. */ /* Now actually set the field in struct_val. */
/* Assign val to field fieldno. */ /* Assign val to field fieldno. */
if (value_type (val) != field_type) if (val->type () != field_type)
val = value_cast (field_type, val); val = value_cast (field_type, val);
bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno); bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno);
@ -2419,7 +2419,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
value_as_long (val), bitpos % 8, bitsize); value_as_long (val), bitpos % 8, bitsize);
else else
memcpy (addr, value_contents (val).data (), memcpy (addr, value_contents (val).data (),
value_type (val)->length ()); val->type ()->length ());
} }
return struct_val; return struct_val;
@ -2468,7 +2468,7 @@ array_operation::evaluate (struct type *expect_type,
element = in_args[index - low_bound]->evaluate (element_type, element = in_args[index - low_bound]->evaluate (element_type,
exp, noside); exp, noside);
if (value_type (element) != element_type) if (element->type () != element_type)
element = value_cast (element_type, element); element = value_cast (element_type, element);
if (index > high_bound) if (index > high_bound)
/* To avoid memory corruption. */ /* To avoid memory corruption. */
@ -2507,7 +2507,7 @@ array_operation::evaluate (struct type *expect_type,
struct value *elem_val; struct value *elem_val;
elem_val = in_args[idx++]->evaluate (element_type, exp, noside); elem_val = in_args[idx++]->evaluate (element_type, exp, noside);
range_low_type = range_high_type = value_type (elem_val); range_low_type = range_high_type = elem_val->type ();
range_low = range_high = value_as_long (elem_val); range_low = range_high = value_as_long (elem_val);
/* Check types of elements to avoid mixture of elements from /* Check types of elements to avoid mixture of elements from
@ -2566,7 +2566,7 @@ unop_extract_operation::evaluate (struct type *expect_type,
value *old_value = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *old_value = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct type *type = get_type (); struct type *type = get_type ();
if (type->length () > value_type (old_value)->length ()) if (type->length () > old_value->type ()->length ())
error (_("length type is larger than the value type")); error (_("length type is larger than the value type"));
struct value *result = allocate_value (type); struct value *result = allocate_value (type);
@ -2585,13 +2585,13 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
{ {
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *type = check_typedef (value_type (x)); struct type *type = check_typedef (x->type ());
if (TYPE_IS_REFERENCE (type)) if (TYPE_IS_REFERENCE (type))
return value_zero (lookup_pointer_type (type->target_type ()), return value_zero (lookup_pointer_type (type->target_type ()),
not_lval); not_lval);
else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x)) else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
return value_zero (lookup_pointer_type (value_type (x)), return value_zero (lookup_pointer_type (x->type ()),
not_lval); not_lval);
else else
error (_("Attempt to take address of " error (_("Attempt to take address of "
@ -2655,7 +2655,7 @@ var_msym_value_operation::evaluate_for_address (struct expression *exp,
value *val = evaluate_var_msym_value (noside, b.objfile, b.minsym); value *val = evaluate_var_msym_value (noside, b.objfile, b.minsym);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *type = lookup_pointer_type (value_type (val)); struct type *type = lookup_pointer_type (val->type ());
return value_zero (type, not_lval); return value_zero (type, not_lval);
} }
else else
@ -2676,7 +2676,7 @@ unop_memval_type_operation::evaluate_for_address (struct expression *exp,
{ {
value *typeval = std::get<0> (m_storage)->evaluate (nullptr, exp, value *typeval = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (typeval); struct type *type = typeval->type ();
return value_cast (lookup_pointer_type (type), return value_cast (lookup_pointer_type (type),
std::get<1> (m_storage)->evaluate (nullptr, exp, noside)); std::get<1> (m_storage)->evaluate (nullptr, exp, noside));
} }
@ -2751,7 +2751,7 @@ value *
operation::evaluate_for_sizeof (struct expression *exp, enum noside noside) operation::evaluate_for_sizeof (struct expression *exp, enum noside noside)
{ {
value *val = evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS); value *val = evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS);
return evaluate_subexp_for_sizeof_base (exp, value_type (val)); return evaluate_subexp_for_sizeof_base (exp, val->type ());
} }
value * value *
@ -2762,7 +2762,7 @@ var_msym_value_operation::evaluate_for_sizeof (struct expression *exp,
const bound_minimal_symbol &b = std::get<0> (m_storage); const bound_minimal_symbol &b = std::get<0> (m_storage);
value *mval = evaluate_var_msym_value (noside, b.objfile, b.minsym); value *mval = evaluate_var_msym_value (noside, b.objfile, b.minsym);
struct type *type = value_type (mval); struct type *type = mval->type ();
if (type->code () == TYPE_CODE_ERROR) if (type->code () == TYPE_CODE_ERROR)
error_unknown_type (b.minsym->print_name ()); error_unknown_type (b.minsym->print_name ());
@ -2779,7 +2779,7 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp,
{ {
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
type = check_typedef (type->target_type ()); type = check_typedef (type->target_type ());
@ -2795,7 +2795,7 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp,
struct type *size_type struct type *size_type
= builtin_type (exp->gdbarch)->builtin_int; = builtin_type (exp->gdbarch)->builtin_int;
return value_from_longest return value_from_longest
(size_type, (LONGEST) value_type (val)->length ()); (size_type, (LONGEST) val->type ()->length ());
} }
} }
} }
@ -2810,13 +2810,13 @@ unop_ind_base_operation::evaluate_for_sizeof (struct expression *exp,
{ {
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (!type->is_pointer_or_reference () if (!type->is_pointer_or_reference ()
&& type->code () != TYPE_CODE_ARRAY) && type->code () != TYPE_CODE_ARRAY)
error (_("Attempt to take contents of a non-pointer value.")); error (_("Attempt to take contents of a non-pointer value."));
type = type->target_type (); type = type->target_type ();
if (is_dynamic_type (type)) if (is_dynamic_type (type))
type = value_type (value_ind (val)); type = value_ind (val)->type ();
/* FIXME: This should be size_t. */ /* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int; struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
return value_from_longest (size_type, (LONGEST) type->length ()); return value_from_longest (size_type, (LONGEST) type->length ());
@ -2835,7 +2835,7 @@ unop_memval_type_operation::evaluate_for_sizeof (struct expression *exp,
{ {
value *typeval = std::get<0> (m_storage)->evaluate (nullptr, exp, value *typeval = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
return evaluate_subexp_for_sizeof_base (exp, value_type (typeval)); return evaluate_subexp_for_sizeof_base (exp, typeval->type ());
} }
value * value *
@ -2846,7 +2846,7 @@ var_value_operation::evaluate_for_sizeof (struct expression *exp,
if (is_dynamic_type (type)) if (is_dynamic_type (type))
{ {
value *val = evaluate (nullptr, exp, EVAL_NORMAL); value *val = evaluate (nullptr, exp, EVAL_NORMAL);
type = value_type (val); type = val->type ();
if (type->code () == TYPE_CODE_ARRAY) if (type->code () == TYPE_CODE_ARRAY)
{ {
/* FIXME: This should be size_t. */ /* FIXME: This should be size_t. */

View file

@ -1330,7 +1330,7 @@ public:
value *lhs value *lhs
= std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside); = std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
value *rhs value *rhs
= std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp, = std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
noside); noside);
return FUNC (expect_type, exp, noside, OP, lhs, rhs); return FUNC (expect_type, exp, noside, OP, lhs, rhs);
} }
@ -1613,7 +1613,7 @@ public:
|| sub_op == STRUCTOP_PTR || sub_op == STRUCTOP_PTR
|| sub_op == OP_SCOPE) || sub_op == OP_SCOPE)
{ {
struct type *type = value_type (result); struct type *type = result->type ();
if (!TYPE_IS_REFERENCE (type)) if (!TYPE_IS_REFERENCE (type))
{ {
@ -1804,7 +1804,7 @@ public:
value *typeval value *typeval
= std::get<0> (m_storage)->evaluate (expect_type, exp, = std::get<0> (m_storage)->evaluate (expect_type, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (typeval); struct type *type = typeval->type ();
value *val = std::get<1> (m_storage)->evaluate (expect_type, exp, noside); value *val = std::get<1> (m_storage)->evaluate (expect_type, exp, noside);
return eval_op_memval (expect_type, exp, noside, val, type); return eval_op_memval (expect_type, exp, noside, val, type);
} }
@ -1891,7 +1891,7 @@ public:
many array elements". */ many array elements". */
struct type *xtype = (VALUE_LVAL (lhs) == lval_internalvar struct type *xtype = (VALUE_LVAL (lhs) == lval_internalvar
? nullptr ? nullptr
: value_type (lhs)); : lhs->type ());
value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
@ -2030,7 +2030,7 @@ public:
{ {
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
return std::get<1> (m_storage)->evaluate_for_cast (value_type (val), return std::get<1> (m_storage)->evaluate_for_cast (val->type (),
exp, noside); exp, noside);
} }
@ -2064,7 +2064,7 @@ public:
{ {
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (val); struct type *type = val->type ();
value *rhs = std::get<1> (m_storage)->evaluate (type, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (type, exp, noside);
return FUNC (type, rhs); return FUNC (type, rhs);
} }

View file

@ -127,7 +127,7 @@ fortran_bounds_all_dims (bool lbound_p,
struct gdbarch *gdbarch, struct gdbarch *gdbarch,
struct value *array) struct value *array)
{ {
type *array_type = check_typedef (value_type (array)); type *array_type = check_typedef (array->type ());
int ndimensions = calc_f77_array_dims (array_type); int ndimensions = calc_f77_array_dims (array_type);
/* Allocate a result value of the correct type. */ /* Allocate a result value of the correct type. */
@ -156,9 +156,9 @@ fortran_bounds_all_dims (bool lbound_p,
/* And copy the value into the result value. */ /* And copy the value into the result value. */
struct value *v = value_from_longest (elm_type, b); struct value *v = value_from_longest (elm_type, b);
gdb_assert (dst_offset + value_type (v)->length () gdb_assert (dst_offset + v->type ()->length ()
<= value_type (result)->length ()); <= result->type ()->length ());
gdb_assert (value_type (v)->length () == elm_len); gdb_assert (v->type ()->length () == elm_len);
value_contents_copy (result, dst_offset, v, 0, elm_len); value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */ /* Peel another dimension of the array. */
@ -178,7 +178,7 @@ fortran_bounds_for_dimension (bool lbound_p, value *array, value *dim_val,
type* result_type) type* result_type)
{ {
/* Check the requested dimension is valid for this array. */ /* Check the requested dimension is valid for this array. */
type *array_type = check_typedef (value_type (array)); type *array_type = check_typedef (array->type ());
int ndimensions = calc_f77_array_dims (array_type); int ndimensions = calc_f77_array_dims (array_type);
long dim = value_as_long (dim_val); long dim = value_as_long (dim_val);
if (dim < 1 || dim > ndimensions) if (dim < 1 || dim > ndimensions)
@ -283,8 +283,8 @@ protected:
void copy_element_to_dest (struct value *elt) void copy_element_to_dest (struct value *elt)
{ {
value_contents_copy (m_dest, m_dest_offset, elt, 0, value_contents_copy (m_dest, m_dest_offset, elt, 0,
value_type (elt)->length ()); elt->type ()->length ());
m_dest_offset += value_type (elt)->length (); m_dest_offset += elt->type ()->length ();
} }
/* The value being written to. */ /* The value being written to. */
@ -394,7 +394,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
/* All Fortran pointers should have the associated property, this is /* All Fortran pointers should have the associated property, this is
how we know the pointer is pointing at something or not. */ how we know the pointer is pointing at something or not. */
struct type *pointer_type = check_typedef (value_type (pointer)); struct type *pointer_type = check_typedef (pointer->type ());
if (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr if (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
&& pointer_type->code () != TYPE_CODE_PTR) && pointer_type->code () != TYPE_CODE_PTR)
error (_("ASSOCIATED can only be applied to pointers")); error (_("ASSOCIATED can only be applied to pointers"));
@ -431,7 +431,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
/* The two argument case, is POINTER associated with TARGET? */ /* The two argument case, is POINTER associated with TARGET? */
struct type *target_type = check_typedef (value_type (target)); struct type *target_type = check_typedef (target->type ());
struct type *pointer_target_type; struct type *pointer_target_type;
if (pointer_type->code () == TYPE_CODE_PTR) if (pointer_type->code () == TYPE_CODE_PTR)
@ -588,7 +588,7 @@ static value *
fortran_array_size (value *array, value *dim_val, type *result_type) fortran_array_size (value *array, value *dim_val, type *result_type)
{ {
/* Check that ARRAY is the correct type. */ /* Check that ARRAY is the correct type. */
struct type *array_type = check_typedef (value_type (array)); struct type *array_type = check_typedef (array->type ());
if (array_type->code () != TYPE_CODE_ARRAY) if (array_type->code () != TYPE_CODE_ARRAY)
error (_("SIZE can only be applied to arrays")); error (_("SIZE can only be applied to arrays"));
if (type_not_allocated (array_type) || type_not_associated (array_type)) if (type_not_allocated (array_type) || type_not_associated (array_type))
@ -600,7 +600,7 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
if (dim_val != nullptr) if (dim_val != nullptr)
{ {
if (check_typedef (value_type (dim_val))->code () != TYPE_CODE_INT) if (check_typedef (dim_val->type ())->code () != TYPE_CODE_INT)
error (_("DIM argument to SIZE must be an integer")); error (_("DIM argument to SIZE must be an integer"));
dim = (int) value_as_long (dim_val); dim = (int) value_as_long (dim_val);
@ -696,7 +696,7 @@ static struct value *
fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang, fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
struct value *val) struct value *val)
{ {
struct type *val_type = check_typedef (value_type (val)); struct type *val_type = check_typedef (val->type ());
/* If we are passed an array that is either not allocated, or not /* If we are passed an array that is either not allocated, or not
associated, then this is explicitly not allowed according to the associated, then this is explicitly not allowed according to the
@ -741,9 +741,9 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
/* And copy the value into the result value. */ /* And copy the value into the result value. */
struct value *v = value_from_longest (elm_type, dim_size); struct value *v = value_from_longest (elm_type, dim_size);
gdb_assert (dst_offset + value_type (v)->length () gdb_assert (dst_offset + v->type ()->length ()
<= value_type (result)->length ()); <= result->type ()->length ());
gdb_assert (value_type (v)->length () == elm_len); gdb_assert (v->type ()->length () == elm_len);
value_contents_copy (result, dst_offset, v, 0, elm_len); value_contents_copy (result, dst_offset, v, 0, elm_len);
/* Peel another dimension of the array. */ /* Peel another dimension of the array. */
@ -772,14 +772,14 @@ eval_op_f_abs (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1) struct value *arg1)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
{ {
double d double d
= fabs (target_float_to_host_double (value_contents (arg1).data (), = fabs (target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1))); arg1->type ()));
return value_from_host_double (type, d); return value_from_host_double (type, d);
} }
case TYPE_CODE_INT: case TYPE_CODE_INT:
@ -800,8 +800,8 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
if (type->code () != value_type (arg2)->code ()) if (type->code () != arg2->type ()->code ())
error (_("non-matching types for parameters to MOD ()")); error (_("non-matching types for parameters to MOD ()"));
switch (type->code ()) switch (type->code ())
{ {
@ -809,10 +809,10 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
{ {
double d1 double d1
= target_float_to_host_double (value_contents (arg1).data (), = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1)); arg1->type ());
double d2 double d2
= target_float_to_host_double (value_contents (arg2).data (), = target_float_to_host_double (value_contents (arg2).data (),
value_type (arg2)); arg2->type ());
double d3 = fmod (d1, d2); double d3 = fmod (d1, d2);
return value_from_host_double (type, d3); return value_from_host_double (type, d3);
} }
@ -823,7 +823,7 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
if (v2 == 0) if (v2 == 0)
error (_("calling MOD (N, 0) is undefined")); error (_("calling MOD (N, 0) is undefined"));
LONGEST v3 = v1 - (v1 / v2) * v2; LONGEST v3 = v1 - (v1 / v2) * v2;
return value_from_longest (value_type (arg1), v3); return value_from_longest (arg1->type (), v3);
} }
} }
error (_("MOD of type %s not supported"), TYPE_SAFE_NAME (type)); error (_("MOD of type %s not supported"), TYPE_SAFE_NAME (type));
@ -836,10 +836,10 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
static value * static value *
fortran_ceil_operation (value *arg1, type *result_type) fortran_ceil_operation (value *arg1, type *result_type)
{ {
if (value_type (arg1)->code () != TYPE_CODE_FLT) if (arg1->type ()->code () != TYPE_CODE_FLT)
error (_("argument to CEILING must be of type float")); error (_("argument to CEILING must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (), double val = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1)); arg1->type ());
val = ceil (val); val = ceil (val);
return value_from_longest (result_type, val); return value_from_longest (result_type, val);
} }
@ -875,10 +875,10 @@ eval_op_f_ceil (type *expect_type, expression *exp, noside noside,
static value * static value *
fortran_floor_operation (value *arg1, type *result_type) fortran_floor_operation (value *arg1, type *result_type)
{ {
if (value_type (arg1)->code () != TYPE_CODE_FLT) if (arg1->type ()->code () != TYPE_CODE_FLT)
error (_("argument to FLOOR must be of type float")); error (_("argument to FLOOR must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (), double val = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1)); arg1->type ());
val = floor (val); val = floor (val);
return value_from_longest (result_type, val); return value_from_longest (result_type, val);
} }
@ -915,8 +915,8 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
if (type->code () != value_type (arg2)->code ()) if (type->code () != arg2->type ()->code ())
error (_("non-matching types for parameters to MODULO ()")); error (_("non-matching types for parameters to MODULO ()"));
/* MODULO(A, P) = A - FLOOR (A / P) * P */ /* MODULO(A, P) = A - FLOOR (A / P) * P */
switch (type->code ()) switch (type->code ())
@ -928,16 +928,16 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
LONGEST result = a - (a / p) * p; LONGEST result = a - (a / p) * p;
if (result != 0 && (a < 0) != (p < 0)) if (result != 0 && (a < 0) != (p < 0))
result += p; result += p;
return value_from_longest (value_type (arg1), result); return value_from_longest (arg1->type (), result);
} }
case TYPE_CODE_FLT: case TYPE_CODE_FLT:
{ {
double a double a
= target_float_to_host_double (value_contents (arg1).data (), = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1)); arg1->type ());
double p double p
= target_float_to_host_double (value_contents (arg2).data (), = target_float_to_host_double (value_contents (arg2).data (),
value_type (arg2)); arg2->type ());
double result = fmod (a, p); double result = fmod (a, p);
if (result != 0 && (a < 0.0) != (p < 0.0)) if (result != 0 && (a < 0.0) != (p < 0.0))
result += p; result += p;
@ -957,11 +957,11 @@ eval_op_f_cmplx (type *expect_type, expression *exp, noside noside,
type *result_type = builtin_f_type (exp->gdbarch)->builtin_complex; type *result_type = builtin_f_type (exp->gdbarch)->builtin_complex;
if (value_type (arg1)->code () == TYPE_CODE_COMPLEX) if (arg1->type ()->code () == TYPE_CODE_COMPLEX)
return value_cast (result_type, arg1); return value_cast (result_type, arg1);
else else
return value_literal_complex (arg1, return value_literal_complex (arg1,
value_zero (value_type (arg1), not_lval), value_zero (arg1->type (), not_lval),
result_type); result_type);
} }
@ -973,8 +973,8 @@ eval_op_f_cmplx (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (value_type (arg1)->code () == TYPE_CODE_COMPLEX if (arg1->type ()->code () == TYPE_CODE_COMPLEX
|| value_type (arg2)->code () == TYPE_CODE_COMPLEX) || arg2->type ()->code () == TYPE_CODE_COMPLEX)
error (_("Types of arguments for CMPLX called with more then one argument " error (_("Types of arguments for CMPLX called with more then one argument "
"must be REAL or INTEGER")); "must be REAL or INTEGER"));
@ -989,8 +989,8 @@ eval_op_f_cmplx (type *expect_type, expression *exp, noside noside,
exp_opcode opcode, value *arg1, value *arg2, type *kind_arg) exp_opcode opcode, value *arg1, value *arg2, type *kind_arg)
{ {
gdb_assert (kind_arg->code () == TYPE_CODE_COMPLEX); gdb_assert (kind_arg->code () == TYPE_CODE_COMPLEX);
if (value_type (arg1)->code () == TYPE_CODE_COMPLEX if (arg1->type ()->code () == TYPE_CODE_COMPLEX
|| value_type (arg2)->code () == TYPE_CODE_COMPLEX) || arg2->type ()->code () == TYPE_CODE_COMPLEX)
error (_("Types of arguments for CMPLX called with more then one argument " error (_("Types of arguments for CMPLX called with more then one argument "
"must be REAL or INTEGER")); "must be REAL or INTEGER"));
@ -1005,7 +1005,7 @@ eval_op_f_kind (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1) struct value *arg1)
{ {
struct type *type = value_type (arg1); struct type *type = arg1->type ();
switch (type->code ()) switch (type->code ())
{ {
@ -1030,7 +1030,7 @@ eval_op_f_allocated (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (type->code () != TYPE_CODE_ARRAY) if (type->code () != TYPE_CODE_ARRAY)
error (_("ALLOCATED can only be applied to arrays")); error (_("ALLOCATED can only be applied to arrays"));
struct type *result_type struct type *result_type
@ -1052,7 +1052,7 @@ eval_op_f_rank (struct type *expect_type,
struct type *result_type struct type *result_type
= builtin_f_type (exp->gdbarch)->builtin_integer; = builtin_f_type (exp->gdbarch)->builtin_integer;
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (type->code () != TYPE_CODE_ARRAY) if (type->code () != TYPE_CODE_ARRAY)
return value_from_longest (result_type, 0); return value_from_longest (result_type, 0);
LONGEST ndim = calc_f77_array_dims (type); LONGEST ndim = calc_f77_array_dims (type);
@ -1092,7 +1092,7 @@ fortran_undetermined::value_subarray (value *array,
struct expression *exp, struct expression *exp,
enum noside noside) enum noside noside)
{ {
type *original_array_type = check_typedef (value_type (array)); type *original_array_type = check_typedef (array->type ());
bool is_string_p = original_array_type->code () == TYPE_CODE_STRING; bool is_string_p = original_array_type->code () == TYPE_CODE_STRING;
const std::vector<operation_up> &ops = std::get<1> (m_storage); const std::vector<operation_up> &ops = std::get<1> (m_storage);
int nargs = ops.size (); int nargs = ops.size ();
@ -1443,7 +1443,7 @@ fortran_undetermined::value_subarray (value *array,
struct value *dest = allocate_value (repacked_array_type); struct value *dest = allocate_value (repacked_array_type);
if (value_lazy (array) if (value_lazy (array)
|| (total_offset + array_slice_type->length () || (total_offset + array_slice_type->length ()
> check_typedef (value_type (array))->length ())) > check_typedef (array->type ())->length ()))
{ {
fortran_array_walker<fortran_lazy_array_repacker_impl> p fortran_array_walker<fortran_lazy_array_repacker_impl> p
(array_slice_type, value_address (array) + total_offset, dest); (array_slice_type, value_address (array) + total_offset, dest);
@ -1468,7 +1468,7 @@ fortran_undetermined::value_subarray (value *array,
contents we're looking for exist. */ contents we're looking for exist. */
if (value_lazy (array) if (value_lazy (array)
|| (total_offset + array_slice_type->length () || (total_offset + array_slice_type->length ()
> check_typedef (value_type (array))->length ())) > check_typedef (array->type ())->length ()))
array = value_at_lazy (array_slice_type, array = value_at_lazy (array_slice_type,
value_address (array) + total_offset); value_address (array) + total_offset);
else else
@ -1492,9 +1492,9 @@ fortran_undetermined::evaluate (struct type *expect_type,
{ {
value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS if (noside == EVAL_AVOID_SIDE_EFFECTS
&& is_dynamic_type (value_type (callee))) && is_dynamic_type (callee->type ()))
callee = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL); callee = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL);
struct type *type = check_typedef (value_type (callee)); struct type *type = check_typedef (callee->type ());
enum type_code code = type->code (); enum type_code code = type->code ();
if (code == TYPE_CODE_PTR) if (code == TYPE_CODE_PTR)
@ -1510,7 +1510,7 @@ fortran_undetermined::evaluate (struct type *expect_type,
|| target_type->code () == TYPE_CODE_FUNC) || target_type->code () == TYPE_CODE_FUNC)
{ {
callee = value_ind (callee); callee = value_ind (callee);
type = check_typedef (value_type (callee)); type = check_typedef (callee->type ());
code = type->code (); code = type->code ();
} }
} }
@ -1534,7 +1534,7 @@ fortran_undetermined::evaluate (struct type *expect_type,
for (int tem = 0; tem < argvec.size (); tem++) for (int tem = 0; tem < argvec.size (); tem++)
argvec[tem] = fortran_prepare_argument (exp, actual[tem].get (), argvec[tem] = fortran_prepare_argument (exp, actual[tem].get (),
tem, is_internal_func, tem, is_internal_func,
value_type (callee), callee->type (),
noside); noside);
return evaluate_subexp_do_call (exp, noside, callee, argvec, return evaluate_subexp_do_call (exp, noside, callee, argvec,
nullptr, expect_type); nullptr, expect_type);
@ -1552,7 +1552,7 @@ fortran_bound_1arg::evaluate (struct type *expect_type,
{ {
bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND; bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
fortran_require_array (value_type (arg1), lbound_p); fortran_require_array (arg1->type (), lbound_p);
return fortran_bounds_all_dims (lbound_p, exp->gdbarch, arg1); return fortran_bounds_all_dims (lbound_p, exp->gdbarch, arg1);
} }
@ -1563,11 +1563,11 @@ fortran_bound_2arg::evaluate (struct type *expect_type,
{ {
bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND; bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
fortran_require_array (value_type (arg1), lbound_p); fortran_require_array (arg1->type (), lbound_p);
/* User asked for the bounds of a specific dimension of the array. */ /* User asked for the bounds of a specific dimension of the array. */
value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
type *type_arg2 = check_typedef (value_type (arg2)); type *type_arg2 = check_typedef (arg2->type ());
if (type_arg2->code () != TYPE_CODE_INT) if (type_arg2->code () != TYPE_CODE_INT)
{ {
if (lbound_p) if (lbound_p)
@ -1587,11 +1587,11 @@ fortran_bound_3arg::evaluate (type *expect_type,
{ {
const bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND; const bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
fortran_require_array (value_type (arg1), lbound_p); fortran_require_array (arg1->type (), lbound_p);
/* User asked for the bounds of a specific dimension of the array. */ /* User asked for the bounds of a specific dimension of the array. */
value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
type *type_arg2 = check_typedef (value_type (arg2)); type *type_arg2 = check_typedef (arg2->type ());
if (type_arg2->code () != TYPE_CODE_INT) if (type_arg2->code () != TYPE_CODE_INT)
{ {
if (lbound_p) if (lbound_p)
@ -1618,7 +1618,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
const char *str = std::get<1> (m_storage).c_str (); const char *str = std::get<1> (m_storage).c_str ();
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *type = lookup_struct_elt_type (value_type (arg1), str, 1); struct type *type = lookup_struct_elt_type (arg1->type (), str, 1);
if (type != nullptr && is_dynamic_type (type)) if (type != nullptr && is_dynamic_type (type))
arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL); arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL);
@ -1628,7 +1628,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *elt_type = value_type (elt); struct type *elt_type = elt->type ();
if (is_dynamic_type (elt_type)) if (is_dynamic_type (elt_type))
{ {
const gdb_byte *valaddr = value_contents_for_printing (elt).data (); const gdb_byte *valaddr = value_contents_for_printing (elt).data ();
@ -1874,7 +1874,7 @@ fortran_argument_convert (struct value *value, bool is_artificial)
convenience variables and user input. */ convenience variables and user input. */
if (VALUE_LVAL (value) != lval_memory) if (VALUE_LVAL (value) != lval_memory)
{ {
struct type *type = value_type (value); struct type *type = value->type ();
const int length = type->length (); const int length = type->length ();
const CORE_ADDR addr const CORE_ADDR addr
= value_as_long (value_allocate_space_in_inferior (length)); = value_as_long (value_allocate_space_in_inferior (length));
@ -1953,8 +1953,8 @@ fortran_prepare_argument (struct expression *exp,
struct type * struct type *
fortran_preserve_arg_pointer (struct value *arg, struct type *type) fortran_preserve_arg_pointer (struct value *arg, struct type *type)
{ {
if (value_type (arg)->code () == TYPE_CODE_PTR) if (arg->type ()->code () == TYPE_CODE_PTR)
return value_type (arg); return arg->type ();
return type; return type;
} }

View file

@ -450,7 +450,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse, int recurse,
const struct value_print_options *options) const const struct value_print_options *options) const
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
int printed_field = 0; /* Number of fields printed. */ int printed_field = 0; /* Number of fields printed. */
struct type *elttype; struct type *elttype;

View file

@ -162,7 +162,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
s = skip_spaces (s); s = skip_spaces (s);
v = parse_to_comma_and_eval (&s); v = parse_to_comma_and_eval (&s);
t = value_type (v); t = v->type ();
if (size != '\0') if (size != '\0')
{ {

View file

@ -844,7 +844,7 @@ read_frame_register_value (struct value *value, frame_info_ptr frame)
LONGEST offset = 0; LONGEST offset = 0;
LONGEST reg_offset = value_offset (value); LONGEST reg_offset = value_offset (value);
int regnum = VALUE_REGNUM (value); int regnum = VALUE_REGNUM (value);
int len = type_length_units (check_typedef (value_type (value))); int len = type_length_units (check_typedef (value->type ()));
gdb_assert (VALUE_LVAL (value) == lval_register); gdb_assert (VALUE_LVAL (value) == lval_register);
@ -859,7 +859,7 @@ read_frame_register_value (struct value *value, frame_info_ptr frame)
while (len > 0) while (len > 0)
{ {
struct value *regval = get_frame_register_value (frame, regnum); struct value *regval = get_frame_register_value (frame, regnum);
int reg_len = type_length_units (value_type (regval)) - reg_offset; int reg_len = type_length_units (regval->type ()) - reg_offset;
/* If the register length is larger than the number of bytes /* If the register length is larger than the number of bytes
remaining to copy, then only copy the appropriate bytes. */ remaining to copy, then only copy the appropriate bytes. */

View file

@ -1202,9 +1202,9 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum,
{ {
if (!*optimizedp && !*unavailablep) if (!*optimizedp && !*unavailablep)
memcpy (bufferp, value_contents_all (value).data (), memcpy (bufferp, value_contents_all (value).data (),
value_type (value)->length ()); value->type ()->length ());
else else
memset (bufferp, 0, value_type (value)->length ()); memset (bufferp, 0, value->type ()->length ());
} }
/* Dispose of the new value. This prevents watchpoints from /* Dispose of the new value. This prevents watchpoints from

View file

@ -1211,7 +1211,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
stack_space = 0; stack_space = 0;
for (argnum = 0; argnum < nargs; ++argnum) for (argnum = 0; argnum < nargs; ++argnum)
stack_space += align_up (value_type (args[argnum])->length (), 4); stack_space += align_up (args[argnum]->type ()->length (), 4);
stack_space -= (6 * 4); stack_space -= (6 * 4);
if (stack_space > 0) if (stack_space > 0)
@ -1231,7 +1231,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argnum = 0; argnum < nargs; ++argnum) for (argnum = 0; argnum < nargs; ++argnum)
{ {
arg = args[argnum]; arg = args[argnum];
arg_type = check_typedef (value_type (arg)); arg_type = check_typedef (arg->type ());
len = arg_type->length (); len = arg_type->length ();
typecode = arg_type->code (); typecode = arg_type->code ();

View file

@ -4006,7 +4006,7 @@ is_unique_ancestor (struct type *base, struct value *val)
{ {
int offset = -1; int offset = -1;
return is_unique_ancestor_worker (base, value_type (val), &offset, return is_unique_ancestor_worker (base, val->type (), &offset,
value_contents_for_printing (val).data (), value_contents_for_printing (val).data (),
value_embedded_offset (val), value_embedded_offset (val),
value_address (val), val) == 1; value_address (val), val) == 1;
@ -4177,7 +4177,7 @@ rank_function (gdb::array_view<type *> parms,
size_t min_len = std::min (parms.size (), args.size ()); size_t min_len = std::min (parms.size (), args.size ());
for (size_t i = 0; i < min_len; i++) for (size_t i = 0; i < min_len; i++)
bv.push_back (rank_one_type (parms[i], value_type (args[i]), bv.push_back (rank_one_type (parms[i], args[i]->type (),
args[i])); args[i]));
/* If more arguments than parameters, add dummy entries. */ /* If more arguments than parameters, add dummy entries. */
@ -4541,7 +4541,7 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
return rank_one_type (parm->target_type (), arg, NULL); return rank_one_type (parm->target_type (), arg, NULL);
case TYPE_CODE_INT: case TYPE_CODE_INT:
if (value != NULL && value_type (value)->code () == TYPE_CODE_INT) if (value != NULL && value->type ()->code () == TYPE_CODE_INT)
{ {
if (value_as_long (value) == 0) if (value_as_long (value) == 0)
{ {

View file

@ -932,7 +932,7 @@ struct type
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef. /* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value so you only have to call check_typedef once. Since allocate_value
calls check_typedef, VALUE_TYPE (X)->length () is safe. */ calls check_typedef, X->type ()->length () is safe. */
ULONGEST length () const ULONGEST length () const
{ {
return this->m_length; return this->m_length;

View file

@ -85,7 +85,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
struct type * type, int offset) struct type * type, int offset)
{ {
struct value *arg1 = *arg1p; struct value *arg1 = *arg1p;
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *entry_type; struct type *entry_type;
/* First, get the virtual function table pointer. That comes /* First, get the virtual function table pointer. That comes
with a strange type, so cast it to type `pointer to long' (which with a strange type, so cast it to type `pointer to long' (which
@ -113,7 +113,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
struct value *tmp = value_cast (context, value_addr (arg1)); struct value *tmp = value_cast (context, value_addr (arg1));
arg1 = value_ind (tmp); arg1 = value_ind (tmp);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
} }
context = type1; context = type1;
@ -132,8 +132,8 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
/* With older versions of g++, the vtbl field pointed to an array /* With older versions of g++, the vtbl field pointed to an array
of structures. Nowadays it points directly to the structure. */ of structures. Nowadays it points directly to the structure. */
if (value_type (vtbl)->code () == TYPE_CODE_PTR if (vtbl->type ()->code () == TYPE_CODE_PTR
&& value_type (vtbl)->target_type ()->code () == TYPE_CODE_ARRAY) && vtbl->type ()->target_type ()->code () == TYPE_CODE_ARRAY)
{ {
/* Handle the case where the vtbl field points to an /* Handle the case where the vtbl field points to an
array of structures. */ array of structures. */
@ -153,7 +153,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
entry = value_ind (vtbl); entry = value_ind (vtbl);
} }
entry_type = check_typedef (value_type (entry)); entry_type = check_typedef (entry->type ());
if (entry_type->code () == TYPE_CODE_STRUCT) if (entry_type->code () == TYPE_CODE_STRUCT)
{ {
@ -203,7 +203,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
*using_enc = 0; *using_enc = 0;
/* Get declared type. */ /* Get declared type. */
known_type = value_type (v); known_type = v->type ();
known_type = check_typedef (known_type); known_type = check_typedef (known_type);
/* RTTI works only or class objects. */ /* RTTI works only or class objects. */
if (known_type->code () != TYPE_CODE_STRUCT) if (known_type->code () != TYPE_CODE_STRUCT)

View file

@ -298,7 +298,7 @@ gnuv3_rtti_type (struct value *value,
int *full_p, LONGEST *top_p, int *using_enc_p) int *full_p, LONGEST *top_p, int *using_enc_p)
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
struct type *values_type = check_typedef (value_type (value)); struct type *values_type = check_typedef (value->type ());
struct value *vtable; struct value *vtable;
struct minimal_symbol *vtable_symbol; struct minimal_symbol *vtable_symbol;
const char *vtable_symbol_name; const char *vtable_symbol_name;
@ -389,7 +389,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gdbarch, struct value *container,
struct value *vtable, *vfn; struct value *vtable, *vfn;
/* Every class with virtual functions must have a vtable. */ /* Every class with virtual functions must have a vtable. */
vtable = gnuv3_get_vtable (gdbarch, value_type (container), vtable = gnuv3_get_vtable (gdbarch, container->type (),
value_as_address (value_addr (container))); value_as_address (value_addr (container)));
gdb_assert (vtable != NULL); gdb_assert (vtable != NULL);
@ -419,7 +419,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
struct fn_field *f, int j, struct fn_field *f, int j,
struct type *vfn_base, int offset) struct type *vfn_base, int offset)
{ {
struct type *values_type = check_typedef (value_type (*value_p)); struct type *values_type = check_typedef ((*value_p)->type ());
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
/* Some simple sanity checks. */ /* Some simple sanity checks. */
@ -740,10 +740,10 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
LONGEST adjustment; LONGEST adjustment;
int vbit; int vbit;
self_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr))); self_type = TYPE_SELF_TYPE (check_typedef (method_ptr->type ()));
final_type = lookup_pointer_type (self_type); final_type = lookup_pointer_type (self_type);
method_type = check_typedef (value_type (method_ptr))->target_type (); method_type = check_typedef (method_ptr->type ())->target_type ();
/* Extract the pointer to member. */ /* Extract the pointer to member. */
gdbarch = self_type->arch (); gdbarch = self_type->arch ();
@ -845,7 +845,7 @@ compute_vtable_size (htab_t offset_hash,
struct value *value) struct value *value)
{ {
int i; int i;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
void **slot; void **slot;
struct value_and_voffset search_vo, *current_vo; struct value_and_voffset search_vo, *current_vo;
@ -902,7 +902,7 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
struct value_print_options *opts) struct value_print_options *opts)
{ {
int i; int i;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
struct value *vtable; struct value *vtable;
CORE_ADDR vt_addr; CORE_ADDR vt_addr;
@ -963,11 +963,11 @@ gnuv3_print_vtable (struct value *value)
int count; int count;
value = coerce_ref (value); value = coerce_ref (value);
type = check_typedef (value_type (value)); type = check_typedef (value->type ());
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
{ {
value = value_ind (value); value = value_ind (value);
type = check_typedef (value_type (value)); type = check_typedef (value->type ());
} }
get_user_print_options (&opts); get_user_print_options (&opts);
@ -976,7 +976,7 @@ gnuv3_print_vtable (struct value *value)
if (opts.objectprint) if (opts.objectprint)
{ {
value = value_full_object (value, NULL, 0, 0, 0); value = value_full_object (value, NULL, 0, 0, 0);
type = check_typedef (value_type (value)); type = check_typedef (value->type ());
} }
gdbarch = type->arch (); gdbarch = type->arch ();
@ -1105,7 +1105,7 @@ gnuv3_get_typeid (struct value *value)
if (value_lval_const (value) == lval_memory) if (value_lval_const (value) == lval_memory)
value = coerce_ref (value); value = coerce_ref (value);
type = check_typedef (value_type (value)); type = check_typedef (value->type ());
/* In the non_lvalue case, a reference might have slipped through /* In the non_lvalue case, a reference might have slipped through
here. */ here. */
@ -1168,7 +1168,7 @@ gnuv3_get_typeid (struct value *value)
static std::string static std::string
gnuv3_get_typename_from_type_info (struct value *type_info_ptr) gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
{ {
struct gdbarch *gdbarch = value_type (type_info_ptr)->arch (); struct gdbarch *gdbarch = type_info_ptr->type ()->arch ();
struct bound_minimal_symbol typeinfo_sym; struct bound_minimal_symbol typeinfo_sym;
CORE_ADDR addr; CORE_ADDR addr;
const char *symname; const char *symname;
@ -1209,7 +1209,7 @@ gnuv3_get_type_from_type_info (struct value *type_info_ptr)
std::string type_name = gnuv3_get_typename_from_type_info (type_info_ptr); std::string type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
expression_up expr (parse_expression (type_name.c_str ())); expression_up expr (parse_expression (type_name.c_str ()));
struct value *type_val = evaluate_type (expr.get ()); struct value *type_val = evaluate_type (expr.get ());
return value_type (type_val); return type_val->type ();
} }
/* Determine if we are currently in a C++ thunk. If so, get the address /* Determine if we are currently in a C++ thunk. If so, get the address

View file

@ -91,7 +91,7 @@ go_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse, int recurse,
const struct value_print_options *options) const const struct value_print_options *options) const
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
switch (type->code ()) switch (type->code ())
{ {

View file

@ -109,7 +109,7 @@ vlscm_unop_gdbthrow (enum valscm_unary_opcode opcode, SCM x,
res_val = arg1; res_val = arg1;
break; break;
case VALSCM_ABS: case VALSCM_ABS:
if (value_less (arg1, value_zero (value_type (arg1), not_lval))) if (value_less (arg1, value_zero (arg1->type (), not_lval)))
res_val = value_neg (arg1); res_val = value_neg (arg1);
else else
res_val = arg1; res_val = arg1;
@ -160,8 +160,8 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
{ {
case VALSCM_ADD: case VALSCM_ADD:
{ {
struct type *ltype = value_type (arg1); struct type *ltype = arg1->type ();
struct type *rtype = value_type (arg2); struct type *rtype = arg2->type ();
ltype = check_typedef (ltype); ltype = check_typedef (ltype);
ltype = STRIP_REFERENCE (ltype); ltype = STRIP_REFERENCE (ltype);
@ -180,8 +180,8 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
break; break;
case VALSCM_SUB: case VALSCM_SUB:
{ {
struct type *ltype = value_type (arg1); struct type *ltype = arg1->type ();
struct type *rtype = value_type (arg2); struct type *rtype = arg2->type ();
ltype = check_typedef (ltype); ltype = check_typedef (ltype);
ltype = STRIP_REFERENCE (ltype); ltype = STRIP_REFERENCE (ltype);

View file

@ -956,7 +956,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
const struct value_print_options *options, const struct value_print_options *options,
const struct language_defn *language) const struct language_defn *language)
{ {
struct type *type = value_type (value); struct type *type = value->type ();
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
SCM exception = SCM_BOOL_F; SCM exception = SCM_BOOL_F;
SCM printer = SCM_BOOL_F; SCM printer = SCM_BOOL_F;

View file

@ -470,7 +470,7 @@ gdbscm_value_referenced_value (SCM self)
struct value *res_val; struct value *res_val;
switch (check_typedef (value_type (value))->code ()) switch (check_typedef (value->type ())->code ())
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
res_val = value_ind (value); res_val = value_ind (value);
@ -548,7 +548,7 @@ gdbscm_value_type (SCM self)
struct value *value = v_smob->value; struct value *value = v_smob->value;
if (SCM_UNBNDP (v_smob->type)) if (SCM_UNBNDP (v_smob->type))
v_smob->type = tyscm_scm_from_type (value_type (value)); v_smob->type = tyscm_scm_from_type (value->type ());
return v_smob->type; return v_smob->type;
} }
@ -571,7 +571,7 @@ gdbscm_value_dynamic_type (SCM self)
{ {
scoped_value_mark free_values; scoped_value_mark free_values;
type = value_type (value); type = value->type ();
type = check_typedef (type); type = check_typedef (type);
if (((type->code () == TYPE_CODE_PTR) if (((type->code () == TYPE_CODE_PTR)
@ -710,7 +710,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
value_smob *v_smob value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value; struct value *value = v_smob->value;
struct type *type = value_type (value); struct type *type = value->type ();
SCM_ASSERT (type != NULL, self, SCM_ARG2, FUNC_NAME); SCM_ASSERT (type != NULL, self, SCM_ARG2, FUNC_NAME);
@ -732,7 +732,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
Check the value's type is something that can be accessed via Check the value's type is something that can be accessed via
a subscript. */ a subscript. */
struct value *tmp = coerce_ref (value); struct value *tmp = coerce_ref (value);
struct type *tmp_type = check_typedef (value_type (tmp)); struct type *tmp_type = check_typedef (tmp->type ());
if (tmp_type->code () != TYPE_CODE_ARRAY if (tmp_type->code () != TYPE_CODE_ARRAY
&& tmp_type->code () != TYPE_CODE_PTR) && tmp_type->code () != TYPE_CODE_PTR)
error (_("Cannot subscript requested type")); error (_("Cannot subscript requested type"));
@ -758,7 +758,7 @@ gdbscm_value_call (SCM self, SCM args)
gdbscm_gdb_exception exc {}; gdbscm_gdb_exception exc {};
try try
{ {
ftype = check_typedef (value_type (function)); ftype = check_typedef (function->type ());
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
{ {
@ -821,7 +821,7 @@ gdbscm_value_to_bytevector (SCM self)
const gdb_byte *contents = NULL; const gdb_byte *contents = NULL;
SCM bv; SCM bv;
type = value_type (value); type = value->type ();
gdbscm_gdb_exception exc {}; gdbscm_gdb_exception exc {};
try try
@ -866,7 +866,7 @@ gdbscm_value_to_bool (SCM self)
struct type *type; struct type *type;
LONGEST l = 0; LONGEST l = 0;
type = value_type (value); type = value->type ();
gdbscm_gdb_exception exc {}; gdbscm_gdb_exception exc {};
try try
@ -910,7 +910,7 @@ gdbscm_value_to_integer (SCM self)
struct type *type; struct type *type;
LONGEST l = 0; LONGEST l = 0;
type = value_type (value); type = value->type ();
gdbscm_gdb_exception exc {}; gdbscm_gdb_exception exc {};
try try
@ -958,7 +958,7 @@ gdbscm_value_to_real (SCM self)
double d = 0; double d = 0;
struct value *check = nullptr; struct value *check = nullptr;
type = value_type (value); type = value->type ();
gdbscm_gdb_exception exc {}; gdbscm_gdb_exception exc {};
try try
@ -1162,7 +1162,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
struct type *type, *realtype; struct type *type, *realtype;
CORE_ADDR addr; CORE_ADDR addr;
type = value_type (value); type = value->type ();
realtype = check_typedef (type); realtype = check_typedef (type);
switch (realtype->code ()) switch (realtype->code ())

View file

@ -632,7 +632,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack for the arguments. We /* Now make sure there's space on the stack for the arguments. We
may over-allocate a little here, but that won't hurt anything. */ may over-allocate a little here, but that won't hurt anything. */
for (argument = 0; argument < nargs; argument++) for (argument = 0; argument < nargs; argument++)
stack_alloc += align_up (value_type (args[argument])->length (), wordsize); stack_alloc += align_up (args[argument]->type ()->length (), wordsize);
sp -= stack_alloc; sp -= stack_alloc;
/* Now load as many arguments as possible into registers, and push /* Now load as many arguments as possible into registers, and push
@ -645,7 +645,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argument = 0; argument < nargs; argument++) for (argument = 0; argument < nargs; argument++)
{ {
struct type *type = value_type (args[argument]); struct type *type = args[argument]->type ();
int len = type->length (); int len = type->length ();
char *contents = (char *) value_contents (args[argument]).data (); char *contents = (char *) value_contents (args[argument]).data ();

View file

@ -731,7 +731,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
/* The corresponding parameter that is pushed onto the /* The corresponding parameter that is pushed onto the
stack, and [possibly] passed in a register. */ stack, and [possibly] passed in a register. */
gdb_byte param_val[8]; gdb_byte param_val[8];
@ -965,7 +965,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = value_type (arg); struct type *type = arg->type ();
int len = type->length (); int len = type->length ();
const bfd_byte *valbuf; const bfd_byte *valbuf;
bfd_byte fptrbuf[8]; bfd_byte fptrbuf[8];

View file

@ -3389,7 +3389,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (fpnum, raw_buf); status = regcache->raw_read (fpnum, raw_buf);
if (status != REG_VALID) if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
else else
memcpy (buf, raw_buf, register_size (gdbarch, regnum)); memcpy (buf, raw_buf, register_size (gdbarch, regnum));
} }
@ -3526,7 +3526,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (gpnum, raw_buf); status = regcache->raw_read (gpnum, raw_buf);
if (status != REG_VALID) if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
else else
memcpy (buf, raw_buf, 2); memcpy (buf, raw_buf, 2);
} }
@ -3539,7 +3539,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
status = regcache->raw_read (gpnum % 4, raw_buf); status = regcache->raw_read (gpnum % 4, raw_buf);
if (status != REG_VALID) if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, mark_value_bytes_unavailable (result_value, 0,
value_type (result_value)->length ()); result_value->type ()->length ());
else if (gpnum >= 4) else if (gpnum >= 4)
memcpy (buf, raw_buf + 1, 1); memcpy (buf, raw_buf + 1, 1);
else else

View file

@ -114,7 +114,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
calling convention is used, so the 'this' pointer is passed in ECX. */ calling convention is used, so the 'this' pointer is passed in ECX. */
bool thiscall = false; bool thiscall = false;
struct type *type = check_typedef (value_type (function)); struct type *type = check_typedef (function->type ());
if (type->code () == TYPE_CODE_PTR) if (type->code () == TYPE_CODE_PTR)
type = check_typedef (type->target_type ()); type = check_typedef (type->target_type ());

View file

@ -3697,7 +3697,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argno = 0; argno < nargs; argno++) for (argno = 0; argno < nargs; argno++)
{ {
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();
if ((nslots & 1) && slot_alignment_is_next_even (type)) if ((nslots & 1) && slot_alignment_is_next_even (type))
@ -3740,7 +3740,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *float_elt_type; struct type *float_elt_type;
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();
/* Special handling for function parameters. */ /* Special handling for function parameters. */

View file

@ -181,7 +181,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
struct type *param_type, int is_prototyped) struct type *param_type, int is_prototyped)
{ {
const struct builtin_type *builtin = builtin_type (gdbarch); const struct builtin_type *builtin = builtin_type (gdbarch);
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
struct type *type struct type *type
= param_type ? check_typedef (param_type) : arg_type; = param_type ? check_typedef (param_type) : arg_type;
@ -278,7 +278,7 @@ find_function_addr (struct value *function,
struct type **retval_type, struct type **retval_type,
struct type **function_type) struct type **function_type)
{ {
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (function->type ());
struct gdbarch *gdbarch = ftype->arch (); struct gdbarch *gdbarch = ftype->arch ();
struct type *value_type = NULL; struct type *value_type = NULL;
/* Initialize it just to avoid a GCC false warning. */ /* Initialize it just to avoid a GCC false warning. */
@ -972,7 +972,7 @@ call_function_by_hand_dummy (struct value *function,
else else
{ {
gdb_assert (sp <= lastval_addr); gdb_assert (sp <= lastval_addr);
sp = lastval_addr + value_type (lastval)->length (); sp = lastval_addr + lastval->type ()->length ();
} }
if (gdbarch_frame_align_p (gdbarch)) if (gdbarch_frame_align_p (gdbarch))

View file

@ -1478,7 +1478,7 @@ get_return_value (struct symbol *func_symbol, struct value *function)
= check_typedef (func_symbol->type ()->target_type ()); = check_typedef (func_symbol->type ()->target_type ());
gdb_assert (value_type->code () != TYPE_CODE_VOID); gdb_assert (value_type->code () != TYPE_CODE_VOID);
if (is_nocall_function (check_typedef (::value_type (function)))) if (is_nocall_function (check_typedef (function->type ())))
{ {
warning (_("Function '%s' does not follow the target calling " warning (_("Function '%s' does not follow the target calling "
"convention, cannot determine its returned value."), "convention, cannot determine its returned value."),
@ -2158,7 +2158,7 @@ default_print_one_register_info (struct ui_file *file,
const char *name, const char *name,
struct value *val) struct value *val)
{ {
struct type *regtype = value_type (val); struct type *regtype = val->type ();
int print_raw_format; int print_raw_format;
string_file format_stream; string_file format_stream;
enum tab_stops enum tab_stops

View file

@ -9145,9 +9145,9 @@ siginfo_value_read (struct value *v)
nullptr, nullptr,
value_contents_all_raw (v).data (), value_contents_all_raw (v).data (),
value_offset (v), value_offset (v),
value_type (v)->length ()); v->type ()->length ());
if (transferred != value_type (v)->length ()) if (transferred != v->type ()->length ())
error (_("Unable to read siginfo")); error (_("Unable to read siginfo"));
} }
@ -9168,9 +9168,9 @@ siginfo_value_write (struct value *v, struct value *fromval)
nullptr, nullptr,
value_contents_all_raw (fromval).data (), value_contents_all_raw (fromval).data (),
value_offset (v), value_offset (v),
value_type (fromval)->length ()); fromval->type ()->length ());
if (transferred != value_type (fromval)->length ()) if (transferred != fromval->type ()->length ())
error (_("Unable to write siginfo")); error (_("Unable to write siginfo"));
} }

View file

@ -643,7 +643,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
i < nargs; i < nargs;
i++) i++)
{ {
type = value_type (args[i]); type = args[i]->type ();
typelen = type->length (); typelen = type->length ();
if (typelen <= 4) if (typelen <= 4)
{ {
@ -709,7 +709,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
type = value_type (args[i]); type = args[i]->type ();
typelen = type->length (); typelen = type->length ();
val = value_contents (args[i]).data (); val = value_contents (args[i]).data ();
if (typelen <= 4) if (typelen <= 4)

View file

@ -4081,7 +4081,7 @@ linespec_parse_variable (struct linespec_state *self, const char *variable)
sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d", &index); sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d", &index);
val_history val_history
= access_value_history ((variable[1] == '$') ? -index : index); = access_value_history ((variable[1] == '$') ? -index : index);
if (value_type (val_history)->code () != TYPE_CODE_INT) if (val_history->type ()->code () != TYPE_CODE_INT)
error (_("History values used in line " error (_("History values used in line "
"specs must have integer values.")); "specs must have integer values."));
offset.offset = value_as_long (val_history); offset.offset = value_as_long (val_history);

View file

@ -238,7 +238,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct value *arg = args[i]; struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
gdb_byte *contents; gdb_byte *contents;
ULONGEST val; ULONGEST val;

View file

@ -566,11 +566,11 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *val = value_contents (arg).data (); const gdb_byte *val = value_contents (arg).data ();
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
size_t len = type->length (); size_t len = type->length ();
int align = type_align (type); int align = type_align (type);
enum type_code code = type->code (); enum type_code code = type->code ();
struct type *func_type = check_typedef (value_type (function)); struct type *func_type = check_typedef (function->type ());
bool varargs = (func_type->has_varargs () && i >= func_type->num_fields ()); bool varargs = (func_type->has_varargs () && i >= func_type->num_fields ());
switch (code) switch (code)

View file

@ -42,7 +42,7 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
else else
{ {
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (m2_is_unbounded_array (type)) if (m2_is_unbounded_array (type))
{ {
@ -54,7 +54,7 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
_("unbounded structure " _("unbounded structure "
"missing _m2_high field")); "missing _m2_high field"));
if (value_type (arg1) != type) if (arg1->type () != type)
arg1 = value_cast (type, arg1); arg1 = value_cast (type, arg1);
} }
} }
@ -73,7 +73,7 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
then report this as an error. */ then report this as an error. */
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (arg1->type ());
if (m2_is_unbounded_array (type)) if (m2_is_unbounded_array (type))
{ {
@ -87,10 +87,10 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
_("unbounded structure " _("unbounded structure "
"missing _m2_contents field")); "missing _m2_contents field"));
if (value_type (arg1) != type) if (arg1->type () != type)
arg1 = value_cast (type, arg1); arg1 = value_cast (type, arg1);
check_typedef (value_type (arg1)); check_typedef (arg1->type ());
return value_ind (value_ptradd (arg1, value_as_long (arg2))); return value_ind (value_ptradd (arg1, value_as_long (arg2)));
} }
else else

View file

@ -164,7 +164,7 @@ m2_print_unbounded_array (struct value *value,
LONGEST len; LONGEST len;
struct value *val; struct value *val;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
const gdb_byte *valaddr = value_contents_for_printing (value).data (); const gdb_byte *valaddr = value_contents_for_printing (value).data ();
addr = unpack_pointer (type->field (0).type (), addr = unpack_pointer (type->field (0).type (),
@ -260,7 +260,7 @@ m2_print_array_contents (struct value *val,
const struct value_print_options *options, const struct value_print_options *options,
int len) int len)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (type->length () > 0) if (type->length () > 0)
{ {
@ -308,7 +308,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
const gdb_byte *valaddr = value_contents_for_printing (val).data (); const gdb_byte *valaddr = value_contents_for_printing (val).data ();
const CORE_ADDR address = value_address (val); const CORE_ADDR address = value_address (val);
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:

View file

@ -2029,7 +2029,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int num_prototyped_args = 0; int num_prototyped_args = 0;
{ {
struct type *func_type = value_type (function); struct type *func_type = function->type ();
/* Dereference function pointer types. */ /* Dereference function pointer types. */
if (func_type->code () == TYPE_CODE_PTR) if (func_type->code () == TYPE_CODE_PTR)
@ -2062,7 +2062,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents (arg).data (); const gdb_byte *arg_bits = value_contents (arg).data ();
struct type *arg_type = value_type (arg); struct type *arg_type = arg->type ();
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();
/* Can it go in r1 or r1l (for m16c) or r0 or r0l (for m32c)? */ /* Can it go in r1 or r1l (for m16c) or r0 or r0l (for m32c)? */

View file

@ -682,12 +682,12 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack. */ /* Now make sure there's space on the stack. */
for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++) for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
stack_alloc += ((value_type (args[argnum])->length () + 3) & ~3); stack_alloc += ((args[argnum]->type ()->length () + 3) & ~3);
sp -= stack_alloc; /* Make room on stack for args. */ sp -= stack_alloc; /* Make room on stack for args. */
for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
{ {
type = value_type (args[argnum]); type = args[argnum]->type ();
typecode = type->code (); typecode = type->code ();
len = type->length (); len = type->length ();

View file

@ -1170,7 +1170,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, struct_addr); regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, struct_addr);
else if (nargs > 0) else if (nargs > 0)
{ {
type = value_type (args[0]); type = args[0]->type ();
/* First argument is passed in D and X registers. */ /* First argument is passed in D and X registers. */
if (type->length () <= 4) if (type->length () <= 4)
@ -1192,7 +1192,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argnum = nargs - 1; argnum >= first_stack_argnum; argnum--) for (argnum = nargs - 1; argnum >= first_stack_argnum; argnum--)
{ {
type = value_type (args[argnum]); type = args[argnum]->type ();
if (type->length () & 1) if (type->length () & 1)
{ {

View file

@ -2228,7 +2228,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
unsigned arg_len = value_type (argv[i])->length (); unsigned arg_len = argv[i]->type ()->length ();
if (arg_len > MEP_GPR_SIZE) if (arg_len > MEP_GPR_SIZE)
{ {
@ -2288,9 +2288,9 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST value; ULONGEST value;
/* Arguments that fit in a GPR get expanded to fill the GPR. */ /* Arguments that fit in a GPR get expanded to fill the GPR. */
if (value_type (argv[i])->length () <= MEP_GPR_SIZE) if (argv[i]->type ()->length () <= MEP_GPR_SIZE)
value = extract_unsigned_integer (value_contents (argv[i]).data (), value = extract_unsigned_integer (value_contents (argv[i]).data (),
value_type (argv[i])->length (), argv[i]->type ()->length (),
byte_order); byte_order);
/* Arguments too large to fit in a GPR get copied to the stack, /* Arguments too large to fit in a GPR get copied to the stack,

View file

@ -505,10 +505,10 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
/* A scalar object that does not have all bits available is /* A scalar object that does not have all bits available is
also considered unavailable, because all bits contribute also considered unavailable, because all bits contribute
to its representation. */ to its representation. */
|| (val_print_scalar_type_p (value_type (arg->val)) || (val_print_scalar_type_p (arg->val->type ())
&& !value_bytes_available (arg->val, && !value_bytes_available (arg->val,
value_embedded_offset (arg->val), value_embedded_offset (arg->val),
value_type (arg->val)->length ())))) arg->val->type ()->length ()))))
return; return;
gdb::optional<ui_out_emit_tuple> tuple_emitter; gdb::optional<ui_out_emit_tuple> tuple_emitter;

View file

@ -2474,8 +2474,8 @@ print_variable_or_computed (const char *expression, enum print_values values)
switch (values) switch (values)
{ {
case PRINT_SIMPLE_VALUES: case PRINT_SIMPLE_VALUES:
type = check_typedef (value_type (val)); type = check_typedef (val->type ());
type_print (value_type (val), "", &stb, -1); type_print (val->type (), "", &stb, -1);
uiout->field_stream ("type", stb); uiout->field_stream ("type", stb);
if (type->code () != TYPE_CODE_ARRAY if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_STRUCT

View file

@ -4553,7 +4553,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
than necessary for EABI, because the first few arguments are than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */ passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (value_type (args[argnum])->length (), arg_space += align_up (args[argnum]->type ()->length (),
abi_regsize); abi_regsize);
sp -= align_up (arg_space, 16); sp -= align_up (arg_space, 16);
@ -4588,7 +4588,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
reference. */ reference. */
gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE]; gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
@ -4947,7 +4947,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (value_type (args[argnum])->length (), arg_space += align_up (args[argnum]->type ()->length (),
MIPS64_REGSIZE); MIPS64_REGSIZE);
sp -= align_up (arg_space, 16); sp -= align_up (arg_space, 16);
@ -4979,7 +4979,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
const gdb_byte *val; const gdb_byte *val;
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
@ -5420,7 +5420,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
struct type *arg_type = check_typedef (value_type (args[argnum])); struct type *arg_type = check_typedef (args[argnum]->type ());
/* Align to double-word if necessary. */ /* Align to double-word if necessary. */
if (mips_type_needs_double_align (arg_type)) if (mips_type_needs_double_align (arg_type))
@ -5459,7 +5459,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
const gdb_byte *val; const gdb_byte *val;
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
@ -5944,7 +5944,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
struct type *arg_type = check_typedef (value_type (args[argnum])); struct type *arg_type = check_typedef (args[argnum]->type ());
/* Allocate space on the stack. */ /* Allocate space on the stack. */
arg_space += align_up (arg_type->length (), MIPS64_REGSIZE); arg_space += align_up (arg_type->length (), MIPS64_REGSIZE);
@ -5980,7 +5980,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
const gdb_byte *val; const gdb_byte *val;
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();

View file

@ -1181,7 +1181,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
regs_used = (return_method == return_method_struct) ? 1 : 0; regs_used = (return_method == return_method_struct) ? 1 : 0;
for (len = 0, argnum = 0; argnum < nargs; argnum++) for (len = 0, argnum = 0; argnum < nargs; argnum++)
{ {
arg_len = (value_type (args[argnum])->length () + 3) & ~3; arg_len = (args[argnum]->type ()->length () + 3) & ~3;
while (regs_used < 2 && arg_len > 0) while (regs_used < 2 && arg_len > 0)
{ {
regs_used++; regs_used++;
@ -1205,8 +1205,8 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
/* FIXME what about structs? Unions? */ /* FIXME what about structs? Unions? */
if (value_type (*args)->code () == TYPE_CODE_STRUCT if ((*args)->type ()->code () == TYPE_CODE_STRUCT
&& value_type (*args)->length () > 8) && (*args)->type ()->length () > 8)
{ {
/* Change to pointer-to-type. */ /* Change to pointer-to-type. */
arg_len = push_size; arg_len = push_size;
@ -1217,7 +1217,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
} }
else else
{ {
arg_len = value_type (*args)->length (); arg_len = (*args)->type ()->length ();
val = value_contents (*args).data (); val = value_contents (*args).data ();
} }

View file

@ -656,7 +656,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
msp430_gdbarch_tdep *tdep = gdbarch_tdep<msp430_gdbarch_tdep> (gdbarch); msp430_gdbarch_tdep *tdep = gdbarch_tdep<msp430_gdbarch_tdep> (gdbarch);
int code_model = tdep->code_model; int code_model = tdep->code_model;
struct type *func_type = value_type (function); struct type *func_type = function->type ();
/* Dereference function pointer types. */ /* Dereference function pointer types. */
while (func_type->code () == TYPE_CODE_PTR) while (func_type->code () == TYPE_CODE_PTR)
@ -690,7 +690,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents_all (arg).data (); const gdb_byte *arg_bits = value_contents_all (arg).data ();
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();
int offset; int offset;
int current_arg_on_stack; int current_arg_on_stack;

View file

@ -1422,7 +1422,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST regval; ULONGEST regval;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
nds32_gdbarch_tdep *tdep = gdbarch_tdep<nds32_gdbarch_tdep> (gdbarch); nds32_gdbarch_tdep *tdep = gdbarch_tdep<nds32_gdbarch_tdep> (gdbarch);
struct type *func_type = value_type (function); struct type *func_type = function->type ();
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi); int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
int abi_split = nds32_abi_split (tdep->elf_abi); int abi_split = nds32_abi_split (tdep->elf_abi);
@ -1442,7 +1442,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack */ /* Now make sure there's space on the stack */
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int align = type_align (type); int align = type_align (type);
/* If align is zero, it may be an empty struct. /* If align is zero, it may be an empty struct.
@ -1466,7 +1466,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int calling_use_fpr; int calling_use_fpr;
int use_fpr = 0; int use_fpr = 0;
type = value_type (args[i]); type = args[i]->type ();
calling_use_fpr = nds32_check_calling_use_fpr (type); calling_use_fpr = nds32_check_calling_use_fpr (type);
len = type->length (); len = type->length ();
align = type_align (type); align = type_align (type);

View file

@ -1818,7 +1818,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
arg_space += align_up (value_type (args[argnum])->length (), 4); arg_space += align_up (args[argnum]->type ()->length (), 4);
sp -= arg_space; sp -= arg_space;
/* Initialize the register pointer. */ /* Initialize the register pointer. */
@ -1836,7 +1836,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
const gdb_byte *val; const gdb_byte *val;
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
val = value_contents (arg).data (); val = value_contents (arg).data ();

View file

@ -120,8 +120,8 @@ static void
lval_func_read (struct value *v) lval_func_read (struct value *v)
{ {
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v)); struct type *type = check_typedef (v->type ());
struct type *eltype = check_typedef (value_type (c->val))->target_type (); struct type *eltype = check_typedef (c->val->type ())->target_type ();
LONGEST offset = value_offset (v); LONGEST offset = value_offset (v);
LONGEST elsize = eltype->length (); LONGEST elsize = eltype->length ();
int n, i, j = 0; int n, i, j = 0;
@ -150,8 +150,8 @@ lval_func_write (struct value *v, struct value *fromval)
scoped_value_mark mark; scoped_value_mark mark;
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v)); struct type *type = check_typedef (v->type ());
struct type *eltype = check_typedef (value_type (c->val))->target_type (); struct type *eltype = check_typedef (c->val->type ())->target_type ();
LONGEST offset = value_offset (v); LONGEST offset = value_offset (v);
LONGEST elsize = eltype->length (); LONGEST elsize = eltype->length ();
int n, i, j = 0; int n, i, j = 0;
@ -197,7 +197,7 @@ lval_func_check_synthetic_pointer (const struct value *v,
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */ /* Size of the target type in bits. */
int elsize = int elsize =
check_typedef (value_type (c->val))->target_type ()->length () * 8; check_typedef (c->val->type ())->target_type ()->length () * 8;
int startrest = offset % elsize; int startrest = offset % elsize;
int start = offset / elsize; int start = offset / elsize;
int endrest = (offset + length) % elsize; int endrest = (offset + length) % elsize;
@ -269,7 +269,7 @@ static struct value *
create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
int *indices, int n) int *indices, int n)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
struct type *elm_type = type->target_type (); struct type *elm_type = type->target_type ();
struct value *ret; struct value *ret;
@ -337,7 +337,7 @@ opencl_component_ref (struct expression *exp, struct value *val,
int indices[16], i; int indices[16], i;
int dst_len; int dst_len;
if (!get_array_bounds (check_typedef (value_type (val)), &lowb, &highb)) if (!get_array_bounds (check_typedef (val->type ()), &lowb, &highb))
error (_("Could not determine the vector bounds")); error (_("Could not determine the vector bounds"));
src_len = highb - lowb + 1; src_len = highb - lowb + 1;
@ -446,7 +446,7 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg) struct value *arg)
{ {
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
struct type *rettype; struct type *rettype;
struct value *ret; struct value *ret;
@ -537,8 +537,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
int t1_is_vec, t2_is_vec, i; int t1_is_vec, t2_is_vec, i;
LONGEST lowb1, lowb2, highb1, highb2; LONGEST lowb1, lowb2, highb1, highb2;
type1 = check_typedef (value_type (val1)); type1 = check_typedef (val1->type ());
type2 = check_typedef (value_type (val2)); type2 = check_typedef (val2->type ());
t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()); t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ());
t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ()); t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ());
@ -589,7 +589,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
struct value * struct value *
opencl_value_cast (struct type *type, struct value *arg) opencl_value_cast (struct type *type, struct value *arg)
{ {
if (type != value_type (arg)) if (type != arg->type ())
{ {
/* Casting scalar to vector is a special case for OpenCL, scalar /* Casting scalar to vector is a special case for OpenCL, scalar
is cast to element type of vector then replicated into each is cast to element type of vector then replicated into each
@ -603,10 +603,10 @@ opencl_value_cast (struct type *type, struct value *arg)
to_type = check_typedef (type); to_type = check_typedef (type);
code1 = to_type->code (); code1 = to_type->code ();
code2 = check_typedef (value_type (arg))->code (); code2 = check_typedef (arg->type ())->code ();
if (code2 == TYPE_CODE_REF) if (code2 == TYPE_CODE_REF)
code2 = check_typedef (value_type (coerce_ref(arg)))->code (); code2 = check_typedef (coerce_ref(arg)->type ())->code ();
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL
|| code2 == TYPE_CODE_CHAR || code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_CHAR || code2 == TYPE_CODE_FLT
@ -641,8 +641,8 @@ opencl_relop (struct type *expect_type, struct expression *exp,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
struct value *val; struct value *val;
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (arg2->type ());
int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& type1->is_vector ()); && type1->is_vector ());
int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
@ -686,7 +686,7 @@ eval_opencl_assign (struct type *expect_type, struct expression *exp,
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
struct type *type1 = value_type (arg1); struct type *type1 = arg1->type ();
if (deprecated_value_modifiable (arg1) if (deprecated_value_modifiable (arg1)
&& VALUE_LVAL (arg1) != lval_internalvar) && VALUE_LVAL (arg1) != lval_internalvar)
arg2 = opencl_value_cast (type1, arg2); arg2 = opencl_value_cast (type1, arg2);
@ -703,7 +703,7 @@ opencl_structop_operation::evaluate (struct type *expect_type,
enum noside noside) enum noside noside)
{ {
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ())
return opencl_component_ref (exp, arg1, std::get<1> (m_storage).c_str (), return opencl_component_ref (exp, arg1, std::get<1> (m_storage).c_str (),
@ -715,7 +715,7 @@ opencl_structop_operation::evaluate (struct type *expect_type,
NULL, "structure"); NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
v = value_zero (value_type (v), VALUE_LVAL (v)); v = value_zero (v->type (), VALUE_LVAL (v));
return v; return v;
} }
} }
@ -735,8 +735,8 @@ opencl_logical_binop_operation::evaluate (struct type *expect_type,
Therefore we evaluate it once using EVAL_AVOID_SIDE_EFFECTS. */ Therefore we evaluate it once using EVAL_AVOID_SIDE_EFFECTS. */
value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (arg2->type ());
if ((type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) if ((type1->code () == TYPE_CODE_ARRAY && type1->is_vector ())
|| (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ())) || (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ()))
@ -774,7 +774,7 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
enum noside noside) enum noside noside)
{ {
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ())
{ {
struct value *arg2, *arg3, *tmp, *ret; struct value *arg2, *arg3, *tmp, *ret;
@ -784,8 +784,8 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
arg3 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); arg3 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
type3 = check_typedef (value_type (arg3)); type3 = check_typedef (arg3->type ());
t2_is_vec t2_is_vec
= type2->code () == TYPE_CODE_ARRAY && type2->is_vector (); = type2->code () == TYPE_CODE_ARRAY && type2->is_vector ();
t3_is_vec t3_is_vec
@ -795,12 +795,12 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
if (t2_is_vec || !t3_is_vec) if (t2_is_vec || !t3_is_vec)
{ {
arg3 = opencl_value_cast (type2, arg3); arg3 = opencl_value_cast (type2, arg3);
type3 = value_type (arg3); type3 = arg3->type ();
} }
else if (!t2_is_vec || t3_is_vec) else if (!t2_is_vec || t3_is_vec)
{ {
arg2 = opencl_value_cast (type3, arg2); arg2 = opencl_value_cast (type3, arg2);
type2 = value_type (arg2); type2 = arg2->type ();
} }
else if (!t2_is_vec || !t3_is_vec) else if (!t2_is_vec || !t3_is_vec)
{ {

View file

@ -637,7 +637,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch); or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
int bpa = tdep->bytes_per_address; int bpa = tdep->bytes_per_address;
int bpw = tdep->bytes_per_word; int bpw = tdep->bytes_per_word;
struct type *func_type = value_type (function); struct type *func_type = function->type ();
/* Return address */ /* Return address */
regcache_cooked_write_unsigned (regcache, OR1K_LR_REGNUM, bp_addr); regcache_cooked_write_unsigned (regcache, OR1K_LR_REGNUM, bp_addr);
@ -661,7 +661,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte valbuf[sizeof (ULONGEST)]; gdb_byte valbuf[sizeof (ULONGEST)];
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
@ -751,7 +751,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argnum = first_stack_arg; argnum < nargs; argnum++) for (argnum = first_stack_arg; argnum < nargs; argnum++)
{ {
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
@ -783,7 +783,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte valbuf[sizeof (ULONGEST)]; gdb_byte valbuf[sizeof (ULONGEST)];
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();
/* The EABI passes structures that do not fit in a register by /* The EABI passes structures that do not fit in a register by

View file

@ -542,7 +542,7 @@ exp : DOLLAR_VARIABLE
value *val value *val
= value_of_internalvar (pstate->gdbarch (), = value_of_internalvar (pstate->gdbarch (),
intvar); intvar);
current_type = value_type (val); current_type = val->type ();
} }
} }
; ;
@ -591,7 +591,7 @@ exp : THIS
this_val this_val
= value_of_this_silent (pstate->language ()); = value_of_this_silent (pstate->language ());
if (this_val) if (this_val)
this_type = value_type (this_val); this_type = this_val->type ();
else else
this_type = NULL; this_type = NULL;
if (this_type) if (this_type)
@ -707,7 +707,7 @@ variable: name_not_typename
this_val this_val
= value_of_this_silent (pstate->language ()); = value_of_this_silent (pstate->language ());
if (this_val) if (this_val)
this_type = value_type (this_val); this_type = this_val->type ();
else else
this_type = NULL; this_type = NULL;
if (this_type) if (this_type)

View file

@ -69,7 +69,7 @@ pascal_language::value_print_inner (struct value *val,
const struct value_print_options *options) const const struct value_print_options *options) const
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
enum bfd_endian byte_order = type_byte_order (type); enum bfd_endian byte_order = type_byte_order (type);
unsigned int i = 0; /* Number of characters printed */ unsigned int i = 0; /* Number of characters printed */
@ -408,7 +408,7 @@ void
pascal_language::value_print (struct value *val, struct ui_file *stream, pascal_language::value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const const struct value_print_options *options) const
{ {
struct type *type = value_type (val); struct type *type = val->type ();
struct value_print_options opts = *options; struct value_print_options opts = *options;
opts.deref_ref = true; opts.deref_ref = true;
@ -521,7 +521,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
char *last_dont_print char *last_dont_print
= (char *) obstack_next_free (&dont_print_statmem_obstack); = (char *) obstack_next_free (&dont_print_statmem_obstack);
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
gdb_printf (stream, "{"); gdb_printf (stream, "{");
len = type->num_fields (); len = type->num_fields ();
@ -655,7 +655,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
opts.deref_ref = false; opts.deref_ref = false;
struct value *v = value_primitive_field (val, 0, i, struct value *v = value_primitive_field (val, 0, i,
value_type (val)); val->type ());
common_val_print (v, stream, recurse + 1, &opts, common_val_print (v, stream, recurse + 1, &opts,
current_language); current_language);
} }
@ -692,7 +692,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
struct type **last_dont_print struct type **last_dont_print
= (struct type **) obstack_next_free (&dont_print_vb_obstack); = (struct type **) obstack_next_free (&dont_print_vb_obstack);
struct obstack tmp_obstack = dont_print_vb_obstack; struct obstack tmp_obstack = dont_print_vb_obstack;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
int i, n_baseclasses = TYPE_N_BASECLASSES (type); int i, n_baseclasses = TYPE_N_BASECLASSES (type);
if (dont_print_vb == 0) if (dont_print_vb == 0)
@ -757,7 +757,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
base_value = value_from_contents_and_address (baseclass, base_value = value_from_contents_and_address (baseclass,
buf.data (), buf.data (),
address + boffset); address + boffset);
baseclass = value_type (base_value); baseclass = base_value->type ();
boffset = 0; boffset = 0;
} }
} }
@ -815,7 +815,7 @@ pascal_object_print_static_field (struct value *val,
int recurse, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct type *type = value_type (val); struct type *type = val->type ();
struct value_print_options opts; struct value_print_options opts;
if (value_entirely_optimized_out (val)) if (value_entirely_optimized_out (val))

View file

@ -2516,7 +2516,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
/* DATA_VALUE is the constant in RIGHT_VAL, but actually has /* DATA_VALUE is the constant in RIGHT_VAL, but actually has
the same type as the memory region referenced by LEFT_VAL. */ the same type as the memory region referenced by LEFT_VAL. */
*len = check_typedef (value_type (left_val))->length (); *len = check_typedef (left_val->type ())->length ();
} }
else if (num_accesses_left == 0 && num_accesses_right == 1 else if (num_accesses_left == 0 && num_accesses_right == 1
&& VALUE_LVAL (right_val) == lval_memory && VALUE_LVAL (right_val) == lval_memory
@ -2526,7 +2526,7 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
/* DATA_VALUE is the constant in LEFT_VAL, but actually has /* DATA_VALUE is the constant in LEFT_VAL, but actually has
the same type as the memory region referenced by RIGHT_VAL. */ the same type as the memory region referenced by RIGHT_VAL. */
*len = check_typedef (value_type (right_val))->length (); *len = check_typedef (right_val->type ())->length ();
} }
else else
return 0; return 0;

View file

@ -69,7 +69,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch); ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function)); int opencl_abi = ppc_sysv_use_opencl_abi (function->type ());
ULONGEST saved_sp; ULONGEST saved_sp;
int argspace = 0; /* 0 is an initial wrong guess. */ int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass; int write_pass;
@ -122,7 +122,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argno = 0; argno < nargs; argno++) for (argno = 0; argno < nargs; argno++)
{ {
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
int len = type->length (); int len = type->length ();
const bfd_byte *val = value_contents (arg).data (); const bfd_byte *val = value_contents (arg).data ();
@ -1013,7 +1013,7 @@ ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
return do_ppc_sysv_return_value (gdbarch, return do_ppc_sysv_return_value (gdbarch,
function ? value_type (function) : NULL, function ? function->type () : NULL,
valtype, regcache, readbuf, writebuf, 0); valtype, regcache, readbuf, writebuf, 0);
} }
@ -1025,7 +1025,7 @@ ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
return do_ppc_sysv_return_value (gdbarch, return do_ppc_sysv_return_value (gdbarch,
function ? value_type (function) : NULL, function ? function->type () : NULL,
valtype, regcache, readbuf, writebuf, 1); valtype, regcache, readbuf, writebuf, 1);
} }
@ -1606,7 +1606,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch); ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function)); int opencl_abi = ppc_sysv_use_opencl_abi (function->type ());
ULONGEST back_chain; ULONGEST back_chain;
/* See for-loop comment below. */ /* See for-loop comment below. */
int write_pass; int write_pass;
@ -1691,7 +1691,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
for (argno = 0; argno < nargs; argno++) for (argno = 0; argno < nargs; argno++)
{ {
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
const bfd_byte *val = value_contents (arg).data (); const bfd_byte *val = value_contents (arg).data ();
if (type->code () == TYPE_CODE_COMPLEX) if (type->code () == TYPE_CODE_COMPLEX)
@ -1760,7 +1760,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
the pointer itself identifies the descriptor. */ the pointer itself identifies the descriptor. */
if (tdep->elf_abi == POWERPC_ELF_V1) if (tdep->elf_abi == POWERPC_ELF_V1)
{ {
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (function->type ());
CORE_ADDR desc_addr = value_as_address (function); CORE_ADDR desc_addr = value_as_address (function);
if (ftype->code () == TYPE_CODE_PTR if (ftype->code () == TYPE_CODE_PTR
@ -1988,7 +1988,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch); ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
struct type *func_type = function ? value_type (function) : NULL; struct type *func_type = function ? function->type () : NULL;
int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0; int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
struct type *eltype; struct type *eltype;
int nelt, ok; int nelt, ok;

View file

@ -294,7 +294,7 @@ print_formatted (struct value *val, int size,
const struct value_print_options *options, const struct value_print_options *options,
struct ui_file *stream) struct ui_file *stream)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
int len = type->length (); int len = type->length ();
if (VALUE_LVAL (val) == lval_memory) if (VALUE_LVAL (val) == lval_memory)
@ -306,7 +306,7 @@ print_formatted (struct value *val, int size,
{ {
case 's': case 's':
{ {
struct type *elttype = value_type (val); struct type *elttype = val->type ();
next_address = (value_address (val) next_address = (value_address (val)
+ val_print_string (elttype, NULL, + val_print_string (elttype, NULL,
@ -1249,7 +1249,7 @@ print_value (value *val, const value_print_options &opts)
int histindex = record_latest_value (val); int histindex = record_latest_value (val);
annotate_value_history_begin (histindex, value_type (val)); annotate_value_history_begin (histindex, val->type ());
gdb_printf ("$%d = ", histindex); gdb_printf ("$%d = ", histindex);
@ -1266,16 +1266,16 @@ print_value (value *val, const value_print_options &opts)
static bool static bool
should_validate_memtags (struct value *value) should_validate_memtags (struct value *value)
{ {
gdb_assert (value != nullptr && value_type (value) != nullptr); gdb_assert (value != nullptr && value->type () != nullptr);
if (!target_supports_memory_tagging ()) if (!target_supports_memory_tagging ())
return false; return false;
enum type_code code = value_type (value)->code (); enum type_code code = value->type ()->code ();
/* Skip non-address values. */ /* Skip non-address values. */
if (code != TYPE_CODE_PTR if (code != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (value_type (value))) && !TYPE_IS_REFERENCE (value->type ()))
return false; return false;
/* OK, we have an address value. Check we have a complete value we /* OK, we have an address value. Check we have a complete value we
@ -1329,8 +1329,8 @@ print_command_1 (const char *args, int voidprint)
struct value *val = process_print_command_args (args, &print_opts, voidprint); struct value *val = process_print_command_args (args, &print_opts, voidprint);
if (voidprint || (val && value_type (val) && if (voidprint || (val && val->type () &&
value_type (val)->code () != TYPE_CODE_VOID)) val->type ()->code () != TYPE_CODE_VOID))
{ {
/* If memory tagging validation is on, check if the tag is valid. */ /* If memory tagging validation is on, check if the tag is valid. */
if (print_opts.memory_tag_violations) if (print_opts.memory_tag_violations)
@ -1495,7 +1495,7 @@ output_command (const char *exp, int from_tty)
val = evaluate_expression (expr.get ()); val = evaluate_expression (expr.get ());
annotate_value_begin (value_type (val)); annotate_value_begin (val->type ());
get_formatted_print_options (&opts, format); get_formatted_print_options (&opts, format);
opts.raw = fmt.raw; opts.raw = fmt.raw;
@ -1899,11 +1899,11 @@ x_command (const char *exp, int from_tty)
if (from_tty) if (from_tty)
set_repeat_arguments (""); set_repeat_arguments ("");
val = evaluate_expression (expr.get ()); val = evaluate_expression (expr.get ());
if (TYPE_IS_REFERENCE (value_type (val))) if (TYPE_IS_REFERENCE (val->type ()))
val = coerce_ref (val); val = coerce_ref (val);
/* In rvalue contexts, such as this, functions are coerced into /* In rvalue contexts, such as this, functions are coerced into
pointers to functions. This makes "x/i main" work. */ pointers to functions. This makes "x/i main" work. */
if (value_type (val)->code () == TYPE_CODE_FUNC if (val->type ()->code () == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory) && VALUE_LVAL (val) == lval_memory)
next_address = value_address (val); next_address = value_address (val);
else else
@ -1934,7 +1934,7 @@ x_command (const char *exp, int from_tty)
/* Make last address examined available to the user as $_. Use /* Make last address examined available to the user as $_. Use
the correct pointer type. */ the correct pointer type. */
struct type *pointer_type struct type *pointer_type
= lookup_pointer_type (value_type (last_examine_value.get ())); = lookup_pointer_type (last_examine_value.get ()->type ());
set_internalvar (lookup_internalvar ("_"), set_internalvar (lookup_internalvar ("_"),
value_from_pointer (pointer_type, value_from_pointer (pointer_type,
last_examine_address)); last_examine_address));
@ -2445,11 +2445,11 @@ printf_c_string (struct ui_file *stream, const char *format,
{ {
const gdb_byte *str; const gdb_byte *str;
if (value_type (value)->code () != TYPE_CODE_PTR if (value->type ()->code () != TYPE_CODE_PTR
&& VALUE_LVAL (value) == lval_internalvar && VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value_type (value))) && c_is_string_type_p (value->type ()))
{ {
size_t len = value_type (value)->length (); size_t len = value->type ()->length ();
/* Copy the internal var value to TEM_STR and append a terminating null /* Copy the internal var value to TEM_STR and append a terminating null
character. This protects against corrupted C-style strings that lack character. This protects against corrupted C-style strings that lack
@ -2513,16 +2513,16 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
{ {
const gdb_byte *str; const gdb_byte *str;
size_t len; size_t len;
struct gdbarch *gdbarch = value_type (value)->arch (); struct gdbarch *gdbarch = value->type ()->arch ();
struct type *wctype = lookup_typename (current_language, struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0); "wchar_t", NULL, 0);
int wcwidth = wctype->length (); int wcwidth = wctype->length ();
if (VALUE_LVAL (value) == lval_internalvar if (VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value_type (value))) && c_is_string_type_p (value->type ()))
{ {
str = value_contents (value).data (); str = value_contents (value).data ();
len = value_type (value)->length (); len = value->type ()->length ();
} }
else else
{ {
@ -2580,7 +2580,7 @@ printf_floating (struct ui_file *stream, const char *format,
struct value *value, enum argclass argclass) struct value *value, enum argclass argclass)
{ {
/* Parameter data. */ /* Parameter data. */
struct type *param_type = value_type (value); struct type *param_type = value->type ();
struct gdbarch *gdbarch = param_type->arch (); struct gdbarch *gdbarch = param_type->arch ();
/* Determine target type corresponding to the format string. */ /* Determine target type corresponding to the format string. */
@ -2629,7 +2629,7 @@ printf_floating (struct ui_file *stream, const char *format,
if (fmt_type->code () == TYPE_CODE_FLT) if (fmt_type->code () == TYPE_CODE_FLT)
{ {
param_type = float_type_from_length (param_type); param_type = float_type_from_length (param_type);
if (param_type != value_type (value)) if (param_type != value->type ())
value = value_from_contents (param_type, value = value_from_contents (param_type,
value_contents (value).data ()); value_contents (value).data ());
} }
@ -2788,13 +2788,13 @@ ui_printf (const char *arg, struct ui_file *stream)
break; break;
case wide_char_arg: case wide_char_arg:
{ {
struct gdbarch *gdbarch = value_type (val_args[i])->arch (); struct gdbarch *gdbarch = val_args[i]->type ()->arch ();
struct type *wctype = lookup_typename (current_language, struct type *wctype = lookup_typename (current_language,
"wchar_t", NULL, 0); "wchar_t", NULL, 0);
struct type *valtype; struct type *valtype;
const gdb_byte *bytes; const gdb_byte *bytes;
valtype = value_type (val_args[i]); valtype = val_args[i]->type ();
if (valtype->length () != wctype->length () if (valtype->length () != wctype->length ()
|| valtype->code () != TYPE_CODE_INT) || valtype->code () != TYPE_CODE_INT)
error (_("expected wchar_t argument for %%lc")); error (_("expected wchar_t argument for %%lc"));

View file

@ -206,10 +206,10 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
static void static void
py_print_type (struct ui_out *out, struct value *val) py_print_type (struct ui_out *out, struct value *val)
{ {
check_typedef (value_type (val)); check_typedef (val->type ());
string_file stb; string_file stb;
type_print (value_type (val), "", &stb, -1); type_print (val->type (), "", &stb, -1);
out->field_stream ("type", stb); out->field_stream ("type", stb);
} }
@ -235,7 +235,7 @@ py_print_value (struct ui_out *out, struct value *val,
if (args_type == MI_PRINT_SIMPLE_VALUES if (args_type == MI_PRINT_SIMPLE_VALUES
|| args_type == MI_PRINT_ALL_VALUES) || args_type == MI_PRINT_ALL_VALUES)
{ {
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (args_type == MI_PRINT_ALL_VALUES) if (args_type == MI_PRINT_ALL_VALUES)
should_print = 1; should_print = 1;
@ -378,7 +378,7 @@ py_print_single_arg (struct ui_out *out,
py_print_type (out, val); py_print_type (out, val);
if (val != NULL) if (val != NULL)
annotate_arg_value (value_type (val)); annotate_arg_value (val->type ());
/* If the output is to the CLI, and the user option "set print /* If the output is to the CLI, and the user option "set print
frame-arguments" is set to none, just output "...". */ frame-arguments" is set to none, just output "...". */

View file

@ -715,7 +715,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
{ {
struct value *val = value_object_to_value (handle_obj); struct value *val = value_object_to_value (handle_obj);
bytes = value_contents_all (val).data (); bytes = value_contents_all (val).data ();
bytes_len = value_type (val)->length (); bytes_len = val->type ()->length ();
} }
else else
{ {

View file

@ -574,7 +574,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
const struct value_print_options *options, const struct value_print_options *options,
const struct language_defn *language) const struct language_defn *language)
{ {
struct type *type = value_type (value); struct type *type = value->type ();
struct gdbarch *gdbarch = type->arch (); struct gdbarch *gdbarch = type->arch ();
enum gdbpy_string_repr_result print_result; enum gdbpy_string_repr_result print_result;

View file

@ -130,7 +130,7 @@ pyuw_value_obj_to_pointer (PyObject *pyo_value, CORE_ADDR *addr)
{ {
if ((value = value_object_to_value (pyo_value)) != NULL) if ((value = value_object_to_value (pyo_value)) != NULL)
{ {
*addr = unpack_pointer (value_type (value), *addr = unpack_pointer (value->type (),
value_contents (value).data ()); value_contents (value).data ());
rc = 1; rc = 1;
} }
@ -292,13 +292,13 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
return NULL; return NULL;
} }
data_size = register_size (pending_frame->gdbarch, regnum); data_size = register_size (pending_frame->gdbarch, regnum);
if (data_size != value_type (value)->length ()) if (data_size != value->type ()->length ())
{ {
PyErr_Format ( PyErr_Format (
PyExc_ValueError, PyExc_ValueError,
"The value of the register returned by the Python " "The value of the register returned by the Python "
"sniffer has unexpected size: %u instead of %u.", "sniffer has unexpected size: %u instead of %u.",
(unsigned) value_type (value)->length (), (unsigned) value->type ()->length (),
(unsigned) data_size); (unsigned) data_size);
return NULL; return NULL;
} }
@ -620,7 +620,7 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
/* `value' validation was done before, just assert. */ /* `value' validation was done before, just assert. */
gdb_assert (value != NULL); gdb_assert (value != NULL);
gdb_assert (data_size == value_type (value)->length ()); gdb_assert (data_size == value->type ()->length ());
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size); cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
memcpy (cached_frame->reg[i].data, memcpy (cached_frame->reg[i].data,

View file

@ -272,7 +272,7 @@ valpy_referenced_value (PyObject *self, PyObject *args)
scoped_value_mark free_values; scoped_value_mark free_values;
self_val = ((value_object *) self)->value; self_val = ((value_object *) self)->value;
switch (check_typedef (value_type (self_val))->code ()) switch (check_typedef (self_val->type ())->code ())
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
res_val = value_ind (self_val); res_val = value_ind (self_val);
@ -391,7 +391,7 @@ valpy_get_type (PyObject *self, void *closure)
if (!obj->type) if (!obj->type)
{ {
obj->type = type_to_type_object (value_type (obj->value)); obj->type = type_to_type_object (obj->value->type ());
if (!obj->type) if (!obj->type)
return NULL; return NULL;
} }
@ -418,7 +418,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
struct value *val = obj->value; struct value *val = obj->value;
scoped_value_mark free_values; scoped_value_mark free_values;
type = value_type (val); type = val->type ();
type = check_typedef (type); type = check_typedef (type);
if (type->is_pointer_or_reference () if (type->is_pointer_or_reference ()
@ -506,7 +506,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
struct type *type, *realtype; struct type *type, *realtype;
CORE_ADDR addr; CORE_ADDR addr;
type = value_type (value); type = value->type ();
realtype = check_typedef (type); realtype = check_typedef (type);
switch (realtype->code ()) switch (realtype->code ())
@ -885,7 +885,7 @@ value_has_field (struct value *v, PyObject *field)
try try
{ {
val_type = value_type (v); val_type = v->type ();
val_type = check_typedef (val_type); val_type = check_typedef (val_type);
if (val_type->is_pointer_or_reference ()) if (val_type->is_pointer_or_reference ())
val_type = check_typedef (val_type->target_type ()); val_type = check_typedef (val_type->target_type ());
@ -1037,7 +1037,7 @@ valpy_getitem (PyObject *self, PyObject *key)
{ {
struct type *val_type; struct type *val_type;
val_type = check_typedef (value_type (tmp)); val_type = check_typedef (tmp->type ());
if (val_type->code () == TYPE_CODE_PTR) if (val_type->code () == TYPE_CODE_PTR)
res_val = value_cast (lookup_pointer_type (base_class_type), tmp); res_val = value_cast (lookup_pointer_type (base_class_type), tmp);
else if (val_type->code () == TYPE_CODE_REF) else if (val_type->code () == TYPE_CODE_REF)
@ -1063,7 +1063,7 @@ valpy_getitem (PyObject *self, PyObject *key)
struct type *type; struct type *type;
tmp = coerce_ref (tmp); tmp = coerce_ref (tmp);
type = check_typedef (value_type (tmp)); type = check_typedef (tmp->type ());
if (type->code () != TYPE_CODE_ARRAY if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR) && type->code () != TYPE_CODE_PTR)
error (_("Cannot subscript requested type.")); error (_("Cannot subscript requested type."));
@ -1106,7 +1106,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
try try
{ {
ftype = check_typedef (value_type (function)); ftype = check_typedef (function->type ());
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
{ {
@ -1311,8 +1311,8 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
{ {
case VALPY_ADD: case VALPY_ADD:
{ {
struct type *ltype = value_type (arg1); struct type *ltype = arg1->type ();
struct type *rtype = value_type (arg2); struct type *rtype = arg2->type ();
ltype = check_typedef (ltype); ltype = check_typedef (ltype);
ltype = STRIP_REFERENCE (ltype); ltype = STRIP_REFERENCE (ltype);
@ -1335,8 +1335,8 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
break; break;
case VALPY_SUB: case VALPY_SUB:
{ {
struct type *ltype = value_type (arg1); struct type *ltype = arg1->type ();
struct type *rtype = value_type (arg2); struct type *rtype = arg2->type ();
ltype = check_typedef (ltype); ltype = check_typedef (ltype);
ltype = STRIP_REFERENCE (ltype); ltype = STRIP_REFERENCE (ltype);
@ -1506,7 +1506,7 @@ valpy_absolute (PyObject *self)
{ {
scoped_value_mark free_values; scoped_value_mark free_values;
if (value_less (value, value_zero (value_type (value), not_lval))) if (value_less (value, value_zero (value->type (), not_lval)))
isabs = 0; isabs = 0;
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
@ -1531,7 +1531,7 @@ valpy_nonzero (PyObject *self)
try try
{ {
type = check_typedef (value_type (self_value->value)); type = check_typedef (self_value->value->type ());
if (is_integral_type (type) || type->code () == TYPE_CODE_PTR) if (is_integral_type (type) || type->code () == TYPE_CODE_PTR)
nonzero = !!value_as_long (self_value->value); nonzero = !!value_as_long (self_value->value);
@ -1712,7 +1712,7 @@ static PyObject *
valpy_long (PyObject *self) valpy_long (PyObject *self)
{ {
struct value *value = ((value_object *) self)->value; struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value); struct type *type = value->type ();
LONGEST l = 0; LONGEST l = 0;
try try
@ -1747,7 +1747,7 @@ static PyObject *
valpy_float (PyObject *self) valpy_float (PyObject *self)
{ {
struct value *value = ((value_object *) self)->value; struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value); struct type *type = value->type ();
double d = 0; double d = 0;
try try
@ -1995,7 +1995,7 @@ gdbpy_convenience_variable (PyObject *self, PyObject *args)
if (var != NULL) if (var != NULL)
{ {
res_val = value_of_internalvar (gdbpy_enter::get_gdbarch (), var); res_val = value_of_internalvar (gdbpy_enter::get_gdbarch (), var);
if (value_type (res_val)->code () == TYPE_CODE_VOID) if (res_val->type ()->code () == TYPE_CODE_VOID)
res_val = NULL; res_val = NULL;
} }
} }

View file

@ -423,7 +423,7 @@ python_xmethod_worker::do_get_result_type (value *obj,
return EXT_LANG_RC_OK; return EXT_LANG_RC_OK;
} }
obj_type = check_typedef (value_type (obj)); obj_type = check_typedef (obj->type ());
this_type = check_typedef (type_object_to_type (m_this_type)); this_type = check_typedef (type_object_to_type (m_this_type));
if (obj_type->code () == TYPE_CODE_PTR) if (obj_type->code () == TYPE_CODE_PTR)
{ {
@ -508,7 +508,7 @@ python_xmethod_worker::invoke (struct value *obj,
struct type *obj_type, *this_type; struct type *obj_type, *this_type;
struct value *res = NULL; struct value *res = NULL;
obj_type = check_typedef (value_type (obj)); obj_type = check_typedef (obj->type ());
this_type = check_typedef (type_object_to_type (m_this_type)); this_type = check_typedef (type_object_to_type (m_this_type));
if (obj_type->code () == TYPE_CODE_PTR) if (obj_type->code () == TYPE_CODE_PTR)
{ {

View file

@ -753,7 +753,7 @@ readable_regcache::cooked_read_value (int regnum)
if (cooked_read (regnum, if (cooked_read (regnum,
value_contents_raw (result).data ()) == REG_UNAVAILABLE) value_contents_raw (result).data ()) == REG_UNAVAILABLE)
mark_value_bytes_unavailable (result, 0, mark_value_bytes_unavailable (result, 0,
value_type (result)->length ()); result->type ()->length ());
return result; return result;
} }

View file

@ -1116,7 +1116,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
try try
{ {
val = value_of_register (regnum, frame); val = value_of_register (regnum, frame);
regtype = value_type (val); regtype = val->type ();
} }
catch (const gdb_exception_error &ex) catch (const gdb_exception_error &ex)
{ {
@ -3047,7 +3047,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR osp = sp; CORE_ADDR osp = sp;
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (function->type ());
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (ftype->target_type ()); ftype = check_typedef (ftype->target_type ());
@ -3063,7 +3063,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
struct riscv_arg_info *info = &arg_info[i]; struct riscv_arg_info *info = &arg_info[i];
arg_value = args[i]; arg_value = args[i];
arg_type = check_typedef (value_type (arg_value)); arg_type = check_typedef (arg_value->type ());
riscv_arg_location (gdbarch, info, &call_info, arg_type, riscv_arg_location (gdbarch, info, &call_info, arg_type,
ftype->has_varargs () && i >= ftype->num_fields ()); ftype->has_varargs () && i >= ftype->num_fields ());
@ -3380,7 +3380,7 @@ riscv_return_value (struct gdbarch *gdbarch,
type of ABI_VAL will differ from ARG_TYPE due to type of ABI_VAL will differ from ARG_TYPE due to
dynamic type resolution, and so will most likely dynamic type resolution, and so will most likely
fail. */ fail. */
arg_type = value_type (abi_val); arg_type = abi_val->type ();
} }
if (writebuf != nullptr) if (writebuf != nullptr)
write_memory (addr, writebuf, info.length); write_memory (addr, writebuf, info.length);

View file

@ -350,7 +350,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int reg_size = register_size (gdbarch, ii + 3); int reg_size = register_size (gdbarch, ii + 3);
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();
if (type->code () == TYPE_CODE_FLT) if (type->code () == TYPE_CODE_FLT)
@ -447,7 +447,7 @@ ran_out_of_registers_for_arguments:
for (; jj < nargs; ++jj) for (; jj < nargs; ++jj)
{ {
struct value *val = args[jj]; struct value *val = args[jj];
space += ((value_type (val)->length ()) + 3) & -4; space += ((val->type ()->length ()) + 3) & -4;
} }
/* Add location required for the rest of the parameters. */ /* Add location required for the rest of the parameters. */
@ -480,7 +480,7 @@ ran_out_of_registers_for_arguments:
{ {
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();

View file

@ -93,7 +93,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
int reg_size = register_size (gdbarch, ii + 3); int reg_size = register_size (gdbarch, ii + 3);
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();
if (type->code () == TYPE_CODE_FLT) if (type->code () == TYPE_CODE_FLT)
@ -184,7 +184,7 @@ ran_out_of_registers_for_arguments:
{ {
struct value *val = args[jj]; struct value *val = args[jj];
space += align_up (value_type (val)->length (), 4); space += align_up (val->type ()->length (), 4);
} }
/* Add location required for the rest of the parameters. */ /* Add location required for the rest of the parameters. */
@ -217,7 +217,7 @@ ran_out_of_registers_for_arguments:
{ {
arg = args[argno]; arg = args[argno];
type = check_typedef (value_type (arg)); type = check_typedef (arg->type ());
len = type->length (); len = type->length ();

View file

@ -244,7 +244,7 @@ rust_chartype_p (struct type *type)
static struct value * static struct value *
rust_get_trait_object_pointer (struct value *value) rust_get_trait_object_pointer (struct value *value)
{ {
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value->type ());
if (type->code () != TYPE_CODE_STRUCT || type->num_fields () != 2) if (type->code () != TYPE_CODE_STRUCT || type->num_fields () != 2)
return NULL; return NULL;
@ -330,23 +330,23 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
"slice"); "slice");
struct value *len = value_struct_elt (&val, {}, "length", NULL, "slice"); struct value *len = value_struct_elt (&val, {}, "length", NULL, "slice");
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (strcmp (type->name (), "&str") == 0) if (strcmp (type->name (), "&str") == 0)
val_print_string (value_type (base)->target_type (), "UTF-8", val_print_string (base->type ()->target_type (), "UTF-8",
value_as_address (base), value_as_long (len), stream, value_as_address (base), value_as_long (len), stream,
options); options);
else else
{ {
LONGEST llen = value_as_long (len); LONGEST llen = value_as_long (len);
type_print (value_type (val), "", stream, -1); type_print (val->type (), "", stream, -1);
gdb_printf (stream, " "); gdb_printf (stream, " ");
if (llen == 0) if (llen == 0)
gdb_printf (stream, "[]"); gdb_printf (stream, "[]");
else else
{ {
struct type *elt_type = value_type (base)->target_type (); struct type *elt_type = base->type ()->target_type ();
struct type *array_type = lookup_array_range_type (elt_type, 0, struct type *array_type = lookup_array_range_type (elt_type, 0,
llen - 1); llen - 1);
struct value *array = allocate_value_lazy (array_type); struct value *array = allocate_value_lazy (array_type);
@ -368,7 +368,7 @@ rust_language::val_print_struct
{ {
int i; int i;
int first_field; int first_field;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (rust_slice_type_p (type)) if (rust_slice_type_p (type))
{ {
@ -450,14 +450,14 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const const struct value_print_options *options) const
{ {
struct value_print_options opts = *options; struct value_print_options opts = *options;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
opts.deref_ref = false; opts.deref_ref = false;
gdb_assert (rust_enum_p (type)); gdb_assert (rust_enum_p (type));
gdb::array_view<const gdb_byte> view gdb::array_view<const gdb_byte> view
(value_contents_for_printing (val).data (), (value_contents_for_printing (val).data (),
value_type (val)->length ()); val->type ()->length ());
type = resolve_dynamic_type (type, view, value_address (val)); type = resolve_dynamic_type (type, view, value_address (val));
if (rust_empty_enum_p (type)) if (rust_empty_enum_p (type))
@ -530,7 +530,7 @@ rust_language::value_print_inner
opts.prettyformat = (opts.prettyformat_structs opts.prettyformat = (opts.prettyformat_structs
? Val_prettyformat : Val_no_prettyformat); ? Val_prettyformat : Val_no_prettyformat);
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
@ -635,11 +635,11 @@ rust_language::value_print
value_print_options opts = *options; value_print_options opts = *options;
opts.deref_ref = true; opts.deref_ref = true;
struct type *type = check_typedef (value_type (val)); struct type *type = check_typedef (val->type ());
if (type->is_pointer_or_reference ()) if (type->is_pointer_or_reference ())
{ {
gdb_printf (stream, "("); gdb_printf (stream, "(");
type_print (value_type (val), "", stream, -1); type_print (val->type (), "", stream, -1);
gdb_printf (stream, ") "); gdb_printf (stream, ") ");
} }
@ -1038,7 +1038,7 @@ rust_range (struct type *expect_type, struct expression *exp,
} }
else else
{ {
index_type = value_type (high); index_type = high->type ();
name = (inclusive name = (inclusive
? "std::ops::RangeToInclusive" : "std::ops::RangeTo"); ? "std::ops::RangeToInclusive" : "std::ops::RangeTo");
} }
@ -1047,14 +1047,14 @@ rust_range (struct type *expect_type, struct expression *exp,
{ {
if (high == NULL) if (high == NULL)
{ {
index_type = value_type (low); index_type = low->type ();
name = "std::ops::RangeFrom"; name = "std::ops::RangeFrom";
} }
else else
{ {
if (!types_equal (value_type (low), value_type (high))) if (!types_equal (low->type (), high->type ()))
error (_("Range expression with different types")); error (_("Range expression with different types"));
index_type = value_type (low); index_type = low->type ();
name = inclusive ? "std::ops::RangeInclusive" : "std::ops::Range"; name = inclusive ? "std::ops::RangeInclusive" : "std::ops::Range";
} }
} }
@ -1152,7 +1152,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
LONGEST high = 0; LONGEST high = 0;
int want_slice = 0; int want_slice = 0;
rhstype = check_typedef (value_type (rhs)); rhstype = check_typedef (rhs->type ());
if (rust_range_type_p (rhstype)) if (rust_range_type_p (rhstype))
{ {
if (!for_addr) if (!for_addr)
@ -1163,7 +1163,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
else else
low = value_as_long (rhs); low = value_as_long (rhs);
struct type *type = check_typedef (value_type (lhs)); struct type *type = check_typedef (lhs->type ());
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
struct type *base_type = nullptr; struct type *base_type = nullptr;
@ -1272,7 +1272,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
&& rust_slice_type_p (type)) && rust_slice_type_p (type))
? type->name () : "&[*gdb*]"); ? type->name () : "&[*gdb*]");
slice = rust_slice_type (new_name, value_type (result), usize); slice = rust_slice_type (new_name, result->type (), usize);
addrval = value_allocate_space_in_inferior (slice->length ()); addrval = value_allocate_space_in_inferior (slice->length ());
addr = value_as_long (addrval); addr = value_as_long (addrval);
@ -1321,8 +1321,8 @@ eval_op_rust_complement (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *value) struct value *value)
{ {
if (value_type (value)->code () == TYPE_CODE_BOOL) if (value->type ()->code () == TYPE_CODE_BOOL)
return value_from_longest (value_type (value), value_logical_not (value)); return value_from_longest (value->type (), value_logical_not (value));
return value_complement (value); return value_complement (value);
} }
@ -1350,7 +1350,7 @@ eval_op_rust_array (struct type *expect_type, struct expression *exp,
else else
{ {
struct type *arraytype struct type *arraytype
= lookup_array_range_type (value_type (elt), 0, copies - 1); = lookup_array_range_type (elt->type (), 0, copies - 1);
return allocate_value (arraytype); return allocate_value (arraytype);
} }
} }
@ -1366,7 +1366,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
int field_number = std::get<0> (m_storage); int field_number = std::get<0> (m_storage);
struct type *type = value_type (lhs); struct type *type = lhs->type ();
if (type->code () == TYPE_CODE_STRUCT) if (type->code () == TYPE_CODE_STRUCT)
{ {
@ -1384,7 +1384,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
int fieldno = rust_enum_variant (type); int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type); lhs = value_primitive_field (lhs, 0, fieldno, type);
outer_type = type; outer_type = type;
type = value_type (lhs); type = lhs->type ();
} }
/* Tuples and tuple structs */ /* Tuples and tuple structs */
@ -1434,7 +1434,7 @@ rust_structop::evaluate (struct type *expect_type,
const char *field_name = std::get<1> (m_storage).c_str (); const char *field_name = std::get<1> (m_storage).c_str ();
struct value *result; struct value *result;
struct type *type = value_type (lhs); struct type *type = lhs->type ();
if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type)) if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
{ {
type = resolve_dynamic_type (type, value_contents (lhs), type = resolve_dynamic_type (type, value_contents (lhs),
@ -1448,7 +1448,7 @@ rust_structop::evaluate (struct type *expect_type,
lhs = value_primitive_field (lhs, 0, fieldno, type); lhs = value_primitive_field (lhs, 0, fieldno, type);
struct type *outer_type = type; struct type *outer_type = type;
type = value_type (lhs); type = lhs->type ();
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type)) if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
error (_("Attempting to access named field %s of tuple " error (_("Attempting to access named field %s of tuple "
"variant %s::%s, which has only anonymous fields"), "variant %s::%s, which has only anonymous fields"),
@ -1470,7 +1470,7 @@ rust_structop::evaluate (struct type *expect_type,
else else
result = value_struct_elt (&lhs, {}, field_name, NULL, "structure"); result = value_struct_elt (&lhs, {}, field_name, NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
result = value_zero (value_type (result), VALUE_LVAL (result)); result = value_zero (result->type (), VALUE_LVAL (result));
return result; return result;
} }
@ -1537,10 +1537,10 @@ rust_structop::evaluate_funcall (struct type *expect_type,
type in order to look up the method. */ type in order to look up the method. */
args[0] = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); args[0] = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
/* We don't yet implement real Deref semantics. */ /* We don't yet implement real Deref semantics. */
while (value_type (args[0])->code () == TYPE_CODE_PTR) while (args[0]->type ()->code () == TYPE_CODE_PTR)
args[0] = value_ind (args[0]); args[0] = value_ind (args[0]);
struct type *type = value_type (args[0]); struct type *type = args[0]->type ();
if ((type->code () != TYPE_CODE_STRUCT if ((type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION && type->code () != TYPE_CODE_UNION
&& type->code () != TYPE_CODE_ENUM) && type->code () != TYPE_CODE_ENUM)

View file

@ -668,7 +668,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR cfa; CORE_ADDR cfa;
int num_register_candidate_args; int num_register_candidate_args;
struct type *func_type = value_type (function); struct type *func_type = function->type ();
/* Dereference function pointer types. */ /* Dereference function pointer types. */
while (func_type->code () == TYPE_CODE_PTR) while (func_type->code () == TYPE_CODE_PTR)
@ -726,7 +726,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
struct value *arg = args[i]; struct value *arg = args[i];
const gdb_byte *arg_bits = value_contents_all (arg).data (); const gdb_byte *arg_bits = value_contents_all (arg).data ();
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
ULONGEST arg_size = arg_type->length (); ULONGEST arg_size = arg_type->length ();
if (i == 0 && struct_addr != 0 if (i == 0 && struct_addr != 0

View file

@ -1749,7 +1749,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
s390_gdbarch_tdep *tdep, int word_size, s390_gdbarch_tdep *tdep, int word_size,
enum bfd_endian byte_order, int is_unnamed) enum bfd_endian byte_order, int is_unnamed)
{ {
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (arg->type ());
unsigned int length = type->length (); unsigned int length = type->length ();
int write_mode = as->regcache != NULL; int write_mode = as->regcache != NULL;
@ -1911,7 +1911,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int i; int i;
struct s390_arg_state arg_state, arg_prep; struct s390_arg_state arg_state, arg_prep;
CORE_ADDR param_area_start, new_sp; CORE_ADDR param_area_start, new_sp;
struct type *ftype = check_typedef (value_type (function)); struct type *ftype = check_typedef (function->type ());
if (ftype->code () == TYPE_CODE_PTR) if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (ftype->target_type ()); ftype = check_typedef (ftype->target_type ());

View file

@ -897,7 +897,7 @@ sh_stack_allocsize (int nargs, struct value **args)
{ {
int stack_alloc = 0; int stack_alloc = 0;
while (nargs-- > 0) while (nargs-- > 0)
stack_alloc += ((value_type (args[nargs])->length () + 3) & ~3); stack_alloc += ((args[nargs]->type ()->length () + 3) & ~3);
return stack_alloc; return stack_alloc;
} }
@ -1030,7 +1030,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
int argreg = ARG0_REGNUM; int argreg = ARG0_REGNUM;
int flt_argreg = 0; int flt_argreg = 0;
int argnum; int argnum;
struct type *func_type = value_type (function); struct type *func_type = function->type ();
struct type *type; struct type *type;
CORE_ADDR regval; CORE_ADDR regval;
const gdb_byte *val; const gdb_byte *val;
@ -1060,7 +1060,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
in four registers available. Loop thru args from first to last. */ in four registers available. Loop thru args from first to last. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
type = value_type (args[argnum]); type = args[argnum]->type ();
len = type->length (); len = type->length ();
val = sh_justify_value_in_reg (gdbarch, args[argnum], len); val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
@ -1172,7 +1172,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
int stack_offset = 0; int stack_offset = 0;
int argreg = ARG0_REGNUM; int argreg = ARG0_REGNUM;
int argnum; int argnum;
struct type *func_type = value_type (function); struct type *func_type = function->type ();
struct type *type; struct type *type;
CORE_ADDR regval; CORE_ADDR regval;
const gdb_byte *val; const gdb_byte *val;
@ -1198,7 +1198,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
in four registers available. Loop thru args from first to last. */ in four registers available. Loop thru args from first to last. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
type = value_type (args[argnum]); type = args[argnum]->type ();
len = type->length (); len = type->length ();
val = sh_justify_value_in_reg (gdbarch, args[argnum], len); val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
@ -1364,7 +1364,7 @@ sh_return_value_nofpu (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache, struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
struct type *func_type = function ? value_type (function) : NULL; struct type *func_type = function ? function->type () : NULL;
if (sh_use_struct_convention_nofpu if (sh_use_struct_convention_nofpu
(sh_is_renesas_calling_convention (func_type), type)) (sh_is_renesas_calling_convention (func_type), type))
@ -1381,7 +1381,7 @@ sh_return_value_fpu (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache, struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
struct type *func_type = function ? value_type (function) : NULL; struct type *func_type = function ? function->type () : NULL;
if (sh_use_struct_convention ( if (sh_use_struct_convention (
sh_is_renesas_calling_convention (func_type), type)) sh_is_renesas_calling_convention (func_type), type))

View file

@ -621,7 +621,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
if (sparc_arg_by_memory_p (type)) if (sparc_arg_by_memory_p (type))
@ -665,7 +665,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
const bfd_byte *valbuf = value_contents (args[i]).data (); const bfd_byte *valbuf = value_contents (args[i]).data ();
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
gdb_byte buf[4]; gdb_byte buf[4];

View file

@ -1381,7 +1381,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
if (sparc64_structure_or_union_p (type) if (sparc64_structure_or_union_p (type)
@ -1481,7 +1481,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
const gdb_byte *valbuf = value_contents (args[i]).data (); const gdb_byte *valbuf = value_contents (args[i]).data ();
struct type *type = value_type (args[i]); struct type *type = args[i]->type ();
int len = type->length (); int len = type->length ();
int regnum = -1; int regnum = -1;
gdb_byte buf[16]; gdb_byte buf[16];

View file

@ -467,7 +467,7 @@ print_frame_arg (const frame_print_options &fp_opts,
because our standard indentation here is 4 spaces, and because our standard indentation here is 4 spaces, and
val_print indents 2 for each recurse. */ val_print indents 2 for each recurse. */
annotate_arg_value (value_type (arg->val)); annotate_arg_value (arg->val->type ());
/* Use the appropriate language to display our symbol, unless the /* Use the appropriate language to display our symbol, unless the
user forced the language to a specific language. */ user forced the language to a specific language. */
@ -578,7 +578,7 @@ read_frame_arg (const frame_print_options &fp_opts,
if (val && entryval && !current_uiout->is_mi_like_p ()) if (val && entryval && !current_uiout->is_mi_like_p ())
{ {
struct type *type = value_type (val); struct type *type = val->type ();
if (value_lazy (val)) if (value_lazy (val))
value_fetch_lazy (val); value_fetch_lazy (val);
@ -601,7 +601,7 @@ read_frame_arg (const frame_print_options &fp_opts,
val_deref = coerce_ref (val); val_deref = coerce_ref (val);
if (value_lazy (val_deref)) if (value_lazy (val_deref))
value_fetch_lazy (val_deref); value_fetch_lazy (val_deref);
type_deref = value_type (val_deref); type_deref = val_deref->type ();
entryval_deref = coerce_ref (entryval); entryval_deref = coerce_ref (entryval);
if (value_lazy (entryval_deref)) if (value_lazy (entryval_deref))
@ -2742,7 +2742,7 @@ return_command (const char *retval_exp, int from_tty)
error (_("Return value type not available for selected " error (_("Return value type not available for selected "
"stack frame.\n" "stack frame.\n"
"Please use an explicit cast of the value to return.")); "Please use an explicit cast of the value to return."));
return_type = value_type (return_value); return_type = return_value->type ();
} }
return_type = check_typedef (return_type); return_type = check_typedef (return_type);
return_value = value_cast (return_type, return_value); return_value = value_cast (return_type, return_value);
@ -2765,7 +2765,7 @@ return_command (const char *retval_exp, int from_tty)
return_value = NULL; return_value = NULL;
else if (thisfun != NULL) else if (thisfun != NULL)
{ {
if (is_nocall_function (check_typedef (value_type (function)))) if (is_nocall_function (check_typedef (function->type ())))
{ {
query_prefix = query_prefix =
string_printf ("Function '%s' does not follow the target " string_printf ("Function '%s' does not follow the target "
@ -2817,7 +2817,7 @@ return_command (const char *retval_exp, int from_tty)
/* Store RETURN_VALUE in the just-returned register set. */ /* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL) if (return_value != NULL)
{ {
struct type *return_type = value_type (return_value); struct type *return_type = return_value->type ();
struct gdbarch *cache_arch = get_current_regcache ()->arch (); struct gdbarch *cache_arch = get_current_regcache ()->arch ();
gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION

View file

@ -864,7 +864,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int stack_offset = 4; int stack_offset = 4;
int references_offset = 4; int references_offset = 4;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *func_type = value_type (function); struct type *func_type = function->type ();
/* The first arg passed on stack. Mostly the first 10 args are passed by /* The first arg passed on stack. Mostly the first 10 args are passed by
registers. */ registers. */
int first_arg_on_stack = 10; int first_arg_on_stack = 10;
@ -895,7 +895,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
{ {
int len = align_up (value_type (args[argnum])->length (), 4); int len = align_up (args[argnum]->type ()->length (), 4);
if (argnum >= 10 - argreg) if (argnum >= 10 - argreg)
references_offset += len; references_offset += len;
stack_offset += len; stack_offset += len;
@ -913,7 +913,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
const gdb_byte *val; const gdb_byte *val;
struct value *arg = args[argnum]; struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg)); struct type *arg_type = check_typedef (arg->type ());
int len = arg_type->length (); int len = arg_type->length ();
enum type_code typecode = arg_type->code (); enum type_code typecode = arg_type->code ();

View file

@ -515,7 +515,7 @@ whatis_exp (const char *exp, int show)
any typedef level. "ptype" always strips all levels of any typedef level. "ptype" always strips all levels of
typedefs. */ typedefs. */
val = evaluate_type (expr.get ()); val = evaluate_type (expr.get ());
type = value_type (val); type = val->type ();
if (show == -1 && expr->first_opcode () == OP_TYPE) if (show == -1 && expr->first_opcode () == OP_TYPE)
{ {
@ -536,7 +536,7 @@ whatis_exp (const char *exp, int show)
else else
{ {
val = access_value_history (0); val = access_value_history (0);
type = value_type (val); type = val->type ();
} }
if (flags.print_offsets && is_dynamic_type (type)) if (flags.print_offsets && is_dynamic_type (type))
@ -712,7 +712,7 @@ maintenance_print_type (const char *type_name, int from_tty)
{ {
expression_up expr = parse_expression (type_name); expression_up expr = parse_expression (type_name);
struct value *val = evaluate_type (expr.get ()); struct value *val = evaluate_type (expr.get ());
struct type *type = value_type (val); struct type *type = val->type ();
if (type != nullptr) if (type != nullptr)
recursive_dump_type (type, 0); recursive_dump_type (type, 0);

View file

@ -1037,7 +1037,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)
arg_space += ((value_type (args[argnum])->length () + 3) & ~3); arg_space += ((args[argnum]->type ()->length () + 3) & ~3);
sp -= arg_space + stack_offset; sp -= arg_space + stack_offset;
argreg = E_ARG0_REGNUM; argreg = E_ARG0_REGNUM;
@ -1054,9 +1054,9 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
gdb_byte *val; gdb_byte *val;
gdb_byte valbuf[v850_reg_size]; gdb_byte valbuf[v850_reg_size];
if (!v850_type_is_scalar (value_type (*args)) if (!v850_type_is_scalar ((*args)->type ())
&& tdep->abi == V850_ABI_GCC && tdep->abi == V850_ABI_GCC
&& value_type (*args)->length () > E_MAX_RETTYPE_SIZE_IN_REGS) && (*args)->type ()->length () > E_MAX_RETTYPE_SIZE_IN_REGS)
{ {
store_unsigned_integer (valbuf, 4, byte_order, store_unsigned_integer (valbuf, 4, byte_order,
value_address (*args)); value_address (*args));
@ -1065,12 +1065,12 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
} }
else else
{ {
len = value_type (*args)->length (); len = (*args)->type ()->length ();
val = (gdb_byte *) value_contents (*args).data (); val = (gdb_byte *) value_contents (*args).data ();
} }
if (tdep->eight_byte_align if (tdep->eight_byte_align
&& v850_eight_byte_align_p (value_type (*args))) && v850_eight_byte_align_p ((*args)->type ()))
{ {
if (argreg <= E_ARGLAST_REGNUM && (argreg & 1)) if (argreg <= E_ARGLAST_REGNUM && (argreg & 1))
argreg++; argreg++;

View file

@ -88,7 +88,7 @@ value_ptradd (struct value *arg1, LONGEST arg2)
struct value *result; struct value *result;
arg1 = coerce_array (arg1); arg1 = coerce_array (arg1);
valptrtype = check_typedef (value_type (arg1)); valptrtype = check_typedef (arg1->type ());
sz = find_size_for_pointer_math (valptrtype); sz = find_size_for_pointer_math (valptrtype);
result = value_from_pointer (valptrtype, result = value_from_pointer (valptrtype,
@ -109,8 +109,8 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
arg1 = coerce_array (arg1); arg1 = coerce_array (arg1);
arg2 = coerce_array (arg2); arg2 = coerce_array (arg2);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
gdb_assert (type1->code () == TYPE_CODE_PTR); gdb_assert (type1->code () == TYPE_CODE_PTR);
gdb_assert (type2->code () == TYPE_CODE_PTR); gdb_assert (type2->code () == TYPE_CODE_PTR);
@ -149,7 +149,7 @@ value_subscript (struct value *array, LONGEST index)
struct type *tarray; struct type *tarray;
array = coerce_ref (array); array = coerce_ref (array);
tarray = check_typedef (value_type (array)); tarray = check_typedef (array->type ());
if (tarray->code () == TYPE_CODE_ARRAY if (tarray->code () == TYPE_CODE_ARRAY
|| tarray->code () == TYPE_CODE_STRING) || tarray->code () == TYPE_CODE_STRING)
@ -214,7 +214,7 @@ static struct value *
value_subscripted_rvalue (struct value *array, LONGEST index, value_subscripted_rvalue (struct value *array, LONGEST index,
LONGEST lowerbound) LONGEST lowerbound)
{ {
struct type *array_type = check_typedef (value_type (array)); struct type *array_type = check_typedef (array->type ());
struct type *elt_type = array_type->target_type (); struct type *elt_type = array_type->target_type ();
LONGEST elt_size = type_length_units (elt_type); LONGEST elt_size = type_length_units (elt_type);
@ -292,7 +292,7 @@ int
binop_user_defined_p (enum exp_opcode op, binop_user_defined_p (enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2)); return binop_types_user_defined_p (op, arg1->type (), arg2->type ());
} }
/* Check to see if argument is a structure. This is called so /* Check to see if argument is a structure. This is called so
@ -308,7 +308,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
if (op == UNOP_ADDR) if (op == UNOP_ADDR)
return 0; return 0;
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
if (TYPE_IS_REFERENCE (type1)) if (TYPE_IS_REFERENCE (type1))
type1 = check_typedef (type1->target_type ()); type1 = check_typedef (type1->target_type ());
return type1->code () == TYPE_CODE_STRUCT; return type1->code () == TYPE_CODE_STRUCT;
@ -394,7 +394,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
/* now we know that what we have to do is construct our /* now we know that what we have to do is construct our
arg vector and find the right function to call it with. */ arg vector and find the right function to call it with. */
if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT) if (check_typedef (arg1->type ())->code () != TYPE_CODE_STRUCT)
error (_("Can't do that binary op on that type")); /* FIXME be explicit */ error (_("Can't do that binary op on that type")); /* FIXME be explicit */
value *argvec_storage[3]; value *argvec_storage[3];
@ -521,7 +521,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
argvec[1] = argvec[0]; argvec[1] = argvec[0];
argvec = argvec.slice (1); argvec = argvec.slice (1);
} }
if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD) if (argvec[0]->type ()->code () == TYPE_CODE_XMETHOD)
{ {
/* Static xmethods are not supported yet. */ /* Static xmethods are not supported yet. */
gdb_assert (static_memfuncp == 0); gdb_assert (static_memfuncp == 0);
@ -540,7 +540,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
{ {
struct type *return_type; struct type *return_type;
return_type = check_typedef (value_type (argvec[0]))->target_type (); return_type = check_typedef (argvec[0]->type ())->target_type ();
return value_zero (return_type, VALUE_LVAL (arg1)); return value_zero (return_type, VALUE_LVAL (arg1));
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
@ -559,7 +559,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
struct value * struct value *
value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
{ {
struct gdbarch *gdbarch = value_type (arg1)->arch (); struct gdbarch *gdbarch = arg1->type ()->arch ();
char *ptr; char *ptr;
char tstr[13], mangle_tstr[13]; char tstr[13], mangle_tstr[13];
int static_memfuncp, nargs; int static_memfuncp, nargs;
@ -569,7 +569,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
/* now we know that what we have to do is construct our /* now we know that what we have to do is construct our
arg vector and find the right function to call it with. */ arg vector and find the right function to call it with. */
if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT) if (check_typedef (arg1->type ())->code () != TYPE_CODE_STRUCT)
error (_("Can't do that unary op on that type")); /* FIXME be explicit */ error (_("Can't do that unary op on that type")); /* FIXME be explicit */
value *argvec_storage[3]; value *argvec_storage[3];
@ -634,7 +634,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
argvec[1] = argvec[0]; argvec[1] = argvec[0];
argvec = argvec.slice (1); argvec = argvec.slice (1);
} }
if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD) if (argvec[0]->type ()->code () == TYPE_CODE_XMETHOD)
{ {
/* Static xmethods are not supported yet. */ /* Static xmethods are not supported yet. */
gdb_assert (static_memfuncp == 0); gdb_assert (static_memfuncp == 0);
@ -653,7 +653,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
{ {
struct type *return_type; struct type *return_type;
return_type = check_typedef (value_type (argvec[0]))->target_type (); return_type = check_typedef (argvec[0]->type ())->target_type ();
return value_zero (return_type, VALUE_LVAL (arg1)); return value_zero (return_type, VALUE_LVAL (arg1));
} }
return call_function_by_hand (argvec[0], NULL, return call_function_by_hand (argvec[0], NULL,
@ -671,8 +671,8 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
struct value * struct value *
value_concat (struct value *arg1, struct value *arg2) value_concat (struct value *arg1, struct value *arg2)
{ {
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (arg2->type ());
if (type1->code () != TYPE_CODE_ARRAY && type2->code () != TYPE_CODE_ARRAY) if (type1->code () != TYPE_CODE_ARRAY && type2->code () != TYPE_CODE_ARRAY)
error ("no array provided to concatenation"); error ("no array provided to concatenation");
@ -766,8 +766,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
{ {
struct type *type1, *type2; struct type *type1, *type2;
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
/* At least one of the arguments must be of floating-point type. */ /* At least one of the arguments must be of floating-point type. */
gdb_assert (is_floating_type (type1) || is_floating_type (type2)); gdb_assert (is_floating_type (type1) || is_floating_type (type2));
@ -826,8 +826,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
static struct value * static struct value *
fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
{ {
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (arg2->type ());
const struct language_defn *language = current_language; const struct language_defn *language = current_language;
struct gdbarch *gdbarch = type1->arch (); struct gdbarch *gdbarch = type1->arch ();
@ -976,8 +976,8 @@ static struct value *scalar_binop (struct value *arg1, struct value *arg2,
static struct value * static struct value *
complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
{ {
struct type *arg1_type = check_typedef (value_type (arg1)); struct type *arg1_type = check_typedef (arg1->type ());
struct type *arg2_type = check_typedef (value_type (arg2)); struct type *arg2_type = check_typedef (arg2->type ());
struct value *arg1_real, *arg1_imag, *arg2_real, *arg2_imag; struct value *arg1_real, *arg1_imag, *arg2_real, *arg2_imag;
if (arg1_type->code () == TYPE_CODE_COMPLEX) if (arg1_type->code () == TYPE_CODE_COMPLEX)
@ -1001,8 +1001,8 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
arg2_imag = value_zero (arg2_type, not_lval); arg2_imag = value_zero (arg2_type, not_lval);
} }
struct type *comp_type = promotion_type (value_type (arg1_real), struct type *comp_type = promotion_type (arg1_real->type (),
value_type (arg2_real)); arg2_real->type ());
if (!can_create_complex_type (comp_type)) if (!can_create_complex_type (comp_type))
error (_("Argument to complex arithmetic operation not supported.")); error (_("Argument to complex arithmetic operation not supported."));
@ -1072,7 +1072,7 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
else else
v1 = v1 || v2; v1 = v1 || v2;
return value_from_longest (value_type (x1), v1); return value_from_longest (x1->type (), v1);
} }
break; break;
@ -1158,8 +1158,8 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
arg2 = coerce_ref (arg2); arg2 = coerce_ref (arg2);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
if (type1->code () == TYPE_CODE_COMPLEX if (type1->code () == TYPE_CODE_COMPLEX
|| type2->code () == TYPE_CODE_COMPLEX) || type2->code () == TYPE_CODE_COMPLEX)
@ -1377,7 +1377,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (result_type); val = allocate_value (result_type);
store_unsigned_integer (value_contents_raw (val).data (), store_unsigned_integer (value_contents_raw (val).data (),
value_type (val)->length (), val->type ()->length (),
type_byte_order (result_type), type_byte_order (result_type),
v); v);
} }
@ -1538,7 +1538,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (result_type); val = allocate_value (result_type);
store_signed_integer (value_contents_raw (val).data (), store_signed_integer (value_contents_raw (val).data (),
value_type (val)->length (), val->type ()->length (),
type_byte_order (result_type), type_byte_order (result_type),
v); v);
} }
@ -1573,7 +1573,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
eltype = check_typedef (vector_type->target_type ()); eltype = check_typedef (vector_type->target_type ());
elval = value_cast (eltype, scalar_value); elval = value_cast (eltype, scalar_value);
scalar_type = check_typedef (value_type (scalar_value)); scalar_type = check_typedef (scalar_value->type ());
/* If we reduced the length of the scalar then check we didn't loose any /* If we reduced the length of the scalar then check we didn't loose any
important bits. */ important bits. */
@ -1603,8 +1603,8 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
int t1_is_vec, t2_is_vec, elsize, i; int t1_is_vec, t2_is_vec, elsize, i;
LONGEST low_bound1, high_bound1, low_bound2, high_bound2; LONGEST low_bound1, high_bound1, low_bound2, high_bound2;
type1 = check_typedef (value_type (val1)); type1 = check_typedef (val1->type ());
type2 = check_typedef (value_type (val2)); type2 = check_typedef (val2->type ());
t1_is_vec = (type1->code () == TYPE_CODE_ARRAY t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& type1->is_vector ()) ? 1 : 0; && type1->is_vector ()) ? 1 : 0;
@ -1648,8 +1648,8 @@ struct value *
value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
{ {
struct value *val; struct value *val;
struct type *type1 = check_typedef (value_type (arg1)); struct type *type1 = check_typedef (arg1->type ());
struct type *type2 = check_typedef (value_type (arg2)); struct type *type2 = check_typedef (arg2->type ());
int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& type1->is_vector ()); && type1->is_vector ());
int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
@ -1689,7 +1689,7 @@ value_logical_not (struct value *arg1)
struct type *type1; struct type *type1;
arg1 = coerce_array (arg1); arg1 = coerce_array (arg1);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
if (is_floating_value (arg1)) if (is_floating_value (arg1))
return target_float_is_zero (value_contents (arg1).data (), type1); return target_float_is_zero (value_contents (arg1).data (), type1);
@ -1712,8 +1712,8 @@ value_logical_not (struct value *arg1)
static int static int
value_strcmp (struct value *arg1, struct value *arg2) value_strcmp (struct value *arg1, struct value *arg2)
{ {
int len1 = value_type (arg1)->length (); int len1 = arg1->type ()->length ();
int len2 = value_type (arg2)->length (); int len2 = arg2->type ()->length ();
const gdb_byte *s1 = value_contents (arg1).data (); const gdb_byte *s1 = value_contents (arg1).data ();
const gdb_byte *s2 = value_contents (arg2).data (); const gdb_byte *s2 = value_contents (arg2).data ();
int i, len = len1 < len2 ? len1 : len2; int i, len = len1 < len2 ? len1 : len2;
@ -1753,8 +1753,8 @@ value_equal (struct value *arg1, struct value *arg2)
arg1 = coerce_array (arg1); arg1 = coerce_array (arg1);
arg2 = coerce_array (arg2); arg2 = coerce_array (arg2);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
code1 = type1->code (); code1 = type1->code ();
code2 = type2->code (); code2 = type2->code ();
is_int1 = is_integral_type (type1); is_int1 = is_integral_type (type1);
@ -1816,8 +1816,8 @@ value_equal_contents (struct value *arg1, struct value *arg2)
{ {
struct type *type1, *type2; struct type *type1, *type2;
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
return (type1->code () == type2->code () return (type1->code () == type2->code ()
&& type1->length () == type2->length () && type1->length () == type2->length ()
@ -1840,8 +1840,8 @@ value_less (struct value *arg1, struct value *arg2)
arg1 = coerce_array (arg1); arg1 = coerce_array (arg1);
arg2 = coerce_array (arg2); arg2 = coerce_array (arg2);
type1 = check_typedef (value_type (arg1)); type1 = check_typedef (arg1->type ());
type2 = check_typedef (value_type (arg2)); type2 = check_typedef (arg2->type ());
code1 = type1->code (); code1 = type1->code ();
code2 = type2->code (); code2 = type2->code ();
is_int1 = is_integral_type (type1); is_int1 = is_integral_type (type1);
@ -1892,7 +1892,7 @@ value_pos (struct value *arg1)
struct type *type; struct type *type;
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1)); type = check_typedef (arg1->type ());
if (is_integral_type (type) || is_floating_value (arg1) if (is_integral_type (type) || is_floating_value (arg1)
|| (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) || (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
@ -1908,7 +1908,7 @@ value_neg (struct value *arg1)
struct type *type; struct type *type;
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1)); type = check_typedef (arg1->type ());
if (is_integral_type (type) || is_floating_type (type)) if (is_integral_type (type) || is_floating_type (type))
return value_binop (value_from_longest (type, 0), arg1, BINOP_SUB); return value_binop (value_from_longest (type, 0), arg1, BINOP_SUB);
@ -1955,7 +1955,7 @@ value_complement (struct value *arg1)
struct value *val; struct value *val;
arg1 = coerce_ref (arg1); arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1)); type = check_typedef (arg1->type ());
if (is_integral_type (type)) if (is_integral_type (type))
val = value_from_longest (type, ~value_as_long (arg1)); val = value_from_longest (type, ~value_as_long (arg1));
@ -2025,8 +2025,8 @@ int
value_in (struct value *element, struct value *set) value_in (struct value *element, struct value *set)
{ {
int member; int member;
struct type *settype = check_typedef (value_type (set)); struct type *settype = check_typedef (set->type ());
struct type *eltype = check_typedef (value_type (element)); struct type *eltype = check_typedef (element->type ());
if (eltype->code () == TYPE_CODE_RANGE) if (eltype->code () == TYPE_CODE_RANGE)
eltype = eltype->target_type (); eltype = eltype->target_type ();

Some files were not shown because too many files have changed in this diff Show more