public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove TYPE_TARGET_TYPE
@ 2022-09-21 15:05 Simon Marchi
0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-09-21 15:05 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=27710edb4e588d0360620df424dd7ee7e8cfafee
commit 27710edb4e588d0360620df424dd7ee7e8cfafee
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Sat Jul 30 22:43:54 2022 -0400
gdb: remove TYPE_TARGET_TYPE
Remove the macro, replace all uses by calls to type::target_type.
Change-Id: Ie51d3e1e22f94130176d6abd723255282bb6d1ed
Diff:
---
gdb/aarch64-tdep.c | 6 +-
gdb/ada-exp.y | 2 +-
gdb/ada-lang.c | 200 +++++++++++++++++++-------------------
gdb/ada-tasks.c | 4 +-
gdb/ada-typeprint.c | 26 ++---
gdb/ada-valprint.c | 34 +++----
gdb/ada-varobj.c | 20 ++--
gdb/amd64-tdep.c | 2 +-
gdb/amd64-windows-tdep.c | 2 +-
gdb/arm-tdep.c | 6 +-
gdb/avr-tdep.c | 10 +-
gdb/ax-gdb.c | 14 +--
gdb/blockframe.c | 4 +-
gdb/c-exp.y | 10 +-
gdb/c-lang.c | 14 +--
gdb/c-typeprint.c | 48 ++++-----
gdb/c-valprint.c | 16 +--
gdb/c-varobj.c | 4 +-
gdb/coffread.c | 10 +-
gdb/compile/compile-c-symbols.c | 4 +-
gdb/compile/compile-c-types.c | 8 +-
gdb/compile/compile-cplus-types.c | 12 +--
gdb/compile/compile-object-load.c | 10 +-
gdb/cp-namespace.c | 2 +-
gdb/cp-support.c | 8 +-
gdb/cp-valprint.c | 6 +-
gdb/ctfread.c | 10 +-
gdb/d-namespace.c | 2 +-
gdb/d-valprint.c | 2 +-
gdb/dwarf2/loc.c | 12 +--
gdb/dwarf2/read.c | 35 ++++---
gdb/elfread.c | 2 +-
gdb/eval.c | 50 +++++-----
gdb/expop.h | 2 +-
gdb/f-array-walker.h | 8 +-
gdb/f-lang.c | 38 ++++----
gdb/f-lang.h | 2 +-
gdb/f-typeprint.c | 36 +++----
gdb/f-valprint.c | 20 ++--
gdb/frv-tdep.c | 2 +-
gdb/gdbtypes.c | 124 +++++++++++------------
gdb/gdbtypes.h | 5 +-
gdb/gnu-v2-abi.c | 10 +-
gdb/gnu-v3-abi.c | 8 +-
gdb/go-lang.c | 2 +-
gdb/go-typeprint.c | 2 +-
gdb/go-valprint.c | 2 +-
gdb/guile/scm-lazy-string.c | 4 +-
gdb/guile/scm-math.c | 2 +-
gdb/guile/scm-type.c | 6 +-
gdb/guile/scm-value.c | 6 +-
gdb/hppa-tdep.c | 2 +-
gdb/i386-tdep.c | 2 +-
gdb/i386-windows-tdep.c | 2 +-
gdb/ia64-tdep.c | 6 +-
gdb/infcall.c | 12 +--
gdb/infcmd.c | 4 +-
gdb/iq2000-tdep.c | 10 +-
gdb/language.c | 4 +-
gdb/loongarch-tdep.c | 2 +-
gdb/m2-lang.c | 2 +-
gdb/m2-lang.h | 4 +-
gdb/m2-typeprint.c | 36 +++----
gdb/m2-valprint.c | 24 ++---
gdb/m32c-tdep.c | 6 +-
gdb/m68k-tdep.c | 2 +-
gdb/mdebugread.c | 4 +-
gdb/msp430-tdep.c | 2 +-
gdb/opencl-lang.c | 26 ++---
gdb/p-exp.y | 14 +--
gdb/p-lang.c | 6 +-
gdb/p-typeprint.c | 50 +++++-----
gdb/p-valprint.c | 18 ++--
gdb/ppc-sysv-tdep.c | 24 ++---
gdb/python/py-finishbreakpoint.c | 2 +-
gdb/python/py-lazy-string.c | 4 +-
gdb/python/py-type.c | 8 +-
gdb/python/py-value.c | 10 +-
gdb/riscv-tdep.c | 2 +-
gdb/rl78-tdep.c | 6 +-
gdb/rust-lang.c | 38 ++++----
gdb/rust-lang.h | 2 +-
gdb/rx-tdep.c | 4 +-
gdb/s390-tdep.c | 2 +-
gdb/sh-tdep.c | 2 +-
gdb/sparc-tdep.c | 6 +-
gdb/sparc64-tdep.c | 2 +-
gdb/stack.c | 2 +-
gdb/symtab.c | 2 +-
gdb/tic6x-tdep.c | 2 +-
gdb/typeprint.c | 6 +-
gdb/v850-tdep.c | 4 +-
gdb/valarith.c | 38 ++++----
gdb/valops.c | 66 ++++++-------
gdb/valprint.c | 16 +--
gdb/value.c | 6 +-
gdb/xstormy16-tdep.c | 4 +-
97 files changed, 683 insertions(+), 687 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 7229b53838e..744348cfcd4 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1496,7 +1496,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
case TYPE_CODE_COMPLEX:
{
- struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *target_type = check_typedef (type->target_type ());
if (TYPE_LENGTH (target_type) > 16)
return -1;
@@ -1526,7 +1526,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
}
else
{
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
int count = aapcs_is_vfp_call_or_return_candidate_1
(target_type, fundamental_type);
@@ -1801,7 +1801,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
case TYPE_CODE_COMPLEX:
{
const bfd_byte *buf = value_contents (arg).data ();
- struct type *target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+ struct type *target_type = check_typedef (arg_type->target_type ());
if (!pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type),
buf))
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 78aec4e920b..f67c221d873 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -873,7 +873,7 @@ primary : primary TICK_ACCESS
if (!ada_is_modular_type (type_arg))
error (_("'modulus must be applied to modular type"));
write_int (pstate, ada_modulus (type_arg),
- TYPE_TARGET_TYPE (type_arg));
+ type_arg->target_type ());
}
;
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c5657d9d03a..95fb37b49f4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -429,7 +429,7 @@ static struct type *
ada_typedef_target_type (struct type *type)
{
while (type->code () == TYPE_CODE_TYPEDEF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
return type;
}
@@ -739,9 +739,9 @@ get_base_type (struct type *type)
{
while (type != NULL && type->code () == TYPE_CODE_RANGE)
{
- if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL)
+ if (type == type->target_type () || type->target_type () == NULL)
return type;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
return type;
}
@@ -1712,7 +1712,7 @@ desc_base_type (struct type *type)
if (type != NULL
&& (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF))
- return ada_check_typedef (TYPE_TARGET_TYPE (type));
+ return ada_check_typedef (type->target_type ());
else
return type;
}
@@ -1800,7 +1800,7 @@ desc_bounds_type (struct type *type)
{
r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
if (r != NULL)
- return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r)));
+ return ada_check_typedef (ada_check_typedef (r)->target_type ());
}
return NULL;
}
@@ -1844,7 +1844,7 @@ desc_bounds (struct value *arr)
if (p_bounds_type
&& p_bounds_type->code () == TYPE_CODE_PTR)
{
- struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type);
+ struct type *target_type = p_bounds_type->target_type ();
if (target_type->is_stub ())
p_bounds = value_cast (lookup_pointer_type
@@ -1902,7 +1902,7 @@ desc_data_target_type (struct type *type)
if (data_type
&& ada_check_typedef (data_type)->code () == TYPE_CODE_PTR)
- return ada_check_typedef (TYPE_TARGET_TYPE (data_type));
+ return ada_check_typedef (data_type->target_type ());
}
return NULL;
@@ -2042,7 +2042,7 @@ ada_is_array_type (struct type *type)
while (type != NULL
&& (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
return ada_is_direct_array_type (type);
}
@@ -2056,7 +2056,7 @@ ada_is_simple_array_type (struct type *type)
type = ada_check_typedef (type);
return (type->code () == TYPE_CODE_ARRAY
|| (type->code () == TYPE_CODE_PTR
- && (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()
+ && (ada_check_typedef (type->target_type ())->code ()
== TYPE_CODE_ARRAY)));
}
@@ -2277,7 +2277,7 @@ ada_is_unconstrained_packed_array_type (struct type *type)
type = desc_base_type (type);
/* The structure's first field is a pointer to an array, so this
fetches the array type. */
- type = TYPE_TARGET_TYPE (type->field (0).type ());
+ type = type->field (0).type ()->target_type ();
if (type->code () == TYPE_CODE_TYPEDEF)
type = ada_typedef_target_type (type);
/* Now we can see if the array elements are packed. */
@@ -2327,7 +2327,7 @@ decode_packed_array_bitsize (struct type *type)
gdb_assert (is_thick_pntr (type));
/* The structure's first field is a pointer to an array, so this
fetches the array type. */
- type = TYPE_TARGET_TYPE (type->field (0).type ());
+ type = type->field (0).type ()->target_type ();
/* Now we can see if the array elements are packed. */
return TYPE_FIELD_BITSIZE (type, 0);
}
@@ -2381,7 +2381,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
new_type = alloc_type_copy (type);
new_elt_type =
- constrained_packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
+ constrained_packed_array_type (ada_check_typedef (type->target_type ()),
elt_bits);
create_array_type (new_type, new_elt_type, index_type);
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
@@ -2464,7 +2464,7 @@ recursively_update_array_bitsize (struct type *type)
return 0;
LONGEST our_len = high - low + 1;
- struct type *elt_type = TYPE_TARGET_TYPE (type);
+ struct type *elt_type = type->target_type ();
if (elt_type->code () == TYPE_CODE_ARRAY)
{
LONGEST elt_len = recursively_update_array_bitsize (elt_type);
@@ -2588,7 +2588,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
(long) idx);
bits = TYPE_FIELD_BITSIZE (elt_type, 0);
elt_total_bit_offset += (idx - lowerbound) * bits;
- elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type));
+ elt_type = ada_check_typedef (elt_type->target_type ());
}
}
elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
@@ -3007,7 +3007,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
for (k = 0; k < arity; k += 1)
{
- struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type);
+ struct type *saved_elt_type = elt_type->target_type ();
if (elt_type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k);
@@ -3068,11 +3068,11 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
if (type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k);
- arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+ arr = value_cast (lookup_pointer_type (type->target_type ()),
value_copy (arr));
get_discrete_bounds (type->index_type (), &lwb, &upb);
arr = value_ptradd (arr, pos_atr (ind[k]) - lwb);
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
return value_ind (arr);
@@ -3087,11 +3087,11 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
int low, int high)
{
struct type *type0 = ada_check_typedef (type);
- struct type *base_index_type = TYPE_TARGET_TYPE (type0->index_type ());
+ struct type *base_index_type = type0->index_type ()->target_type ();
struct type *index_type
= create_static_range_type (NULL, base_index_type, low, high);
struct type *slice_type = create_array_type_with_stride
- (NULL, TYPE_TARGET_TYPE (type0), index_type,
+ (NULL, type0->target_type (), index_type,
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type0, 0));
int base_low = ada_discrete_type_low_bound (type0->index_type ());
@@ -3110,7 +3110,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
ULONGEST stride = TYPE_FIELD_BITSIZE (slice_type, 0) / 8;
if (stride == 0)
- stride = TYPE_LENGTH (TYPE_TARGET_TYPE (type0));
+ stride = TYPE_LENGTH (type0->target_type ());
base = value_as_address (array_ptr) + (*low_pos - *base_low_pos) * stride;
return value_at_lazy (slice_type, base);
@@ -3121,11 +3121,11 @@ static struct value *
ada_value_slice (struct value *array, int low, int high)
{
struct type *type = ada_check_typedef (value_type (array));
- struct type *base_index_type = TYPE_TARGET_TYPE (type->index_type ());
+ struct type *base_index_type = type->index_type ()->target_type ();
struct type *index_type
= create_static_range_type (NULL, type->index_type (), low, high);
struct type *slice_type = create_array_type_with_stride
- (NULL, TYPE_TARGET_TYPE (type), index_type,
+ (NULL, type->target_type (), index_type,
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type, 0));
gdb::optional<LONGEST> low_pos, high_pos;
@@ -3167,7 +3167,7 @@ ada_array_arity (struct type *type)
while (type->code () == TYPE_CODE_ARRAY)
{
arity += 1;
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
}
return arity;
@@ -3199,7 +3199,7 @@ ada_array_element_type (struct type *type, int nindices)
k = nindices;
while (k > 0 && p_array_type != NULL)
{
- p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type));
+ p_array_type = ada_check_typedef (p_array_type->target_type ());
k -= 1;
}
return p_array_type;
@@ -3208,7 +3208,7 @@ ada_array_element_type (struct type *type, int nindices)
{
while (nindices != 0 && type->code () == TYPE_CODE_ARRAY)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
/* A multi-dimensional array is represented using a sequence
of array types. If one of these types has a name, then
it is not another dimension of the outer array, but
@@ -3242,9 +3242,9 @@ ada_index_type (struct type *type, int n, const char *name)
for (i = 1; i < n; i += 1)
{
type = ada_check_typedef (type);
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
- result_type = TYPE_TARGET_TYPE (ada_check_typedef (type)->index_type ());
+ result_type = ada_check_typedef (type)->index_type ()->target_type ();
/* FIXME: The stabs type r(0,0);bound;bound in an array type
has a target type of TYPE_CODE_UNDEF. We compensate here, but
perhaps stabsread.c would make more sense. */
@@ -3282,7 +3282,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
return (LONGEST) - which;
if (arr_type->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (arr_type);
+ type = arr_type->target_type ();
else
type = arr_type;
@@ -3307,7 +3307,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
struct type *elt_type = check_typedef (type);
for (i = 1; i < n; i++)
- elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
+ elt_type = check_typedef (elt_type->target_type ());
index_type = elt_type->index_type ();
}
@@ -3376,7 +3376,7 @@ ada_array_length (struct value *arr, int n)
{
struct type *base_type;
if (index_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (index_type);
+ base_type = index_type->target_type ();
else
base_type = index_type;
@@ -3396,7 +3396,7 @@ empty_array (struct type *arr_type, int low, int high)
struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_type
= create_static_range_type
- (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low,
+ (NULL, arr_type0->index_type ()->target_type (), low,
high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
@@ -3520,11 +3520,11 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
}
gdb_printf (stream, ")");
}
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, " return ");
- ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags);
+ ada_print_type (type->target_type (), NULL, stream, -1, 0, flags);
}
}
@@ -3905,9 +3905,9 @@ ada_type_match (struct type *ftype, struct type *atype)
atype = ada_check_typedef (atype);
if (ftype->code () == TYPE_CODE_REF)
- ftype = TYPE_TARGET_TYPE (ftype);
+ ftype = ftype->target_type ();
if (atype->code () == TYPE_CODE_REF)
- atype = TYPE_TARGET_TYPE (atype);
+ atype = atype->target_type ();
switch (ftype->code ())
{
@@ -3916,11 +3916,11 @@ ada_type_match (struct type *ftype, struct type *atype)
case TYPE_CODE_PTR:
if (atype->code () != TYPE_CODE_PTR)
return 0;
- atype = TYPE_TARGET_TYPE (atype);
+ atype = atype->target_type ();
/* This can only happen if the actual argument is 'null'. */
if (atype->code () == TYPE_CODE_INT && TYPE_LENGTH (atype) == 0)
return 1;
- return ada_type_match (TYPE_TARGET_TYPE (ftype), atype);
+ return ada_type_match (ftype->target_type (), atype);
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE:
@@ -4002,7 +4002,7 @@ return_match (struct type *func_type, struct type *context_type)
return 1;
if (func_type->code () == TYPE_CODE_FUNC)
- return_type = get_base_type (TYPE_TARGET_TYPE (func_type));
+ return_type = get_base_type (func_type->target_type ());
else
return_type = get_base_type (func_type);
if (return_type == NULL)
@@ -4094,8 +4094,8 @@ numeric_type_p (struct type *type)
case TYPE_CODE_FIXED_POINT:
return 1;
case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || numeric_type_p (TYPE_TARGET_TYPE (type)));
+ return (type == type->target_type ()
+ || numeric_type_p (type->target_type ()));
default:
return 0;
}
@@ -4116,8 +4116,8 @@ integer_type_p (struct type *type)
case TYPE_CODE_INT:
return 1;
case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || integer_type_p (TYPE_TARGET_TYPE (type)));
+ return (type == type->target_type ()
+ || integer_type_p (type->target_type ()));
default:
return 0;
}
@@ -4379,7 +4379,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
t1 = t = ada_check_typedef (value_type (arg));
if (t->code () == TYPE_CODE_REF)
{
- t1 = TYPE_TARGET_TYPE (t);
+ t1 = t->target_type ();
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
@@ -4392,7 +4392,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
while (t->code () == TYPE_CODE_PTR)
{
- t1 = TYPE_TARGET_TYPE (t);
+ t1 = t->target_type ();
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
@@ -4429,7 +4429,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
if (ada_is_tagged_type (t1, 0)
|| (t1->code () == TYPE_CODE_REF
- && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
+ && ada_is_tagged_type (t1->target_type (), 0)))
{
/* We first try to find the searched field in the current type.
If not found then let's look in the fixed type. */
@@ -4497,10 +4497,10 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
struct type *formal_type = ada_check_typedef (formal_type0);
struct type *formal_target =
formal_type->code () == TYPE_CODE_PTR
- ? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
+ ? ada_check_typedef (formal_type->target_type ()) : formal_type;
struct type *actual_target =
actual_type->code () == TYPE_CODE_PTR
- ? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
+ ? ada_check_typedef (actual_type->target_type ()) : actual_type;
if (ada_is_array_descriptor_type (formal_target)
&& actual_target->code () == TYPE_CODE_ARRAY)
@@ -6258,7 +6258,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
if (type->code () != TYPE_CODE_PTR)
return 0;
- name = TYPE_TARGET_TYPE (type)->name ();
+ name = type->target_type ()->name ();
if (name == NULL)
return 0;
@@ -6351,7 +6351,7 @@ ada_is_tag_type (struct type *type)
return 0;
else
{
- const char *name = ada_type_name (TYPE_TARGET_TYPE (type));
+ const char *name = ada_type_name (type->target_type ());
return (name != NULL
&& strcmp (name, "ada__tags__dispatch_table") == 0);
@@ -6665,7 +6665,7 @@ ada_parent_type (struct type *type)
/* If the _parent field is a pointer, then dereference it. */
if (parent_type->code () == TYPE_CODE_PTR)
- parent_type = TYPE_TARGET_TYPE (parent_type);
+ parent_type = parent_type->target_type ();
/* If there is a parallel XVS type, get the actual base type. */
parent_type = ada_get_base_type (parent_type);
@@ -6733,7 +6733,7 @@ ada_is_variant_part (struct type *type, int field_num)
return (field_type->code () == TYPE_CODE_UNION
|| (is_dynamic_field (type, field_num)
- && (TYPE_TARGET_TYPE (field_type)->code ()
+ && (field_type->target_type ()->code ()
== TYPE_CODE_UNION)));
}
@@ -6776,7 +6776,7 @@ ada_variant_discrim_name (struct type *type0)
const char *discrim_start;
if (type0->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (type0);
+ type = type0->target_type ();
else
type = type0;
@@ -7321,7 +7321,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
type = ada_check_typedef (type);
if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
if (type == NULL
@@ -7905,8 +7905,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
{
const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address;
- struct type *field_type =
- TYPE_TARGET_TYPE (type->field (f).type ());
+ struct type *field_type = type->field (f).type ()->target_type ();
if (dval0 == NULL)
{
@@ -8090,7 +8089,7 @@ template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr,
no runtime values. Useless for use in values, but that's OK,
since the results are used only for type determinations. Works on both
structs and unions. Representation note: to save space, we memorize
- the result of this function in the TYPE_TARGET_TYPE of the
+ the result of this function in the type::target_type of the
template type. */
static struct type *
@@ -8105,8 +8104,8 @@ template_to_static_fixed_type (struct type *type0)
return type0;
/* Likewise if we already have computed the static approximation. */
- if (TYPE_TARGET_TYPE (type0) != NULL)
- return TYPE_TARGET_TYPE (type0);
+ if (type0->target_type () != NULL)
+ return type0->target_type ();
/* Don't clone TYPE0 until we are sure we are going to need a copy. */
type = type0;
@@ -8124,7 +8123,7 @@ template_to_static_fixed_type (struct type *type0)
if (is_dynamic_field (type0, f))
{
field_type = ada_check_typedef (field_type);
- new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type));
+ new_type = to_static_fixed_type (field_type->target_type ());
}
else
new_type = static_unwrap_type (field_type);
@@ -8294,7 +8293,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
struct type *var_type;
if (var_type0->code () == TYPE_CODE_PTR)
- var_type = TYPE_TARGET_TYPE (var_type0);
+ var_type = var_type0->target_type ();
else
var_type = var_type0;
@@ -8311,8 +8310,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
return empty_record (var_type);
else if (is_dynamic_field (var_type, which))
return to_fixed_record_type
- (TYPE_TARGET_TYPE (var_type->field (which).type ()),
- valaddr, address, dval);
+ (var_type->field (which).type ()->target_type(), valaddr, address, dval);
else if (variant_field_index (var_type->field (which).type ()) >= 0)
return
to_fixed_record_type
@@ -8387,7 +8385,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
if (!ada_is_redundant_range_encoding (this_layer->index_type (),
desc_type->field (i).type ()))
return 0;
- this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
+ this_layer = check_typedef (this_layer->target_type ());
}
return 1;
@@ -8460,7 +8458,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
if (index_type_desc == NULL)
{
- struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0));
+ struct type *elt_type0 = ada_check_typedef (type0->target_type ());
/* NOTE: elt_type---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed
@@ -8491,7 +8489,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
elt_type0 = type0;
for (i = index_type_desc->num_fields (); i > 0; i -= 1)
- elt_type0 = TYPE_TARGET_TYPE (elt_type0);
+ elt_type0 = elt_type0->target_type ();
/* NOTE: result---the fixed version of elt_type0---should never
depend on the contents of the array in properly constructed
@@ -8515,7 +8513,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
result = create_array_type (alloc_type_copy (elt_type0),
result, range_type);
- elt_type0 = TYPE_TARGET_TYPE (elt_type0);
+ elt_type0 = elt_type0->target_type ();
}
}
@@ -8530,7 +8528,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
type was a regular (non-packed) array type. As a result, the
bitsize of the array elements needs to be set again, and the array
length needs to be recomputed based on that bitsize. */
- int len = TYPE_LENGTH (result) / TYPE_LENGTH (TYPE_TARGET_TYPE (result));
+ int len = TYPE_LENGTH (result) / TYPE_LENGTH (result->target_type ());
int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0);
TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
@@ -8941,7 +8939,7 @@ val_atr (struct type *type, LONGEST val)
{
gdb_assert (discrete_type_p (type));
if (type->code () == TYPE_CODE_RANGE)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_ENUM)
{
if (val < 0 || val >= type->num_fields ())
@@ -9088,7 +9086,7 @@ ada_get_base_type (struct type *raw_type)
}
/* The field in our XVS type is a reference to the base type. */
- return TYPE_TARGET_TYPE (real_type_namer->field (0).type ());
+ return real_type_namer->field (0).type ()->target_type ();
}
/* The type of value designated by TYPE, with all aligners removed. */
@@ -9272,7 +9270,7 @@ ada_same_array_size_p (struct type *t1, struct type *t2)
static struct value *
ada_promote_array_of_integrals (struct type *type, struct value *val)
{
- struct type *elt_type = TYPE_TARGET_TYPE (type);
+ struct type *elt_type = type->target_type ();
LONGEST lo, hi;
LONGEST i;
@@ -9280,11 +9278,11 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
that the size of val's elements is smaller than the size
of type's element. */
gdb_assert (type->code () == TYPE_CODE_ARRAY);
- gdb_assert (is_integral_type (TYPE_TARGET_TYPE (type)));
+ gdb_assert (is_integral_type (type->target_type ()));
gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY);
- gdb_assert (is_integral_type (TYPE_TARGET_TYPE (value_type (val))));
- gdb_assert (TYPE_LENGTH (TYPE_TARGET_TYPE (type))
- > TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))));
+ gdb_assert (is_integral_type (value_type (val)->target_type ()));
+ gdb_assert (TYPE_LENGTH (type->target_type ())
+ > TYPE_LENGTH (value_type (val)->target_type ()));
if (!get_array_bounds (type, &lo, &hi))
error (_("unable to determine array bounds"));
@@ -9331,18 +9329,18 @@ coerce_for_assign (struct type *type, struct value *val)
if (!ada_same_array_size_p (type, type2))
error (_("cannot assign arrays of different length"));
- if (is_integral_type (TYPE_TARGET_TYPE (type))
- && is_integral_type (TYPE_TARGET_TYPE (type2))
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
- < TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
+ if (is_integral_type (type->target_type ())
+ && is_integral_type (type2->target_type ())
+ && TYPE_LENGTH (type2->target_type ())
+ < TYPE_LENGTH (type->target_type ()))
{
/* Allow implicit promotion of the array elements to
a wider type. */
return ada_promote_array_of_integrals (type, val);
}
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
- != TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
+ if (TYPE_LENGTH (type2->target_type ())
+ != TYPE_LENGTH (type->target_type ()))
error (_("Incompatible types in assignment"));
deprecated_set_value_type (val, type);
}
@@ -10193,7 +10191,7 @@ ada_atr_size (struct type *expect_type,
the user is really asking for the size of the actual object,
not the size of the pointer. */
if (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
@@ -10278,9 +10276,9 @@ ada_ternop_slice (struct expression *exp,
/* If this is a reference to an aligner type, then remove all
the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF
- && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
+ && ada_is_aligner_type (value_type (array)->target_type ()))
value_type (array)->set_target_type
- (ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))));
+ (ada_aligned_type (value_type (array)->target_type ()));
if (ada_is_any_packed_array_type (value_type (array)))
error (_("cannot slice a packed array"));
@@ -10303,7 +10301,7 @@ ada_ternop_slice (struct expression *exp,
/* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */
while (value_type (array)->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (value_type (array))->code ()
+ && (value_type (array)->target_type ()->code ()
== TYPE_CODE_PTR))
array = value_ind (array);
@@ -10320,11 +10318,11 @@ ada_ternop_slice (struct expression *exp,
struct type *type0 = ada_check_typedef (value_type (array));
if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
- return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound);
+ return empty_array (type0->target_type (), low_bound, high_bound);
else
{
struct type *arr_type0 =
- to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1);
+ to_fixed_array_type (type0->target_type (), NULL, 1);
return ada_value_slice_from_ptr (array, arr_type0,
longest_to_int (low_bound),
@@ -10741,7 +10739,7 @@ ada_concat_operation::evaluate (struct type *expect_type,
struct type *rhs_type = check_typedef (value_type (rhs));
struct type *elt_type = nullptr;
if (rhs_type->code () == TYPE_CODE_ARRAY)
- elt_type = TYPE_TARGET_TYPE (rhs_type);
+ elt_type = rhs_type->target_type ();
lhs = lhs_expr->evaluate (elt_type, exp, noside);
}
else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr)
@@ -10755,7 +10753,7 @@ ada_concat_operation::evaluate (struct type *expect_type,
struct type *lhs_type = check_typedef (value_type (lhs));
struct type *elt_type = nullptr;
if (lhs_type->code () == TYPE_CODE_ARRAY)
- elt_type = TYPE_TARGET_TYPE (lhs_type);
+ elt_type = lhs_type->target_type ();
rhs = rhs_expr->evaluate (elt_type, exp, noside);
}
else
@@ -10812,7 +10810,7 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
a reference type, find its underlying type. */
struct type *type = value_type (arg1);
while (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
arg1 = value_binop (arg1, arg2, std::get<0> (m_storage));
/* We need to special-case the result with a range.
@@ -10915,7 +10913,7 @@ ada_var_value_operation::evaluate (struct type *expect_type,
a reference should mostly be transparent to the user. */
if (ada_is_tagged_type (type, 0)
|| (type->code () == TYPE_CODE_REF
- && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)))
+ && ada_is_tagged_type (type->target_type (), 0)))
{
/* Tagged types are a little special in the fact that the real
type is dynamic and can only be determined by inspecting the
@@ -11045,7 +11043,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
if ((type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_PTR)
- && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))
+ && ada_is_tagged_type (type->target_type (), 0))
{
arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_NORMAL);
@@ -11055,7 +11053,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
{
type = to_static_fixed_type
(ada_aligned_type
- (ada_check_typedef (TYPE_TARGET_TYPE (type))));
+ (ada_check_typedef (type->target_type ())));
}
return value_zero (type, lval_memory);
}
@@ -11192,17 +11190,17 @@ ada_funcall_operation::evaluate (struct type *expect_type,
if (type->code () == TYPE_CODE_PTR)
{
- switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ())
+ switch (ada_check_typedef (type->target_type ())->code ())
{
case TYPE_CODE_FUNC:
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
break;
case TYPE_CODE_ARRAY:
break;
case TYPE_CODE_STRUCT:
if (noside != EVAL_AVOID_SIDE_EFFECTS)
callee = ada_value_ind (callee);
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ type = ada_check_typedef (type->target_type ());
break;
default:
error (_("cannot subscript or call something of type `%s'"),
@@ -11216,9 +11214,9 @@ ada_funcall_operation::evaluate (struct type *expect_type,
case TYPE_CODE_FUNC:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
error_call_unknown_return_type (NULL);
- return allocate_value (TYPE_TARGET_TYPE (type));
+ return allocate_value (type->target_type ());
}
return call_function_by_hand (callee, NULL, argvec);
case TYPE_CODE_INTERNAL_FUNCTION:
@@ -11265,7 +11263,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
case TYPE_CODE_PTR: /* Pointer to array */
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
+ type = to_fixed_array_type (type->target_type (), NULL, 1);
type = ada_array_element_type (type, nargs);
if (type == NULL)
error (_("element type of array unknown"));
@@ -11459,7 +11457,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
gdb_assert (raw_type->name () != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (raw_type);
+ base_type = raw_type->target_type ();
else
base_type = raw_type;
@@ -13769,7 +13767,7 @@ public:
gdb::unique_xmalloc_ptr<char> watch_location_expression
(struct type *type, CORE_ADDR addr) const override
{
- type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type)));
+ type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type);
return xstrprintf ("{%s} %s", name.c_str (), core_addr_to_string (addr));
}
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index fda49557a4f..1e617a40158 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -436,7 +436,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
bounds_type = type->field (bounds_fieldno).type ();
if (bounds_type->code () == TYPE_CODE_PTR)
- bounds_type = TYPE_TARGET_TYPE (bounds_type);
+ bounds_type = bounds_type->target_type ();
if (bounds_type->code () != TYPE_CODE_STRUCT)
error (_("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
@@ -909,7 +909,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
struct type *idxtype = NULL;
if (type->code () == TYPE_CODE_ARRAY)
- eltype = check_typedef (TYPE_TARGET_TYPE (type));
+ eltype = check_typedef (type->target_type ());
if (eltype != NULL
&& eltype->code () == TYPE_CODE_PTR)
idxtype = check_typedef (type->index_type ());
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index b402bfef523..d412c3b3181 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -104,7 +104,7 @@ type_is_full_subrange_of_target_type (struct type *type)
if (type->code () != TYPE_CODE_RANGE)
return 0;
- subtype = TYPE_TARGET_TYPE (type);
+ subtype = type->target_type ();
if (subtype == NULL)
return 0;
@@ -143,7 +143,7 @@ print_range (struct type *type, struct ui_file *stream,
array ('["00"]' .. '["ff"]') of ... */
while (type_is_full_subrange_of_target_type (type))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
switch (type->code ())
@@ -271,7 +271,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
gdb_assert (name != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
- base_type = TYPE_TARGET_TYPE (raw_type);
+ base_type = raw_type->target_type ();
else
base_type = raw_type;
@@ -390,7 +390,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
name, then it is not another dimension of the outer
array, but rather the element type of the outermost
array. */
- arr_type = TYPE_TARGET_TYPE (arr_type);
+ arr_type = arr_type->target_type ();
if (arr_type->name () != nullptr)
break;
}
@@ -402,7 +402,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
n_indices = range_desc_type->num_fields ();
for (k = 0, arr_type = type;
k < n_indices;
- k += 1, arr_type = TYPE_TARGET_TYPE (arr_type))
+ k += 1, arr_type = arr_type->target_type ())
{
if (k > 0)
gdb_printf (stream, ", ");
@@ -564,7 +564,7 @@ print_variant_clauses (struct type *type, int field_num,
if (var_type->code () == TYPE_CODE_PTR)
{
- var_type = TYPE_TARGET_TYPE (var_type);
+ var_type = var_type->target_type ();
if (var_type == NULL || var_type->code () != TYPE_CODE_UNION)
return;
}
@@ -884,8 +884,8 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
{
int i, len = type->num_fields ();
- if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)
+ if (type->target_type () != NULL
+ && type->target_type ()->code () == TYPE_CODE_VOID)
gdb_printf (stream, "procedure");
else
gdb_printf (stream, "function");
@@ -913,12 +913,12 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
gdb_printf (stream, ")");
}
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
gdb_printf (stream, " return <unknown return type>");
- else if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
+ else if (type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, " return ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
+ ada_print_type (type->target_type (), "", stream, 0, 0, flags);
}
}
@@ -998,12 +998,12 @@ ada_print_type (struct type *type0, const char *varstring,
if (type->code () != TYPE_CODE_PTR
|| strstr (varstring, "___XVL") == nullptr)
gdb_printf (stream, "access ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ ada_print_type (type->target_type (), "", stream, show, level,
flags);
break;
case TYPE_CODE_REF:
gdb_printf (stream, "<ref> ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ ada_print_type (type->target_type (), "", stream, show, level,
flags);
break;
case TYPE_CODE_ARRAY:
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index ed0ce56bca5..938300b8eb7 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -80,7 +80,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type,
of an enumerated type, where the underlying value of the
first element is typically 0, we might test the low bound
against the wrong value. */
- index_type = TYPE_TARGET_TYPE (index_type);
+ index_type = index_type->target_type ();
}
/* Don't print the lower bound if it's the default one. */
@@ -130,7 +130,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
struct value *mark = value_mark ();
LONGEST low = 0;
- elttype = TYPE_TARGET_TYPE (type);
+ elttype = type->target_type ();
index_type = type->index_type ();
{
@@ -151,7 +151,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
}
if (index_type->code () == TYPE_CODE_RANGE)
- index_type = TYPE_TARGET_TYPE (index_type);
+ index_type = index_type->target_type ();
i = 0;
annotate_array_section_begin (i, elttype);
@@ -421,7 +421,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break;
case TYPE_CODE_RANGE:
- ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream);
+ ada_print_scalar (type->target_type (), val, stream);
return;
case TYPE_CODE_UNDEF:
@@ -688,7 +688,7 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
const struct value_print_options *options)
{
enum bfd_endian byte_order = type_byte_order (type);
- struct type *elttype = TYPE_TARGET_TYPE (type);
+ struct type *elttype = type->target_type ();
unsigned int eltlen;
unsigned int len;
@@ -731,8 +731,8 @@ ada_value_print_ptr (struct value *val,
const struct value_print_options *options)
{
if (!options->format
- && TYPE_TARGET_TYPE (value_type (val))->code () == TYPE_CODE_INT
- && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))) == 0)
+ && value_type (val)->target_type ()->code () == TYPE_CODE_INT
+ && TYPE_LENGTH (value_type (val)->target_type ()) == 0)
{
gdb_puts ("null", stream);
return;
@@ -761,15 +761,15 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (type->code () == TYPE_CODE_RANGE
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR))
+ && (type->target_type ()->code () == TYPE_CODE_ENUM
+ || type->target_type ()->code () == TYPE_CODE_BOOL
+ || type->target_type ()->code () == TYPE_CODE_CHAR))
{
/* For enum-valued ranges, we want to recurse, because we'll end
up printing the constant's name rather than its numeric
value. Character and fixed-point types are also printed
differently, so recuse for those as well. */
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
val = value_cast (target_type, val);
common_val_print (val, stream, recurse + 1, options,
language_def (language_ada));
@@ -946,7 +946,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
of the object value would be confusing to an Ada programmer.
So, for Ada values, we print the actual dereferenced value
regardless. */
- struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val;
CORE_ADDR deref_val_int;
@@ -1093,14 +1093,14 @@ ada_value_print (struct value *val0, struct ui_file *stream,
/* If it is a pointer, indicate what it points to; but not for
"void *" pointers. */
if (type->code () == TYPE_CODE_PTR
- && !(TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_INT
- && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == 0))
+ && !(type->target_type ()->code () == TYPE_CODE_INT
+ && TYPE_LENGTH (type->target_type ()) == 0))
{
/* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
- || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT
- || TYPE_TARGET_TYPE (type)->is_unsigned ())
+ if (TYPE_LENGTH (type->target_type ()) != sizeof (char)
+ || type->target_type ()->code () != TYPE_CODE_INT
+ || type->target_type ()->is_unsigned ())
{
gdb_printf (stream, "(");
type_print (type, "", stream, -1);
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 3c664687572..e96f6f098e8 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -137,7 +137,7 @@ ada_varobj_ind (struct value *parent_value,
/* Decode parent_type by the equivalent pointer to (decoded)
array. */
while (parent_type->code () == TYPE_CODE_TYPEDEF)
- parent_type = TYPE_TARGET_TYPE (parent_type);
+ parent_type = parent_type->target_type ();
parent_type = ada_coerce_to_simple_array_type (parent_type);
parent_type = lookup_pointer_type (parent_type);
}
@@ -153,7 +153,7 @@ ada_varobj_ind (struct value *parent_value,
type = value_type (value);
}
else
- type = TYPE_TARGET_TYPE (parent_type);
+ type = parent_type->target_type ();
if (child_value)
*child_value = value;
@@ -184,7 +184,7 @@ ada_varobj_simple_array_elt (struct value *parent_value,
type = value_type (value);
}
else
- type = TYPE_TARGET_TYPE (parent_type);
+ type = parent_type->target_type ();
if (child_value)
*child_value = value;
@@ -207,12 +207,12 @@ ada_varobj_adjust_for_child_access (struct value **value,
the struct/union type. We handle this situation by dereferencing
the (value, type) couple. */
if ((*type)->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT
- || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION)
+ && ((*type)->target_type ()->code () == TYPE_CODE_STRUCT
+ || (*type)->target_type ()->code () == TYPE_CODE_UNION)
&& *value != nullptr
&& value_as_address (*value) != 0
- && !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type))
- && !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type)))
+ && !ada_is_array_descriptor_type ((*type)->target_type ())
+ && !ada_is_constrained_packed_array_type ((*type)->target_type ()))
ada_varobj_ind (*value, *type, value, type);
/* If this is a tagged type, we need to transform it a bit in order
@@ -327,7 +327,7 @@ static int
ada_varobj_get_ptr_number_of_children (struct value *parent_value,
struct type *parent_type)
{
- struct type *child_type = TYPE_TARGET_TYPE (parent_type);
+ struct type *child_type = parent_type->target_type ();
/* Pointer to functions and to void do not have a child, since
you cannot print what they point to. */
@@ -634,7 +634,7 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
/* If the index type is a range type, find the base type. */
while (index_type->code () == TYPE_CODE_RANGE)
- index_type = TYPE_TARGET_TYPE (index_type);
+ index_type = index_type->target_type ();
if (index_type->code () == TYPE_CODE_ENUM
|| index_type->code () == TYPE_CODE_BOOL)
@@ -946,7 +946,7 @@ ada_value_is_changeable_p (const struct varobj *var)
? value_type (var->value.get ()) : var->type);
if (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (ada_is_access_to_unconstrained_array (type))
{
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index d89e06d27cb..4d416a44bf3 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -684,7 +684,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
if (type->code () == TYPE_CODE_ARRAY)
{
- struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *subtype = check_typedef (type->target_type ());
/* All fields in an array have the same type. */
amd64_classify (subtype, theclass);
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index a9aef0bab88..1f779fb9aa1 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -373,7 +373,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
/* __m128, __m128i and __m128d are returned via XMM0. */
if (type->is_vector () && len == 16)
{
- enum type_code code = TYPE_TARGET_TYPE (type)->code ();
+ enum type_code code = type->target_type ()->code ();
if (code == TYPE_CODE_INT || code == TYPE_CODE_FLT)
{
regnum = AMD64_XMM0_REGNUM;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index ead9bbf46c5..7333fa6a4c9 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -4296,7 +4296,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int count;
unsigned unitlen;
- count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
+ count = arm_vfp_cprc_sub_candidate (t->target_type (),
base_type);
if (count == -1)
return -1;
@@ -4442,7 +4442,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
applies. */
ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR)
- ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
+ ftype = check_typedef (ftype->target_type ());
use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
/* Set the return address. For the ARM, the return breakpoint is
@@ -4485,7 +4485,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
- target_type = TYPE_TARGET_TYPE (arg_type);
+ target_type = arg_type->target_type ();
typecode = arg_type->code ();
val = value_contents (args[argnum]).data ();
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 693d563b911..f020d21e3b8 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -319,8 +319,8 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
avr_convert_iaddr_to_raw (addr));
}
/* Is it a code address? */
- else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD)
+ else if (type->target_type ()->code () == TYPE_CODE_FUNC
+ || type->target_type ()->code () == TYPE_CODE_METHOD)
{
/* A code pointer is word (16 bits) addressed. We shift the address down
by 1 bit to convert it to a pointer. */
@@ -350,9 +350,9 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
return avr_make_iaddr (addr);
}
/* Is it a code address? */
- else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
- || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
- || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
+ else if (type->target_type ()->code () == TYPE_CODE_FUNC
+ || type->target_type ()->code () == TYPE_CODE_METHOD
+ || TYPE_CODE_SPACE (type->target_type ()))
{
/* A code pointer is word (16 bits) addressed so we shift it up
by 1 bit to convert it to an address. */
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 0d2566f1518..44a2f966995 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -255,7 +255,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
int string_trace = 0;
if (ax->trace_string
&& value->type->code () == TYPE_CODE_PTR
- && c_textual_element_type (check_typedef (TYPE_TARGET_TYPE (value->type)),
+ && c_textual_element_type (check_typedef (value->type->target_type ()),
's'))
string_trace = 1;
@@ -367,7 +367,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
}
if (type->code () == TYPE_CODE_RANGE)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
switch (type->code ())
{
@@ -735,7 +735,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
are no longer an lvalue. */
case TYPE_CODE_ARRAY:
{
- struct type *elements = TYPE_TARGET_TYPE (value->type);
+ struct type *elements = value->type->target_type ();
value->type = lookup_pointer_type (elements);
value->kind = axs_rvalue;
@@ -946,7 +946,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
static void
gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
{
- struct type *element = TYPE_TARGET_TYPE (type);
+ struct type *element = type->target_type ();
if (TYPE_LENGTH (element) != 1)
{
@@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
gdb_assert (value1->type->is_pointer_or_reference ());
gdb_assert (value2->type->is_pointer_or_reference ());
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type))
- != TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type)))
+ if (TYPE_LENGTH (value1->type->target_type ())
+ != TYPE_LENGTH (value2->type->target_type ()))
error (_("\
First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type."));
@@ -1104,7 +1104,7 @@ gen_deref (struct axs_value *value)
actually emit any code; we just change the type from "Pointer to
T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */
- value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
+ value->type = check_typedef (value->type->target_type ());
if (value->type->code () == TYPE_CODE_VOID)
error (_("Attempt to dereference a generic pointer."));
value->kind = ((value->type->code () == TYPE_CODE_FUNC)
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 47772f3b1a6..1c9e5db7eac 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -440,14 +440,14 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
{
/* Get the return type of the resolver. */
struct type *resolver_ret_type
- = check_typedef (TYPE_TARGET_TYPE (resolver_type));
+ = check_typedef (resolver_type->target_type ());
/* If we found a pointer to function, then the resolved type
is the type of the pointed-to function. */
if (resolver_ret_type->code () == TYPE_CODE_PTR)
{
struct type *resolved_type
- = TYPE_TARGET_TYPE (resolver_ret_type);
+ = resolver_ret_type->target_type ();
if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
return resolved_type;
}
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 61a61fcba09..abd5b6717a5 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -865,10 +865,10 @@ exp : COMPLEX_INT
{
operation_up real
= (make_operation<long_const_operation>
- (TYPE_TARGET_TYPE ($1.type), 0));
+ ($1.type->target_type (), 0));
operation_up imag
= (make_operation<long_const_operation>
- (TYPE_TARGET_TYPE ($1.type), $1.val));
+ ($1.type->target_type (), $1.val));
pstate->push_new<complex_operation>
(std::move (real), std::move (imag), $1.type);
}
@@ -905,8 +905,7 @@ exp : FLOAT
exp : COMPLEX_FLOAT
{
- struct type *underlying
- = TYPE_TARGET_TYPE ($1.type);
+ struct type *underlying = $1.type->target_type ();
float_data val;
target_float_from_host_double (val.data (),
@@ -955,7 +954,8 @@ exp : SIZEOF '(' type ')' %prec UNARY
or a reference type, the result is the size of
the referenced type." */
if (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
+
pstate->push_new<long_const_operation>
(int_type, TYPE_LENGTH (type));
}
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 87373085f24..59ecdd38cea 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -118,8 +118,8 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
/* Call for side effects. */
check_typedef (elttype);
- if (TYPE_TARGET_TYPE (elttype))
- elttype = TYPE_TARGET_TYPE (elttype);
+ if (elttype->target_type ())
+ elttype = elttype->target_type ();
else
{
/* Perhaps check_typedef did not update the target type. In
@@ -247,7 +247,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int err, width;
unsigned int fetchlimit;
struct type *type = check_typedef (value_type (value));
- struct type *element_type = TYPE_TARGET_TYPE (type);
+ struct type *element_type = type->target_type ();
int req_length = *length;
enum bfd_endian byte_order
= type_byte_order (type);
@@ -625,7 +625,7 @@ c_string_operation::evaluate (struct type *expect_type,
if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{
struct type *element_type
- = check_typedef (TYPE_TARGET_TYPE (expect_type));
+ = check_typedef (expect_type->target_type ());
if (element_type->code () == TYPE_CODE_INT
|| element_type->code () == TYPE_CODE_CHAR)
@@ -697,7 +697,7 @@ c_is_string_type_p (struct type *type)
type = check_typedef (type);
while (type->code () == TYPE_CODE_REF)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
type = check_typedef (type);
}
@@ -706,7 +706,7 @@ c_is_string_type_p (struct type *type)
case TYPE_CODE_ARRAY:
{
/* See if target type looks like a string. */
- struct type *array_target_type = TYPE_TARGET_TYPE (type);
+ struct type *array_target_type = type->target_type ();
return (TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (array_target_type) > 0
&& c_textual_element_type (array_target_type, 0));
@@ -715,7 +715,7 @@ c_is_string_type_p (struct type *type)
return true;
case TYPE_CODE_PTR:
{
- struct type *element_type = TYPE_TARGET_TYPE (type);
+ struct type *element_type = type->target_type ();
return c_textual_element_type (element_type, 0);
}
default:
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 4f45475dc4a..d7e33bab1e3 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -313,7 +313,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
gdb_assert (nargs > 0);
gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
- domain = TYPE_TARGET_TYPE (args[0].type ());
+ domain = args[0].type ()->target_type ();
if (TYPE_CONST (domain))
gdb_printf (stream, " const");
@@ -366,7 +366,7 @@ c_type_print_varspec_prefix (struct type *type,
switch (type->code ())
{
case TYPE_CODE_PTR:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 1, 1, language, flags,
podata);
gdb_printf (stream, "*");
@@ -374,7 +374,7 @@ c_type_print_varspec_prefix (struct type *type,
break;
case TYPE_CODE_MEMBERPTR:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags, podata);
name = TYPE_SELF_TYPE (type)->name ();
if (name)
@@ -387,7 +387,7 @@ c_type_print_varspec_prefix (struct type *type,
break;
case TYPE_CODE_METHODPTR:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags,
podata);
gdb_printf (stream, "(");
@@ -403,7 +403,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 1, 0, language, flags,
podata);
gdb_printf (stream, type->code () == TYPE_CODE_REF ? "&" : "&&");
@@ -412,7 +412,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, 0, language, flags,
podata);
if (passed_a_ptr)
@@ -420,7 +420,7 @@ c_type_print_varspec_prefix (struct type *type,
break;
case TYPE_CODE_ARRAY:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, 0, need_post_space,
language, flags, podata);
if (passed_a_ptr)
@@ -428,7 +428,7 @@ c_type_print_varspec_prefix (struct type *type,
break;
case TYPE_CODE_TYPEDEF:
- c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
+ c_type_print_varspec_prefix (type->target_type (),
stream, show, passed_a_ptr, 0,
language, flags, podata);
break;
@@ -775,26 +775,26 @@ c_type_print_varspec_suffix (struct type *type,
plongest (high_bound - low_bound + 1));
gdb_printf (stream, (is_vector ? ")))" : "]"));
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags);
}
break;
case TYPE_CODE_MEMBERPTR:
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags);
break;
case TYPE_CODE_METHODPTR:
gdb_printf (stream, ")");
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, 0, 0, language, flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, 1, 0, language, flags);
break;
@@ -804,12 +804,12 @@ c_type_print_varspec_suffix (struct type *type,
gdb_printf (stream, ")");
if (!demangled_args)
c_type_print_args (type, stream, 0, language, flags);
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, passed_a_ptr, 0, language, flags);
break;
case TYPE_CODE_TYPEDEF:
- c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
+ c_type_print_varspec_suffix (type->target_type (), stream,
show, passed_a_ptr, 0, language, flags);
break;
@@ -1266,7 +1266,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
gdb_printf (stream, "virtual ");
else if (TYPE_FN_FIELD_STATIC_P (f, j))
gdb_printf (stream, "static ");
- if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
+ if (TYPE_FN_FIELD_TYPE (f, j)->target_type () == 0)
{
/* Keep GDB from crashing here. */
gdb_printf (stream,
@@ -1282,7 +1282,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
&& !is_type_conversion_operator (type, i, j))
{
c_print_type_no_offsets
- (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
+ (TYPE_FN_FIELD_TYPE (f, j)->target_type (),
"", stream, -1, 0, language, &local_flags, podata);
gdb_puts (" ", stream);
@@ -1382,7 +1382,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
/* Dereference the typedef declaration itself. */
gdb_assert (target->code () == TYPE_CODE_TYPEDEF);
- target = TYPE_TARGET_TYPE (target);
+ target = target->target_type ();
if (need_access_label)
{
@@ -1495,19 +1495,19 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
{
case TYPE_CODE_TYPEDEF:
/* If we get here, the typedef doesn't have a name, and we
- couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */
+ couldn't resolve type::target_type. Not much we can do. */
gdb_assert (type->name () == NULL);
- gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
+ gdb_assert (type->target_type () == NULL);
fprintf_styled (stream, metadata_style.style (),
_("<unnamed typedef>"));
break;
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- if (TYPE_TARGET_TYPE (type) == NULL)
+ if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- c_type_print_base_1 (TYPE_TARGET_TYPE (type),
+ c_type_print_base_1 (type->target_type (),
stream, show, level, language, flags, podata);
break;
case TYPE_CODE_ARRAY:
@@ -1516,7 +1516,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_METHODPTR:
- c_type_print_base_1 (TYPE_TARGET_TYPE (type),
+ c_type_print_base_1 (type->target_type (),
stream, show, level, language, flags, podata);
break;
@@ -1564,9 +1564,9 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
print too much than too little; but conversely not to
print something egregiously outside the current
language's syntax. */
- if (language == language_cplus && TYPE_TARGET_TYPE (type) != NULL)
+ if (language == language_cplus && type->target_type () != NULL)
{
- struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *underlying = check_typedef (type->target_type ());
if (underlying->name () != NULL)
gdb_printf (stream, ": %s ", underlying->name ());
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index bd445588ca0..a93280c6685 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -87,8 +87,8 @@ c_textual_element_type (struct type *type, char format)
/* Peel a single typedef. If the typedef doesn't have a target
type, we use check_typedef and hope the result is ok -- it
might be for C++, where wchar_t is a built-in type. */
- if (TYPE_TARGET_TYPE (iter_type))
- iter_type = TYPE_TARGET_TYPE (iter_type);
+ if (iter_type->target_type ())
+ iter_type = iter_type->target_type ();
else
iter_type = check_typedef (iter_type);
}
@@ -238,7 +238,7 @@ c_value_print_array (struct value *val,
struct type *type = check_typedef (value_type (val));
CORE_ADDR address = value_address (val);
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
- struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
+ struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
@@ -347,7 +347,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
}
else
{
- struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
+ struct type *unresolved_elttype = type->target_type ();
struct type *elttype = check_typedef (unresolved_elttype);
CORE_ADDR addr = unpack_pointer (type, valaddr);
@@ -497,15 +497,15 @@ c_value_print (struct value *val, struct ui_file *stream,
are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL
- && TYPE_TARGET_TYPE (original_type)->name () != NULL
- && (strcmp (TYPE_TARGET_TYPE (original_type)->name (),
+ && original_type->target_type ()->name () != NULL
+ && (strcmp (original_type->target_type ()->name (),
"char") == 0
- || textual_name (TYPE_TARGET_TYPE (original_type)->name ())))
+ || textual_name (original_type->target_type ()->name ())))
{
/* Print nothing. */
}
else if (options->objectprint
- && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
+ && (type->target_type ()->code () == TYPE_CODE_STRUCT))
{
int is_ref = TYPE_IS_REFERENCE (type);
enum type_code refcode = TYPE_CODE_UNDEF;
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 8fecbd57e08..957e7f3d72f 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -403,7 +403,7 @@ c_describe_child (const struct varobj *parent, int index,
check_typedef and here, we want to show the true
declared type of the variable. */
if (ctype)
- *ctype = TYPE_TARGET_TYPE (type);
+ *ctype = type->target_type ();
if (cfull_expression)
*cfull_expression = string_printf ("*(%s)", parent_expression.c_str ());
@@ -482,7 +482,7 @@ c_value_of_variable (const struct varobj *var,
/* Strip top-level references. */
while (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
switch (type->code ())
{
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 45d41d08449..27afa11738d 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1468,8 +1468,8 @@ enter_linenos (file_ptr file_offset, int first_line,
static void
patch_type (struct type *type, struct type *real_type)
{
- struct type *target = TYPE_TARGET_TYPE (type);
- struct type *real_target = TYPE_TARGET_TYPE (real_type);
+ struct type *target = type->target_type ();
+ struct type *real_target = real_type->target_type ();
int field_size = real_target->num_fields () * sizeof (struct field);
TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
@@ -1509,7 +1509,7 @@ patch_opaque_types (struct symtab *s)
if (real_sym->aclass () == LOC_TYPEDEF
&& real_sym->domain () == VAR_DOMAIN
&& real_sym->type ()->code () == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (real_sym->type ())) != 0)
+ && TYPE_LENGTH (real_sym->type ()->target_type ()) != 0)
{
const char *name = real_sym->linkage_name ();
int hash = hashname (name);
@@ -1699,8 +1699,8 @@ process_coff_symbol (struct coff_symbol *cs,
references work themselves out via the magic of
coff_lookup_type. */
if (sym->type ()->code () == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) == 0
- && TYPE_TARGET_TYPE (sym->type ())->code ()
+ && TYPE_LENGTH (sym->type ()->target_type ()) == 0
+ && sym->type ()->target_type ()->code ()
!= TYPE_CODE_UNDEF)
{
int i = hashname (sym->linkage_name ());
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index e1f94ec2907..dd892b31116 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -495,7 +495,7 @@ generate_vla_size (compile_instance *compiler,
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ type = check_typedef (type->target_type ());
switch (type->code ())
{
@@ -518,7 +518,7 @@ generate_vla_size (compile_instance *compiler,
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
type->index_type (), sym);
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
- TYPE_TARGET_TYPE (type), sym);
+ type->target_type (), sym);
break;
case TYPE_CODE_UNION:
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 14dbd9794b5..d92bd204485 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -29,7 +29,7 @@
static gcc_type
convert_pointer (compile_c_instance *context, struct type *type)
{
- gcc_type target = context->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type target = context->convert_type (type->target_type ());
return context->plugin ().build_pointer_type (target);
}
@@ -42,7 +42,7 @@ convert_array (compile_c_instance *context, struct type *type)
gcc_type element_type;
struct type *range = type->index_type ();
- element_type = context->convert_type (TYPE_TARGET_TYPE (type));
+ element_type = context->convert_type (type->target_type ());
if (range->bounds ()->low.kind () != PROP_CONST)
return context->plugin ().error (_("array type with non-constant"
@@ -155,7 +155,7 @@ convert_func (compile_c_instance *context, struct type *type)
struct gcc_type_array array;
int is_varargs = type->has_varargs () || !type->is_prototyped ();
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
/* Functions with no debug info have no return type. Ideally we'd
want to fallback to the type of the cast just before the
@@ -263,7 +263,7 @@ convert_qualified (compile_c_instance *context, struct type *type)
static gcc_type
convert_complex (compile_c_instance *context, struct type *type)
{
- gcc_type base = context->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type base = context->convert_type (type->target_type ());
return context->plugin ().build_complex_type (base);
}
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index e7c940b1355..6f666e24fc3 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -410,7 +410,7 @@ static gcc_type
compile_cplus_convert_reference (compile_cplus_instance *instance,
struct type *type)
{
- gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type target = instance->convert_type (type->target_type ());
enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE;
switch (type->code ())
@@ -442,7 +442,7 @@ static gcc_type
compile_cplus_convert_pointer (compile_cplus_instance *instance,
struct type *type)
{
- gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type target = instance->convert_type (type->target_type ());
return instance->convert_pointer_base (target);
}
@@ -454,7 +454,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
struct type *type)
{
struct type *range = type->index_type ();
- gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type element_type = instance->convert_type (type->target_type ());
if (range->bounds ()->low.kind () != PROP_CONST)
{
@@ -697,7 +697,7 @@ compile_cplus_convert_memberptr (compile_cplus_instance *instance,
gcc_type class_type = instance->convert_type (containing_class);
gcc_type member_type
- = instance->convert_type (TYPE_TARGET_TYPE (type));
+ = instance->convert_type (type->target_type ());
return instance->plugin ().build_pointer_to_member_type
(class_type, member_type);
@@ -961,7 +961,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
struct type *type, bool strip_artificial)
{
int is_varargs = type->has_varargs ();
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
/* Functions with no debug info have no return type. Ideally we'd
want to fallback to the type of the cast just before the
@@ -1086,7 +1086,7 @@ static gcc_type
compile_cplus_convert_complex (compile_cplus_instance *instance,
struct type *type)
{
- gcc_type base = instance->convert_type (TYPE_TARGET_TYPE (type));
+ gcc_type base = instance->convert_type (type->target_type ());
return instance->plugin ().build_complex_type (base);
}
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 06e8c850d5e..aede3bc43b3 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -469,7 +469,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_ptr_type = check_typedef (gdb_ptr_type);
if (gdb_ptr_type->code () != TYPE_CODE_PTR)
error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
- gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type));
+ gdb_type_from_ptr = check_typedef (gdb_ptr_type->target_type ());
if (types_deeply_equal (gdb_type, gdb_type_from_ptr))
{
@@ -489,7 +489,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
switch (gdb_type_from_ptr->code ())
{
case TYPE_CODE_ARRAY:
- gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr);
+ gdb_type_from_ptr = gdb_type_from_ptr->target_type ();
break;
case TYPE_CODE_FUNC:
break;
@@ -500,7 +500,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
objfile_name (objfile));
}
if (!types_deeply_equal (gdb_type_from_ptr,
- TYPE_TARGET_TYPE (gdb_type)))
+ gdb_type->target_type ()))
error (_("Referenced types do not match for symbols \"%s\" and \"%s\" "
"in compiled module \"%s\"."),
COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL,
@@ -530,7 +530,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
- regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type));
+ regs_type = check_typedef (regsp_type->target_type ());
if (regs_type->code () != TYPE_CODE_STRUCT)
error (_("Invalid type code %d of dereferenced first parameter "
"of function \"%s\" in compiled module \"%s\"."),
@@ -685,7 +685,7 @@ compile_object_load (const compile_file_names &file_names,
"module \"%s\"."),
func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
- if (!types_deeply_equal (expect_return_type, TYPE_TARGET_TYPE (func_type)))
+ if (!types_deeply_equal (expect_return_type, func_type->target_type ()))
error (_("Invalid return type of function \"%s\" in compiled "
"module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index e734effe7f0..837eafc52f1 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -220,7 +220,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
return {};
- type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ()));
+ type = check_typedef (lang_this.symbol->type ()->target_type ());
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 807c944a97c..1891bac4f9b 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -212,10 +212,10 @@ inspect_type (struct demangle_parse_info *info,
struct type *last = otype;
/* Find the last typedef for the type. */
- while (TYPE_TARGET_TYPE (last) != NULL
- && (TYPE_TARGET_TYPE (last)->code ()
+ while (last->target_type () != NULL
+ && (last->target_type ()->code ()
== TYPE_CODE_TYPEDEF))
- last = TYPE_TARGET_TYPE (last);
+ last = last->target_type ();
/* If there is only one typedef for this anonymous type,
do not substitute it. */
@@ -1336,7 +1336,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
if (type->code () == TYPE_CODE_TYPEDEF)
type = check_typedef (type);
else
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
type_name = type->name ();
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 1d7dafcb149..07bbb9b262e 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -78,10 +78,10 @@ cp_is_vtbl_member (struct type *type)
structures. Nowadays it points directly to the structure. */
if (type->code () == TYPE_CODE_PTR)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_ARRAY)
{
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
|| type->code () == TYPE_CODE_PTR) /* if using thunks */
{
@@ -589,7 +589,7 @@ cp_print_static_field (struct type *type,
{
struct type **first_dont_print;
int i;
- struct type *target_type = TYPE_TARGET_TYPE (type);
+ struct type *target_type = type->target_type ();
first_dont_print
= (struct type **) obstack_base (&dont_print_stat_array_obstack);
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index b37030b3295..561534f9ebe 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -789,13 +789,13 @@ add_array_cv_type (struct ctf_context *ccp,
base_type = copy_type (base_type);
inner_array = base_type;
- while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
+ while (inner_array->target_type ()->code () == TYPE_CODE_ARRAY)
{
- inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array)));
- inner_array = TYPE_TARGET_TYPE (inner_array);
+ inner_array->set_target_type (copy_type (inner_array->target_type ()));
+ inner_array = inner_array->target_type ();
}
- el_type = TYPE_TARGET_TYPE (inner_array);
+ el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr));
@@ -936,7 +936,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
else
this_type->set_target_type (nullptr);
- this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr);
+ this_type->set_target_is_stub (this_type->target_type () != nullptr);
return set_tid_type (objfile, tid, this_type);
}
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 5af042abb11..eb459a4df76 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -130,7 +130,7 @@ d_lookup_symbol (const struct language_defn *langdef,
if (lang_this.symbol == NULL)
return {};
- type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ()));
+ type = check_typedef (lang_this.symbol->type ()->target_type ());
classname = type->name ();
nested = name;
}
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 647a0288cf0..85b3da378f5 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -53,7 +53,7 @@ dynamic_array_type (struct type *type,
length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
ptr_type = type->field (1).type ();
- elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type));
+ elttype = check_typedef (ptr_type->target_type ());
addr = unpack_pointer (ptr_type,
valaddr + type->field (1).loc_bitpos () / 8
+ embedded_offset);
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index bf0df613f24..9463f483554 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1338,7 +1338,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
union call_site_parameter_u kind_u)
{
struct type *checked_type = check_typedef (type);
- struct type *target_type = TYPE_TARGET_TYPE (checked_type);
+ struct type *target_type = checked_type->target_type ();
struct frame_info *caller_frame = get_prev_frame (frame);
struct value *outer_val, *target_val, *val;
struct call_site_parameter *parameter;
@@ -1360,7 +1360,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
entry value. */
if (!TYPE_IS_REFERENCE (checked_type)
- || TYPE_TARGET_TYPE (checked_type) == NULL)
+ || checked_type->target_type () == NULL)
return outer_val;
target_val = dwarf_entry_parameter_to_value (parameter,
@@ -1430,16 +1430,16 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
if (bytes != NULL)
{
if (byte_offset >= 0
- && byte_offset + TYPE_LENGTH (TYPE_TARGET_TYPE (type)) <= len)
+ && byte_offset + TYPE_LENGTH (type->target_type ()) <= len)
{
bytes += byte_offset;
- result = value_from_contents (TYPE_TARGET_TYPE (type), bytes);
+ result = value_from_contents (type->target_type (), bytes);
}
else
invalid_synthetic_pointer ();
}
else
- result = allocate_optimized_out_value (TYPE_TARGET_TYPE (type));
+ result = allocate_optimized_out_value (type->target_type ());
return result;
}
@@ -1476,7 +1476,7 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
baton.size, baton.per_cu,
baton.per_objfile,
- TYPE_TARGET_TYPE (type),
+ type->target_type (),
byte_offset);
else
return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu,
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 50c794606a8..d358297acef 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9060,7 +9060,7 @@ dwarf2_compute_name (const char *name,
if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
&& type->field (0).type ()->code () == TYPE_CODE_PTR
- && TYPE_CONST (TYPE_TARGET_TYPE (type->field (0).type ())))
+ && TYPE_CONST (type->field (0).type ()->target_type ()))
buf.puts (" const");
}
}
@@ -14125,7 +14125,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* TYPE is the domain of this method, and THIS_TYPE is the type
of the method itself (TYPE_CODE_METHOD). */
smash_to_method_type (fnp->type, type,
- TYPE_TARGET_TYPE (this_type),
+ this_type->target_type (),
this_type->fields (),
this_type->num_fields (),
this_type->has_varargs ());
@@ -14226,8 +14226,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
}
else
{
- fnp->fcontext
- = TYPE_TARGET_TYPE (this_type->field (0).type ());
+ fnp->fcontext = this_type->field (0).type ()->target_type ();
}
}
}
@@ -14328,19 +14327,19 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
pfn_type = type->field (0).type ();
if (pfn_type == NULL
|| pfn_type->code () != TYPE_CODE_PTR
- || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
+ || pfn_type->target_type ()->code () != TYPE_CODE_FUNC)
return;
/* Look for the "this" argument. */
- pfn_type = TYPE_TARGET_TYPE (pfn_type);
+ pfn_type = pfn_type->target_type ();
if (pfn_type->num_fields () == 0
/* || pfn_type->field (0).type () == NULL */
|| pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
return;
- self_type = TYPE_TARGET_TYPE (pfn_type->field (0).type ());
+ self_type = pfn_type->field (0).type ()->target_type ();
new_type = alloc_type (objfile);
- smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
+ smash_to_method_type (new_type, self_type, pfn_type->target_type (),
pfn_type->fields (), pfn_type->num_fields (),
pfn_type->has_varargs ());
smash_to_methodptr_type (type, new_type);
@@ -14360,7 +14359,7 @@ rewrite_array_type (struct type *type)
range_bounds *current_bounds = index_type->bounds ();
/* Handle multi-dimensional arrays. */
- struct type *new_target = rewrite_array_type (TYPE_TARGET_TYPE (type));
+ struct type *new_target = rewrite_array_type (type->target_type ());
if (new_target == nullptr)
{
/* Maybe we don't need to rewrite this array. */
@@ -14428,7 +14427,7 @@ quirk_ada_thick_pointer_struct (struct die_info *die, struct dwarf2_cu *cu,
because those may be referenced in other contexts where this
rewriting is undesirable. */
struct type *new_ary_type
- = rewrite_array_type (TYPE_TARGET_TYPE (type->field (0).type ()));
+ = rewrite_array_type (type->field (0).type ()->target_type ());
if (new_ary_type != nullptr)
type->field (0).set_type (lookup_pointer_type (new_ary_type));
}
@@ -15226,9 +15225,9 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
can tell us the reality. However, we defer to a local size
attribute if one exists, because this lets the compiler override
the underlying type if needed. */
- if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_TARGET_TYPE (type)->is_stub ())
+ if (type->target_type () != NULL && !type->target_type ()->is_stub ())
{
- struct type *underlying_type = TYPE_TARGET_TYPE (type);
+ struct type *underlying_type = type->target_type ();
underlying_type = check_typedef (underlying_type);
type->set_is_unsigned (underlying_type->is_unsigned ());
@@ -15543,7 +15542,7 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
iter->main_type->dyn_prop_list = nullptr;
iter->set_index_type
(create_static_range_type (NULL, bounds->field (i).type (), 1, 0));
- iter = TYPE_TARGET_TYPE (iter);
+ iter = iter->target_type ();
}
struct type *result = alloc_type (objfile);
@@ -16224,7 +16223,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct type *new_type = alloc_type (cu->per_objfile->objfile);
- smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
+ smash_to_method_type (new_type, domain, to_type->target_type (),
to_type->fields (), to_type->num_fields (),
to_type->has_varargs ());
type = lookup_methodptr_type (new_type);
@@ -16284,13 +16283,13 @@ add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu,
base_type = copy_type (base_type);
inner_array = base_type;
- while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
+ while (inner_array->target_type ()->code () == TYPE_CODE_ARRAY)
{
- inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array)));
- inner_array = TYPE_TARGET_TYPE (inner_array);
+ inner_array->set_target_type (copy_type (inner_array->target_type ()));
+ inner_array = inner_array->target_type ();
}
- el_type = TYPE_TARGET_TYPE (inner_array);
+ el_type = inner_array->target_type ();
cnst |= TYPE_CONST (el_type);
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, NULL));
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 13dbaf0227a..77e58655879 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -983,7 +983,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
thread_info *thread = inferior_thread ();
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func;
- struct type *value_type = TYPE_TARGET_TYPE (func_func_type);
+ struct type *value_type = func_func_type->target_type ();
struct regcache *regcache = get_thread_regcache (thread);
struct value *func_func;
struct value *value;
diff --git a/gdb/eval.c b/gdb/eval.c
index ce1d883aa86..ddbdd95b39c 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -439,7 +439,7 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type)
{
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
switch (type->code ())
{
@@ -649,7 +649,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
ftype = resolved_type;
}
- type *return_type = TYPE_TARGET_TYPE (ftype);
+ type *return_type = ftype->target_type ();
if (return_type == NULL)
return_type = default_return_type;
@@ -690,7 +690,7 @@ operation::evaluate_funcall (struct type *expect_type,
value *callee = evaluate_with_coercion (exp, noside);
struct type *type = value_type (callee);
if (type->code () == TYPE_CODE_PTR)
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
for (int i = 0; i < args.size (); ++i)
{
if (i < type->num_fields ())
@@ -831,7 +831,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
if (a1_type->code () == TYPE_CODE_METHODPTR)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- callee = value_zero (TYPE_TARGET_TYPE (a1_type), not_lval);
+ callee = value_zero (a1_type->target_type (), not_lval);
else
callee = cplus_method_ptr_to_value (&lhs, rhs);
@@ -842,7 +842,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
struct type *type_ptr
= lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
struct type *target_type_ptr
- = lookup_pointer_type (TYPE_TARGET_TYPE (a1_type));
+ = lookup_pointer_type (a1_type->target_type ());
/* Now, convert this value to an address. */
lhs = value_cast (type_ptr, lhs);
@@ -1038,7 +1038,7 @@ structop_base_operation::complete (struct expression *exp,
type = check_typedef (type);
if (!type->is_pointer_or_reference ())
break;
- type = TYPE_TARGET_TYPE (type);
+ type = type->target_type ();
}
if (type->code () == TYPE_CODE_UNION
@@ -1068,7 +1068,7 @@ is_integral_or_integral_reference (struct type *type)
type = check_typedef (type);
return (type != nullptr
&& TYPE_IS_REFERENCE (type)
- && is_integral_type (TYPE_TARGET_TYPE (type)));
+ && is_integral_type (type->target_type ()));
}
/* Helper function that implements the body of OP_SCOPE. */
@@ -1258,8 +1258,8 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct value_print_options opts;
get_user_print_options (&opts);
- if (opts.objectprint && TYPE_TARGET_TYPE (arg_type)
- && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT))
+ if (opts.objectprint && arg_type->target_type ()
+ && (arg_type->target_type ()->code () == TYPE_CODE_STRUCT))
{
real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc);
@@ -1290,7 +1290,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
{
case TYPE_CODE_METHODPTR:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (TYPE_TARGET_TYPE (type), not_lval);
+ return value_zero (type->target_type (), not_lval);
else
{
arg2 = cplus_method_ptr_to_value (&arg1, arg2);
@@ -1305,7 +1305,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
mem_offset = value_as_long (arg2);
- arg3 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+ arg3 = value_from_pointer (lookup_pointer_type (type->target_type ()),
value_as_long (arg1) + mem_offset);
return value_ind (arg3);
@@ -1436,7 +1436,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
+ return value_zero (type->target_type (), VALUE_LVAL (arg1));
else
return value_subscript (arg1, value_as_long (arg2));
}
@@ -1677,12 +1677,12 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
in the inferior, but being able to print accurate type
information seems worth the risk. */
if (!type->is_pointer_or_reference ()
- || !is_dynamic_type (TYPE_TARGET_TYPE (type)))
+ || !is_dynamic_type (type->target_type ()))
{
if (type->is_pointer_or_reference ()
/* In C you can dereference an array to get the 1st elt. */
|| type->code () == TYPE_CODE_ARRAY)
- return value_zero (TYPE_TARGET_TYPE (type),
+ return value_zero (type->target_type (),
lval_memory);
else if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
@@ -2145,8 +2145,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
struct type *callee_type = value_type (called_method);
if (callee_type && callee_type->code () == TYPE_CODE_PTR)
- callee_type = TYPE_TARGET_TYPE (callee_type);
- callee_type = TYPE_TARGET_TYPE (callee_type);
+ callee_type = callee_type->target_type ();
+ callee_type = callee_type->target_type ();
if (callee_type)
{
@@ -2439,7 +2439,7 @@ array_operation::evaluate (struct type *expect_type,
&& type->code () == TYPE_CODE_ARRAY)
{
struct type *range_type = type->index_type ();
- struct type *element_type = TYPE_TARGET_TYPE (type);
+ struct type *element_type = type->target_type ();
struct value *array = allocate_value (expect_type);
int element_size = TYPE_LENGTH (check_typedef (element_type));
LONGEST low_bound, high_bound, index;
@@ -2483,7 +2483,7 @@ array_operation::evaluate (struct type *expect_type,
/* Get targettype of elementtype. */
while (check_type->code () == TYPE_CODE_RANGE
|| check_type->code () == TYPE_CODE_TYPEDEF)
- check_type = TYPE_TARGET_TYPE (check_type);
+ check_type = check_type->target_type ();
if (!get_discrete_bounds (element_type, &low_bound, &high_bound))
error (_("(power)set type with unknown size"));
@@ -2503,9 +2503,9 @@ array_operation::evaluate (struct type *expect_type,
different types. Also check if type of element is "compatible"
with element type of powerset. */
if (range_low_type->code () == TYPE_CODE_RANGE)
- range_low_type = TYPE_TARGET_TYPE (range_low_type);
+ range_low_type = range_low_type->target_type ();
if (range_high_type->code () == TYPE_CODE_RANGE)
- range_high_type = TYPE_TARGET_TYPE (range_high_type);
+ range_high_type = range_high_type->target_type ();
if ((range_low_type->code () != range_high_type->code ())
|| (range_low_type->code () == TYPE_CODE_ENUM
&& (range_low_type != range_high_type)))
@@ -2577,7 +2577,7 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
struct type *type = check_typedef (value_type (x));
if (TYPE_IS_REFERENCE (type))
- return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+ return value_zero (lookup_pointer_type (type->target_type ()),
not_lval);
else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
return value_zero (lookup_pointer_type (value_type (x)),
@@ -2709,7 +2709,7 @@ var_value_operation::evaluate_with_coercion (struct expression *exp,
{
struct value *val = address_of_variable (var,
std::get<0> (m_storage).block);
- return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val);
+ return value_cast (lookup_pointer_type (type->target_type ()), val);
}
return evaluate (nullptr, exp, noside);
}
@@ -2729,7 +2729,7 @@ evaluate_subexp_for_sizeof_base (struct expression *exp, struct type *type)
type = check_typedef (type);
if (exp->language_defn->la_language == language_cplus
[...]
[diff truncated at 100000 bytes]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-21 15:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 15:05 [binutils-gdb] gdb: remove TYPE_TARGET_TYPE Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).