From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 555D33857C44; Wed, 21 Sep 2022 15:05:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 555D33857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663772741; bh=yFT83RQokGkuhJO7W3NO0Yd5UIABLHbRNu57E/boWEE=; h=From:To:Subject:Date:From; b=uC8SYvLzqRRlg/En0CqKby+WVubtH4wJ0W3esqnHicK5RpymoQgAISMDEGnYYNS+f TGJksdsw5vi+kOQnwhgSorWNuJe61xEr6Y1KpWCJmvdzkrloATYuP+V3f/GAH9qN/v EveW+Xj76sRCZa8crL32ge8zCY1s4OCzgpQu0qEE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove TYPE_TARGET_TYPE X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 8a50fdcefc44c40d5c4b978f19c22ddfbeb29139 X-Git-Newrev: 27710edb4e588d0360620df424dd7ee7e8cfafee Message-Id: <20220921150541.555D33857C44@sourceware.org> Date: Wed, 21 Sep 2022 15:05:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D27710edb4e58= 8d0360620df424dd7ee7e8cfafee commit 27710edb4e588d0360620df424dd7ee7e8cfafee Author: Simon Marchi Date: Sat Jul 30 22:43:54 2022 -0400 gdb: remove TYPE_TARGET_TYPE =20 Remove the macro, replace all uses by calls to type::target_type. =20 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, =20 case TYPE_CODE_COMPLEX: { - struct type *target_type =3D check_typedef (TYPE_TARGET_TYPE (type)); + struct type *target_type =3D check_typedef (type->target_type ()); if (TYPE_LENGTH (target_type) > 16) return -1; =20 @@ -1526,7 +1526,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type = *type, } else { - struct type *target_type =3D TYPE_TARGET_TYPE (type); + struct type *target_type =3D type->target_type (); int count =3D aapcs_is_vfp_call_or_return_candidate_1 (target_type, fundamental_type); =20 @@ -1801,7 +1801,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, str= uct regcache *regcache, case TYPE_CODE_COMPLEX: { const bfd_byte *buf =3D value_contents (arg).data (); - struct type *target_type =3D check_typedef (TYPE_TARGET_TYPE (arg_type)); + struct type *target_type =3D check_typedef (arg_type->target_type ()); =20 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 ()); } ; =20 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 () =3D=3D TYPE_CODE_TYPEDEF) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); return type; } =20 @@ -739,9 +739,9 @@ get_base_type (struct type *type) { while (type !=3D NULL && type->code () =3D=3D TYPE_CODE_RANGE) { - if (type =3D=3D TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) = =3D=3D NULL) + if (type =3D=3D type->target_type () || type->target_type () =3D=3D = NULL) return type; - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } return type; } @@ -1712,7 +1712,7 @@ desc_base_type (struct type *type) if (type !=3D NULL && (type->code () =3D=3D TYPE_CODE_PTR || type->code () =3D=3D 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 =3D lookup_struct_elt_type (type, "P_BOUNDS", 1); if (r !=3D 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 () =3D=3D TYPE_CODE_PTR) { - struct type *target_type =3D TYPE_TARGET_TYPE (p_bounds_type); + struct type *target_type =3D p_bounds_type->target_type (); =20 if (target_type->is_stub ()) p_bounds =3D value_cast (lookup_pointer_type @@ -1902,7 +1902,7 @@ desc_data_target_type (struct type *type) =20 if (data_type && ada_check_typedef (data_type)->code () =3D=3D TYPE_CODE_PTR) - return ada_check_typedef (TYPE_TARGET_TYPE (data_type)); + return ada_check_typedef (data_type->target_type ()); } =20 return NULL; @@ -2042,7 +2042,7 @@ ada_is_array_type (struct type *type) while (type !=3D NULL && (type->code () =3D=3D TYPE_CODE_PTR || type->code () =3D=3D TYPE_CODE_REF)) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); return ada_is_direct_array_type (type); } =20 @@ -2056,7 +2056,7 @@ ada_is_simple_array_type (struct type *type) type =3D ada_check_typedef (type); return (type->code () =3D=3D TYPE_CODE_ARRAY || (type->code () =3D=3D TYPE_CODE_PTR - && (ada_check_typedef (TYPE_TARGET_TYPE (type))->code () + && (ada_check_typedef (type->target_type ())->code () =3D=3D TYPE_CODE_ARRAY))); } =20 @@ -2277,7 +2277,7 @@ ada_is_unconstrained_packed_array_type (struct type *= type) type =3D desc_base_type (type); /* The structure's first field is a pointer to an array, so this fetches the array type. */ - type =3D TYPE_TARGET_TYPE (type->field (0).type ()); + type =3D type->field (0).type ()->target_type (); if (type->code () =3D=3D TYPE_CODE_TYPEDEF) type =3D 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 =3D TYPE_TARGET_TYPE (type->field (0).type ()); + type =3D 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, lon= g *elt_bits) =20 new_type =3D alloc_type_copy (type); new_elt_type =3D - constrained_packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (ty= pe)), + 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) =3D *elt_bits; @@ -2464,7 +2464,7 @@ recursively_update_array_bitsize (struct type *type) return 0; LONGEST our_len =3D high - low + 1; =20 - struct type *elt_type =3D TYPE_TARGET_TYPE (type); + struct type *elt_type =3D type->target_type (); if (elt_type->code () =3D=3D TYPE_CODE_ARRAY) { LONGEST elt_len =3D recursively_update_array_bitsize (elt_type); @@ -2588,7 +2588,7 @@ value_subscript_packed (struct value *arr, int arity,= struct value **ind) (long) idx); bits =3D TYPE_FIELD_BITSIZE (elt_type, 0); elt_total_bit_offset +=3D (idx - lowerbound) * bits; - elt_type =3D ada_check_typedef (TYPE_TARGET_TYPE (elt_type)); + elt_type =3D ada_check_typedef (elt_type->target_type ()); } } elt_off =3D elt_total_bit_offset / HOST_CHAR_BIT; @@ -3007,7 +3007,7 @@ ada_value_subscript (struct value *arr, int arity, st= ruct value **ind) =20 for (k =3D 0; k < arity; k +=3D 1) { - struct type *saved_elt_type =3D TYPE_TARGET_TYPE (elt_type); + struct type *saved_elt_type =3D elt_type->target_type (); =20 if (elt_type->code () !=3D TYPE_CODE_ARRAY) error (_("too many subscripts (%d expected)"), k); @@ -3068,11 +3068,11 @@ ada_value_ptr_subscript (struct value *arr, int ari= ty, struct value **ind) =20 if (type->code () !=3D TYPE_CODE_ARRAY) error (_("too many subscripts (%d expected)"), k); - arr =3D value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), + arr =3D value_cast (lookup_pointer_type (type->target_type ()), value_copy (arr)); get_discrete_bounds (type->index_type (), &lwb, &upb); arr =3D value_ptradd (arr, pos_atr (ind[k]) - lwb); - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } =20 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 =3D ada_check_typedef (type); - struct type *base_index_type =3D TYPE_TARGET_TYPE (type0->index_type ()); + struct type *base_index_type =3D type0->index_type ()->target_type (); struct type *index_type =3D create_static_range_type (NULL, base_index_type, low, high); struct type *slice_type =3D 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 =3D ada_discrete_type_low_bound (type0->index_type ()); @@ -3110,7 +3110,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, st= ruct type *type, =20 ULONGEST stride =3D TYPE_FIELD_BITSIZE (slice_type, 0) / 8; if (stride =3D=3D 0) - stride =3D TYPE_LENGTH (TYPE_TARGET_TYPE (type0)); + stride =3D TYPE_LENGTH (type0->target_type ()); =20 base =3D value_as_address (array_ptr) + (*low_pos - *base_low_pos) * str= ide; 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 =3D ada_check_typedef (value_type (array)); - struct type *base_index_type =3D TYPE_TARGET_TYPE (type->index_type ()); + struct type *base_index_type =3D type->index_type ()->target_type (); struct type *index_type =3D create_static_range_type (NULL, type->index_type (), low, high); struct type *slice_type =3D 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 low_pos, high_pos; @@ -3167,7 +3167,7 @@ ada_array_arity (struct type *type) while (type->code () =3D=3D TYPE_CODE_ARRAY) { arity +=3D 1; - type =3D ada_check_typedef (TYPE_TARGET_TYPE (type)); + type =3D ada_check_typedef (type->target_type ()); } =20 return arity; @@ -3199,7 +3199,7 @@ ada_array_element_type (struct type *type, int nindic= es) k =3D nindices; while (k > 0 && p_array_type !=3D NULL) { - p_array_type =3D ada_check_typedef (TYPE_TARGET_TYPE (p_array_type)); + p_array_type =3D ada_check_typedef (p_array_type->target_type ()); k -=3D 1; } return p_array_type; @@ -3208,7 +3208,7 @@ ada_array_element_type (struct type *type, int nindic= es) { while (nindices !=3D 0 && type->code () =3D=3D TYPE_CODE_ARRAY) { - type =3D TYPE_TARGET_TYPE (type); + type =3D 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 =3D 1; i < n; i +=3D 1) { type =3D ada_check_typedef (type); - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } - result_type =3D TYPE_TARGET_TYPE (ada_check_typedef (type)->index_ty= pe ()); + result_type =3D 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; =20 if (arr_type->code () =3D=3D TYPE_CODE_PTR) - type =3D TYPE_TARGET_TYPE (arr_type); + type =3D arr_type->target_type (); else type =3D arr_type; =20 @@ -3307,7 +3307,7 @@ ada_array_bound_from_type (struct type *arr_type, int= n, int which) struct type *elt_type =3D check_typedef (type); =20 for (i =3D 1; i < n; i++) - elt_type =3D check_typedef (TYPE_TARGET_TYPE (elt_type)); + elt_type =3D check_typedef (elt_type->target_type ()); =20 index_type =3D elt_type->index_type (); } @@ -3376,7 +3376,7 @@ ada_array_length (struct value *arr, int n) { struct type *base_type; if (index_type->code () =3D=3D TYPE_CODE_RANGE) - base_type =3D TYPE_TARGET_TYPE (index_type); + base_type =3D index_type->target_type (); else base_type =3D index_type; =20 @@ -3396,7 +3396,7 @@ empty_array (struct type *arr_type, int low, int high) struct type *arr_type0 =3D ada_check_typedef (arr_type); struct type *index_type =3D 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 =3D ada_array_element_type (arr_type0, 1); =20 @@ -3520,11 +3520,11 @@ ada_print_symbol_signature (struct ui_file *stream,= struct symbol *sym, } gdb_printf (stream, ")"); } - if (TYPE_TARGET_TYPE (type) !=3D NULL - && TYPE_TARGET_TYPE (type)->code () !=3D TYPE_CODE_VOID) + if (type->target_type () !=3D NULL + && type->target_type ()->code () !=3D 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); } } =20 @@ -3905,9 +3905,9 @@ ada_type_match (struct type *ftype, struct type *atyp= e) atype =3D ada_check_typedef (atype); =20 if (ftype->code () =3D=3D TYPE_CODE_REF) - ftype =3D TYPE_TARGET_TYPE (ftype); + ftype =3D ftype->target_type (); if (atype->code () =3D=3D TYPE_CODE_REF) - atype =3D TYPE_TARGET_TYPE (atype); + atype =3D atype->target_type (); =20 switch (ftype->code ()) { @@ -3916,11 +3916,11 @@ ada_type_match (struct type *ftype, struct type *at= ype) case TYPE_CODE_PTR: if (atype->code () !=3D TYPE_CODE_PTR) return 0; - atype =3D TYPE_TARGET_TYPE (atype); + atype =3D atype->target_type (); /* This can only happen if the actual argument is 'null'. */ if (atype->code () =3D=3D TYPE_CODE_INT && TYPE_LENGTH (atype) =3D= =3D 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 *co= ntext_type) return 1; =20 if (func_type->code () =3D=3D TYPE_CODE_FUNC) - return_type =3D get_base_type (TYPE_TARGET_TYPE (func_type)); + return_type =3D get_base_type (func_type->target_type ()); else return_type =3D get_base_type (func_type); if (return_type =3D=3D NULL) @@ -4094,8 +4094,8 @@ numeric_type_p (struct type *type) case TYPE_CODE_FIXED_POINT: return 1; case TYPE_CODE_RANGE: - return (type =3D=3D TYPE_TARGET_TYPE (type) - || numeric_type_p (TYPE_TARGET_TYPE (type))); + return (type =3D=3D 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 =3D=3D TYPE_TARGET_TYPE (type) - || integer_type_p (TYPE_TARGET_TYPE (type))); + return (type =3D=3D 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 =3D t =3D ada_check_typedef (value_type (arg)); if (t->code () =3D=3D TYPE_CODE_REF) { - t1 =3D TYPE_TARGET_TYPE (t); + t1 =3D t->target_type (); if (t1 =3D=3D NULL) goto BadValue; t1 =3D ada_check_typedef (t1); @@ -4392,7 +4392,7 @@ ada_value_struct_elt (struct value *arg, const char *= name, int no_err) =20 while (t->code () =3D=3D TYPE_CODE_PTR) { - t1 =3D TYPE_TARGET_TYPE (t); + t1 =3D t->target_type (); if (t1 =3D=3D NULL) goto BadValue; t1 =3D ada_check_typedef (t1); @@ -4429,7 +4429,7 @@ ada_value_struct_elt (struct value *arg, const char *= name, int no_err) =20 if (ada_is_tagged_type (t1, 0) || (t1->code () =3D=3D 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 ty= pe *formal_type0) struct type *formal_type =3D ada_check_typedef (formal_type0); struct type *formal_target =3D formal_type->code () =3D=3D 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 =3D actual_type->code () =3D=3D TYPE_CODE_PTR - ? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type; + ? ada_check_typedef (actual_type->target_type ()) : actual_type; =20 if (ada_is_array_descriptor_type (formal_target) && actual_target->code () =3D=3D TYPE_CODE_ARRAY) @@ -6258,7 +6258,7 @@ ada_is_dispatch_table_ptr_type (struct type *type) if (type->code () !=3D TYPE_CODE_PTR) return 0; =20 - name =3D TYPE_TARGET_TYPE (type)->name (); + name =3D type->target_type ()->name (); if (name =3D=3D NULL) return 0; =20 @@ -6351,7 +6351,7 @@ ada_is_tag_type (struct type *type) return 0; else { - const char *name =3D ada_type_name (TYPE_TARGET_TYPE (type)); + const char *name =3D ada_type_name (type->target_type ()); =20 return (name !=3D NULL && strcmp (name, "ada__tags__dispatch_table") =3D=3D 0); @@ -6665,7 +6665,7 @@ ada_parent_type (struct type *type) =20 /* If the _parent field is a pointer, then dereference it. */ if (parent_type->code () =3D=3D TYPE_CODE_PTR) - parent_type =3D TYPE_TARGET_TYPE (parent_type); + parent_type =3D parent_type->target_type (); /* If there is a parallel XVS type, get the actual base type. */ parent_type =3D ada_get_base_type (parent_type); =20 @@ -6733,7 +6733,7 @@ ada_is_variant_part (struct type *type, int field_num) =20 return (field_type->code () =3D=3D TYPE_CODE_UNION || (is_dynamic_field (type, field_num) - && (TYPE_TARGET_TYPE (field_type)->code () + && (field_type->target_type ()->code () =3D=3D TYPE_CODE_UNION))); } =20 @@ -6776,7 +6776,7 @@ ada_variant_discrim_name (struct type *type0) const char *discrim_start; =20 if (type0->code () =3D=3D TYPE_CODE_PTR) - type =3D TYPE_TARGET_TYPE (type0); + type =3D type0->target_type (); else type =3D type0; =20 @@ -7321,7 +7321,7 @@ ada_lookup_struct_elt_type (struct type *type, const = char *name, int refok, type =3D ada_check_typedef (type); if (type->code () !=3D TYPE_CODE_PTR && type->code () !=3D TYPE_CODE_REF) break; - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } =20 if (type =3D=3D NULL @@ -7905,8 +7905,7 @@ ada_template_to_fixed_record_type_1 (struct type *typ= e, { const gdb_byte *field_valaddr =3D valaddr; CORE_ADDR field_address =3D address; - struct type *field_type =3D - TYPE_TARGET_TYPE (type->field (f).type ()); + struct type *field_type =3D type->field (f).type ()->target_type (); =20 if (dval0 =3D=3D NULL) { @@ -8090,7 +8089,7 @@ template_to_fixed_record_type (struct type *type, con= st 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. */ =20 static struct type * @@ -8105,8 +8104,8 @@ template_to_static_fixed_type (struct type *type0) return type0; =20 /* Likewise if we already have computed the static approximation. */ - if (TYPE_TARGET_TYPE (type0) !=3D NULL) - return TYPE_TARGET_TYPE (type0); + if (type0->target_type () !=3D NULL) + return type0->target_type (); =20 /* Don't clone TYPE0 until we are sure we are going to need a copy. */ type =3D type0; @@ -8124,7 +8123,7 @@ template_to_static_fixed_type (struct type *type0) if (is_dynamic_field (type0, f)) { field_type =3D ada_check_typedef (field_type); - new_type =3D to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); + new_type =3D to_static_fixed_type (field_type->target_type ()); } else new_type =3D 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; =20 if (var_type0->code () =3D=3D TYPE_CODE_PTR) - var_type =3D TYPE_TARGET_TYPE (var_type0); + var_type =3D var_type0->target_type (); else var_type =3D var_type0; =20 @@ -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, d= val); else if (variant_field_index (var_type->field (which).type ()) >=3D 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 =3D check_typedef (TYPE_TARGET_TYPE (this_layer)); + this_layer =3D check_typedef (this_layer->target_type ()); } =20 return 1; @@ -8460,7 +8458,7 @@ to_fixed_array_type (struct type *type0, struct value= *dval, =20 if (index_type_desc =3D=3D NULL) { - struct type *elt_type0 =3D ada_check_typedef (TYPE_TARGET_TYPE (type= 0)); + struct type *elt_type0 =3D ada_check_typedef (type0->target_type ()); =20 /* 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, =20 elt_type0 =3D type0; for (i =3D index_type_desc->num_fields (); i > 0; i -=3D 1) - elt_type0 =3D TYPE_TARGET_TYPE (elt_type0); + elt_type0 =3D elt_type0->target_type (); =20 /* 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, =20 result =3D create_array_type (alloc_type_copy (elt_type0), result, range_type); - elt_type0 =3D TYPE_TARGET_TYPE (elt_type0); + elt_type0 =3D elt_type0->target_type (); } } =20 @@ -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 =3D TYPE_LENGTH (result) / TYPE_LENGTH (TYPE_TARGET_TYPE (re= sult)); + int len =3D TYPE_LENGTH (result) / TYPE_LENGTH (result->target_type = ()); int elt_bitsize =3D TYPE_FIELD_BITSIZE (type0, 0); =20 TYPE_FIELD_BITSIZE (result, 0) =3D 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 () =3D=3D TYPE_CODE_RANGE) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); if (type->code () =3D=3D TYPE_CODE_ENUM) { if (val < 0 || val >=3D type->num_fields ()) @@ -9088,7 +9086,7 @@ ada_get_base_type (struct type *raw_type) } =20 /* 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 (); } =20 /* 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 =3D TYPE_TARGET_TYPE (type); + struct type *elt_type =3D type->target_type (); LONGEST lo, hi; LONGEST i; =20 @@ -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 () =3D=3D 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 () =3D=3D 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 ())); =20 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")); =20 - 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); } =20 - if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2)) - !=3D TYPE_LENGTH (TYPE_TARGET_TYPE (type))) + if (TYPE_LENGTH (type2->target_type ()) + !=3D 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 () =3D=3D TYPE_CODE_REF) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); =20 if (noside =3D=3D 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 () =3D=3D 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 ())); =20 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 () =3D=3D TYPE_CODE_PTR - && (TYPE_TARGET_TYPE (value_type (array))->code () + && (value_type (array)->target_type ()->code () =3D=3D TYPE_CODE_PTR)) array =3D value_ind (array); =20 @@ -10320,11 +10318,11 @@ ada_ternop_slice (struct expression *exp, struct type *type0 =3D ada_check_typedef (value_type (array)); =20 if (high_bound < low_bound || noside =3D=3D 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 =3D - to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1); + to_fixed_array_type (type0->target_type (), NULL, 1); =20 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 =3D check_typedef (value_type (rhs)); struct type *elt_type =3D nullptr; if (rhs_type->code () =3D=3D TYPE_CODE_ARRAY) - elt_type =3D TYPE_TARGET_TYPE (rhs_type); + elt_type =3D rhs_type->target_type (); lhs =3D lhs_expr->evaluate (elt_type, exp, noside); } else if (dynamic_cast (rhs_expr.get ()) !=3D nul= lptr) @@ -10755,7 +10753,7 @@ ada_concat_operation::evaluate (struct type *expect= _type, struct type *lhs_type =3D check_typedef (value_type (lhs)); struct type *elt_type =3D nullptr; if (lhs_type->code () =3D=3D TYPE_CODE_ARRAY) - elt_type =3D TYPE_TARGET_TYPE (lhs_type); + elt_type =3D lhs_type->target_type (); rhs =3D 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 =3D value_type (arg1); while (type->code () =3D=3D TYPE_CODE_REF) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); arg1 =3D 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 *exp= ect_type, a reference should mostly be transparent to the user. */ if (ada_is_tagged_type (type, 0) || (type->code () =3D=3D 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 *expe= ct_type, =20 if ((type->code () =3D=3D TYPE_CODE_REF || type->code () =3D=3D TYPE_CODE_PTR) - && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)) + && ada_is_tagged_type (type->target_type (), 0)) { arg1 =3D std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL); @@ -11055,7 +11053,7 @@ ada_unop_ind_operation::evaluate (struct type *expe= ct_type, { type =3D 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 *exp= ect_type, =20 if (type->code () =3D=3D 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 =3D ada_check_typedef (TYPE_TARGET_TYPE (type)); + type =3D ada_check_typedef (type->target_type ()); break; case TYPE_CODE_ARRAY: break; case TYPE_CODE_STRUCT: if (noside !=3D EVAL_AVOID_SIDE_EFFECTS) callee =3D ada_value_ind (callee); - type =3D ada_check_typedef (TYPE_TARGET_TYPE (type)); + type =3D 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 *expec= t_type, case TYPE_CODE_FUNC: if (noside =3D=3D EVAL_AVOID_SIDE_EFFECTS) { - if (TYPE_TARGET_TYPE (type) =3D=3D NULL) + if (type->target_type () =3D=3D 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 *expec= t_type, case TYPE_CODE_PTR: /* Pointer to array */ if (noside =3D=3D EVAL_AVOID_SIDE_EFFECTS) { - type =3D to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1); + type =3D to_fixed_array_type (type->target_type (), NULL, 1); type =3D ada_array_element_type (type, nargs); if (type =3D=3D 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 () !=3D NULL); =20 if (raw_type->code () =3D=3D TYPE_CODE_RANGE) - base_type =3D TYPE_TARGET_TYPE (raw_type); + base_type =3D raw_type->target_type (); else base_type =3D raw_type; =20 @@ -13769,7 +13767,7 @@ public: gdb::unique_xmalloc_ptr watch_location_expression (struct type *type, CORE_ADDR addr) const override { - type =3D check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); + type =3D check_typedef (check_typedef (type)->target_type ()); std::string name =3D 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, i= nt max_len) =20 bounds_type =3D type->field (bounds_fieldno).type (); if (bounds_type->code () =3D=3D TYPE_CODE_PTR) - bounds_type =3D TYPE_TARGET_TYPE (bounds_type); + bounds_type =3D bounds_type->target_type (); if (bounds_type->code () !=3D TYPE_CODE_STRUCT) error (_("Unknown task name format. Aborting")); upper_bound_fieldno =3D ada_get_field_index (bounds_type, "UB0", 0); @@ -909,7 +909,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_infer= ior_data *data) struct type *idxtype =3D NULL; =20 if (type->code () =3D=3D TYPE_CODE_ARRAY) - eltype =3D check_typedef (TYPE_TARGET_TYPE (type)); + eltype =3D check_typedef (type->target_type ()); if (eltype !=3D NULL && eltype->code () =3D=3D TYPE_CODE_PTR) idxtype =3D 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 () !=3D TYPE_CODE_RANGE) return 0; =20 - subtype =3D TYPE_TARGET_TYPE (type); + subtype =3D type->target_type (); if (subtype =3D=3D NULL) return 0; =20 @@ -143,7 +143,7 @@ print_range (struct type *type, struct ui_file *stream, =20 array ('["00"]' .. '["ff"]') of ... */ while (type_is_full_subrange_of_target_type (type)) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } =20 switch (type->code ()) @@ -271,7 +271,7 @@ print_range_type (struct type *raw_type, struct ui_file= *stream, gdb_assert (name !=3D NULL); =20 if (raw_type->code () =3D=3D TYPE_CODE_RANGE) - base_type =3D TYPE_TARGET_TYPE (raw_type); + base_type =3D raw_type->target_type (); else base_type =3D raw_type; =20 @@ -390,7 +390,7 @@ print_array_type (struct type *type, struct ui_file *st= ream, int show, name, then it is not another dimension of the outer array, but rather the element type of the outermost array. */ - arr_type =3D TYPE_TARGET_TYPE (arr_type); + arr_type =3D arr_type->target_type (); if (arr_type->name () !=3D nullptr) break; } @@ -402,7 +402,7 @@ print_array_type (struct type *type, struct ui_file *st= ream, int show, n_indices =3D range_desc_type->num_fields (); for (k =3D 0, arr_type =3D type; k < n_indices; - k +=3D 1, arr_type =3D TYPE_TARGET_TYPE (arr_type)) + k +=3D 1, arr_type =3D arr_type->target_type ()) { if (k > 0) gdb_printf (stream, ", "); @@ -564,7 +564,7 @@ print_variant_clauses (struct type *type, int field_num, =20 if (var_type->code () =3D=3D TYPE_CODE_PTR) { - var_type =3D TYPE_TARGET_TYPE (var_type); + var_type =3D var_type->target_type (); if (var_type =3D=3D NULL || var_type->code () !=3D TYPE_CODE_UNION) return; } @@ -884,8 +884,8 @@ print_func_type (struct type *type, struct ui_file *str= eam, const char *name, { int i, len =3D type->num_fields (); =20 - if (TYPE_TARGET_TYPE (type) !=3D NULL - && TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_VOID) + if (type->target_type () !=3D NULL + && type->target_type ()->code () =3D=3D 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 *s= tream, const char *name, gdb_printf (stream, ")"); } =20 - if (TYPE_TARGET_TYPE (type) =3D=3D NULL) + if (type->target_type () =3D=3D NULL) gdb_printf (stream, " return "); - else if (TYPE_TARGET_TYPE (type)->code () !=3D TYPE_CODE_VOID) + else if (type->target_type ()->code () !=3D 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); } } =20 @@ -998,12 +998,12 @@ ada_print_type (struct type *type0, const char *varst= ring, if (type->code () !=3D TYPE_CODE_PTR || strstr (varstring, "___XVL") =3D=3D 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, " "); - 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 =3D TYPE_TARGET_TYPE (index_type); + index_type =3D index_type->target_type (); } =20 /* Don't print the lower bound if it's the default one. */ @@ -130,7 +130,7 @@ val_print_packed_array_elements (struct type *type, con= st gdb_byte *valaddr, struct value *mark =3D value_mark (); LONGEST low =3D 0; =20 - elttype =3D TYPE_TARGET_TYPE (type); + elttype =3D type->target_type (); index_type =3D type->index_type (); =20 { @@ -151,7 +151,7 @@ val_print_packed_array_elements (struct type *type, con= st gdb_byte *valaddr, } =20 if (index_type->code () =3D=3D TYPE_CODE_RANGE) - index_type =3D TYPE_TARGET_TYPE (index_type); + index_type =3D index_type->target_type (); =20 i =3D 0; annotate_array_section_begin (i, elttype); @@ -421,7 +421,7 @@ ada_print_scalar (struct type *type, LONGEST val, struc= t ui_file *stream) break; =20 case TYPE_CODE_RANGE: - ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream); + ada_print_scalar (type->target_type (), val, stream); return; =20 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 =3D type_byte_order (type); - struct type *elttype =3D TYPE_TARGET_TYPE (type); + struct type *elttype =3D type->target_type (); unsigned int eltlen; unsigned int len; =20 @@ -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 () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))) =3D=3D 0) + && value_type (val)->target_type ()->code () =3D=3D TYPE_CODE_INT + && TYPE_LENGTH (value_type (val)->target_type ()) =3D=3D 0) { gdb_puts ("null", stream); return; @@ -761,15 +761,15 @@ ada_value_print_num (struct value *val, struct ui_fil= e *stream, int recurse, const gdb_byte *valaddr =3D value_contents_for_printing (val).data (); =20 if (type->code () =3D=3D TYPE_CODE_RANGE - && (TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_ENUM - || TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_BOOL - || TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_CHAR)) + && (type->target_type ()->code () =3D=3D TYPE_CODE_ENUM + || type->target_type ()->code () =3D=3D TYPE_CODE_BOOL + || type->target_type ()->code () =3D=3D 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 =3D TYPE_TARGET_TYPE (type); + struct type *target_type =3D type->target_type (); val =3D 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 *v= aladdr, 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 =3D check_typedef (TYPE_TARGET_TYPE (type)); + struct type *elttype =3D check_typedef (type->target_type ()); struct value *deref_val; CORE_ADDR deref_val_int; =20 @@ -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 () =3D=3D TYPE_CODE_PTR - && !(TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) =3D=3D 0)) + && !(type->target_type ()->code () =3D=3D TYPE_CODE_INT + && TYPE_LENGTH (type->target_type ()) =3D=3D 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)) !=3D sizeof (char) - || TYPE_TARGET_TYPE (type)->code () !=3D TYPE_CODE_INT - || TYPE_TARGET_TYPE (type)->is_unsigned ()) + if (TYPE_LENGTH (type->target_type ()) !=3D sizeof (char) + || type->target_type ()->code () !=3D 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 () =3D=3D TYPE_CODE_TYPEDEF) - parent_type =3D TYPE_TARGET_TYPE (parent_type); + parent_type =3D parent_type->target_type (); parent_type =3D ada_coerce_to_simple_array_type (parent_type); parent_type =3D lookup_pointer_type (parent_type); } @@ -153,7 +153,7 @@ ada_varobj_ind (struct value *parent_value, type =3D value_type (value); } else - type =3D TYPE_TARGET_TYPE (parent_type); + type =3D parent_type->target_type (); =20 if (child_value) *child_value =3D value; @@ -184,7 +184,7 @@ ada_varobj_simple_array_elt (struct value *parent_value, type =3D value_type (value); } else - type =3D TYPE_TARGET_TYPE (parent_type); + type =3D parent_type->target_type (); =20 if (child_value) *child_value =3D value; @@ -207,12 +207,12 @@ ada_varobj_adjust_for_child_access (struct value **va= lue, the struct/union type. We handle this situation by dereferencing the (value, type) couple. */ if ((*type)->code () =3D=3D TYPE_CODE_PTR - && (TYPE_TARGET_TYPE (*type)->code () =3D=3D TYPE_CODE_STRUCT - || TYPE_TARGET_TYPE (*type)->code () =3D=3D TYPE_CODE_UNION) + && ((*type)->target_type ()->code () =3D=3D TYPE_CODE_STRUCT + || (*type)->target_type ()->code () =3D=3D TYPE_CODE_UNION) && *value !=3D nullptr && value_as_address (*value) !=3D 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); =20 /* 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 =3D TYPE_TARGET_TYPE (parent_type); + struct type *child_type =3D parent_type->target_type (); =20 /* 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 *p= arent_value, =20 /* If the index type is a range type, find the base type. */ while (index_type->code () =3D=3D TYPE_CODE_RANGE) - index_type =3D TYPE_TARGET_TYPE (index_type); + index_type =3D index_type->target_type (); =20 if (index_type->code () =3D=3D TYPE_CODE_ENUM || index_type->code () =3D=3D TYPE_CODE_BOOL) @@ -946,7 +946,7 @@ ada_value_is_changeable_p (const struct varobj *var) ? value_type (var->value.get ()) : var->type); =20 if (type->code () =3D=3D TYPE_CODE_REF) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); =20 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]) =20 if (type->code () =3D=3D TYPE_CODE_ARRAY) { - struct type *subtype =3D check_typedef (TYPE_TARGET_TYPE (type)); + struct type *subtype =3D check_typedef (type->target_type ()); =20 /* 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, st= ruct value *function, /* __m128, __m128i and __m128d are returned via XMM0. */ if (type->is_vector () && len =3D=3D 16) { - enum type_code code =3D TYPE_TARGET_TYPE (type)->code (); + enum type_code code =3D type->target_type ()->code (); if (code =3D=3D TYPE_CODE_INT || code =3D=3D TYPE_CODE_FLT) { regnum =3D 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; =20 - count =3D arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), + count =3D arm_vfp_cprc_sub_candidate (t->target_type (), base_type); if (count =3D=3D -1) return -1; @@ -4442,7 +4442,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, applies. */ ftype =3D check_typedef (value_type (function)); if (ftype->code () =3D=3D TYPE_CODE_PTR) - ftype =3D check_typedef (TYPE_TARGET_TYPE (ftype)); + ftype =3D check_typedef (ftype->target_type ()); use_vfp_abi =3D arm_vfp_abi_for_function (gdbarch, ftype); =20 /* 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, =20 arg_type =3D check_typedef (value_type (args[argnum])); len =3D TYPE_LENGTH (arg_type); - target_type =3D TYPE_TARGET_TYPE (arg_type); + target_type =3D arg_type->target_type (); typecode =3D arg_type->code (); val =3D value_contents (args[argnum]).data (); =20 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 () =3D=3D TYPE_CODE_FUNC - || TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_METHOD) + else if (type->target_type ()->code () =3D=3D TYPE_CODE_FUNC + || type->target_type ()->code () =3D=3D 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 () =3D=3D TYPE_CODE_FUNC - || TYPE_TARGET_TYPE (type)->code () =3D=3D TYPE_CODE_METHOD - || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) + else if (type->target_type ()->code () =3D=3D TYPE_CODE_FUNC + || type->target_type ()->code () =3D=3D 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 =3D 0; if (ax->trace_string && value->type->code () =3D=3D TYPE_CODE_PTR - && c_textual_element_type (check_typedef (TYPE_TARGET_TYPE (value->t= ype)), + && c_textual_element_type (check_typedef (value->type->target_type (= )), 's')) string_trace =3D 1; =20 @@ -367,7 +367,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) } =20 if (type->code () =3D=3D TYPE_CODE_RANGE) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); =20 switch (type->code ()) { @@ -735,7 +735,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_valu= e *value) are no longer an lvalue. */ case TYPE_CODE_ARRAY: { - struct type *elements =3D TYPE_TARGET_TYPE (value->type); + struct type *elements =3D value->type->target_type (); =20 value->type =3D lookup_pointer_type (elements); value->kind =3D axs_rvalue; @@ -946,7 +946,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *valu= e, struct type *type) static void gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type) { - struct type *element =3D TYPE_TARGET_TYPE (type); + struct type *element =3D type->target_type (); =20 if (TYPE_LENGTH (element) !=3D 1) { @@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *v= alue, gdb_assert (value1->type->is_pointer_or_reference ()); gdb_assert (value2->type->is_pointer_or_reference ()); =20 - if (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type)) - !=3D TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type))) + if (TYPE_LENGTH (value1->type->target_type ()) + !=3D 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 =3D check_typedef (TYPE_TARGET_TYPE (value->type)); + value->type =3D check_typedef (value->type->target_type ()); if (value->type->code () =3D=3D TYPE_CODE_VOID) error (_("Attempt to dereference a generic pointer.")); value->kind =3D ((value->type->code () =3D=3D 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_funadd= r) { /* Get the return type of the resolver. */ struct type *resolver_ret_type - =3D check_typedef (TYPE_TARGET_TYPE (resolver_type)); + =3D check_typedef (resolver_type->target_type ()); =20 /* If we found a pointer to function, then the resolved type is the type of the pointed-to function. */ if (resolver_ret_type->code () =3D=3D TYPE_CODE_PTR) { struct type *resolved_type - =3D TYPE_TARGET_TYPE (resolver_ret_type); + =3D resolver_ret_type->target_type (); if (check_typedef (resolved_type)->code () =3D=3D 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 =3D (make_operation - (TYPE_TARGET_TYPE ($1.type), 0)); + ($1.type->target_type (), 0)); operation_up imag =3D (make_operation - (TYPE_TARGET_TYPE ($1.type), $1.val)); + ($1.type->target_type (), $1.val)); pstate->push_new (std::move (real), std::move (imag), $1.type); } @@ -905,8 +905,7 @@ exp : FLOAT =20 exp : COMPLEX_FLOAT { - struct type *underlying - =3D TYPE_TARGET_TYPE ($1.type); + struct type *underlying =3D $1.type->target_type (); =20 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 =3D check_typedef (TYPE_TARGET_TYPE (type)); + type =3D check_typedef (type->target_type ()); + pstate->push_new (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 *gd= barch, /* Call for side effects. */ check_typedef (elttype); =20 - if (TYPE_TARGET_TYPE (elttype)) - elttype =3D TYPE_TARGET_TYPE (elttype); + if (elttype->target_type ()) + elttype =3D 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 *buffer, int err, width; unsigned int fetchlimit; struct type *type =3D check_typedef (value_type (value)); - struct type *element_type =3D TYPE_TARGET_TYPE (type); + struct type *element_type =3D type->target_type (); int req_length =3D *length; enum bfd_endian byte_order =3D type_byte_order (type); @@ -625,7 +625,7 @@ c_string_operation::evaluate (struct type *expect_type, if (expect_type && expect_type->code () =3D=3D TYPE_CODE_ARRAY) { struct type *element_type - =3D check_typedef (TYPE_TARGET_TYPE (expect_type)); + =3D check_typedef (expect_type->target_type ()); =20 if (element_type->code () =3D=3D TYPE_CODE_INT || element_type->code () =3D=3D TYPE_CODE_CHAR) @@ -697,7 +697,7 @@ c_is_string_type_p (struct type *type) type =3D check_typedef (type); while (type->code () =3D=3D TYPE_CODE_REF) { - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); type =3D check_typedef (type); } =20 @@ -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 =3D TYPE_TARGET_TYPE (type); + struct type *array_target_type =3D 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 =3D TYPE_TARGET_TYPE (type); + struct type *element_type =3D 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 ch= ar *prefix, =20 gdb_assert (nargs > 0); gdb_assert (args[0].type ()->code () =3D=3D TYPE_CODE_PTR); - domain =3D TYPE_TARGET_TYPE (args[0].type ()); + domain =3D args[0].type ()->target_type (); =20 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; =20 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 =3D TYPE_SELF_TYPE (type)->name (); if (name) @@ -387,7 +387,7 @@ c_type_print_varspec_prefix (struct type *type, break; =20 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, =20 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 () =3D=3D TYPE_CODE_REF ? "&" : "&&"); @@ -412,7 +412,7 @@ c_type_print_varspec_prefix (struct type *type, =20 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; =20 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; =20 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 ? ")))" : "]")); =20 - 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; =20 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; =20 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; =20 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; =20 @@ -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; =20 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; =20 @@ -1266,7 +1266,7 @@ c_type_print_base_struct_union (struct type *type, st= ruct 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)) =3D=3D 0) + if (TYPE_FN_FIELD_TYPE (f, j)->target_type () =3D=3D 0) { /* Keep GDB from crashing here. */ gdb_printf (stream, @@ -1282,7 +1282,7 @@ c_type_print_base_struct_union (struct type *type, st= ruct 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); =20 gdb_puts (" ", stream); @@ -1382,7 +1382,7 @@ c_type_print_base_struct_union (struct type *type, st= ruct ui_file *stream, =20 /* Dereference the typedef declaration itself. */ gdb_assert (target->code () =3D=3D TYPE_CODE_TYPEDEF); - target =3D TYPE_TARGET_TYPE (target); + target =3D target->target_type (); =20 if (need_access_label) { @@ -1495,19 +1495,19 @@ c_type_print_base_1 (struct type *type, struct ui_f= ile *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 () =3D=3D NULL); - gdb_assert (TYPE_TARGET_TYPE (type) =3D=3D NULL); + gdb_assert (type->target_type () =3D=3D NULL); fprintf_styled (stream, metadata_style.style (), _("")); break; =20 case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: - if (TYPE_TARGET_TYPE (type) =3D=3D NULL) + if (type->target_type () =3D=3D 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_fil= e *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; =20 @@ -1564,9 +1564,9 @@ c_type_print_base_1 (struct type *type, struct ui_fil= e *stream, print too much than too little; but conversely not to print something egregiously outside the current language's syntax. */ - if (language =3D=3D language_cplus && TYPE_TARGET_TYPE (type) !=3D NULL) + if (language =3D=3D language_cplus && type->target_type () !=3D NULL) { - struct type *underlying =3D check_typedef (TYPE_TARGET_TYPE (type)); + struct type *underlying =3D check_typedef (type->target_type ()); =20 if (underlying->name () !=3D 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 =3D TYPE_TARGET_TYPE (iter_type); + if (iter_type->target_type ()) + iter_type =3D iter_type->target_type (); else iter_type =3D check_typedef (iter_type); } @@ -238,7 +238,7 @@ c_value_print_array (struct value *val, struct type *type =3D check_typedef (value_type (val)); CORE_ADDR address =3D value_address (val); const gdb_byte *valaddr =3D value_contents_for_printing (val).data (); - struct type *unresolved_elttype =3D TYPE_TARGET_TYPE (type); + struct type *unresolved_elttype =3D type->target_type (); struct type *elttype =3D check_typedef (unresolved_elttype); =20 if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) @@ -347,7 +347,7 @@ c_value_print_ptr (struct value *val, struct ui_file *s= tream, int recurse, } else { - struct type *unresolved_elttype =3D TYPE_TARGET_TYPE (type); + struct type *unresolved_elttype =3D type->target_type (); struct type *elttype =3D check_typedef (unresolved_elttype); CORE_ADDR addr =3D unpack_pointer (type, valaddr); =20 @@ -497,15 +497,15 @@ c_value_print (struct value *val, struct ui_file *str= eam, are always exactly (char *), (wchar_t *), or the like. */ if (original_type->code () =3D=3D TYPE_CODE_PTR && original_type->name () =3D=3D NULL - && TYPE_TARGET_TYPE (original_type)->name () !=3D NULL - && (strcmp (TYPE_TARGET_TYPE (original_type)->name (), + && original_type->target_type ()->name () !=3D NULL + && (strcmp (original_type->target_type ()->name (), "char") =3D=3D 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 () =3D=3D TYPE_CODE_STRUCT)) + && (type->target_type ()->code () =3D=3D TYPE_CODE_STRUCT)) { int is_ref =3D TYPE_IS_REFERENCE (type); enum type_code refcode =3D 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 inde= x, check_typedef and here, we want to show the true declared type of the variable. */ if (ctype) - *ctype =3D TYPE_TARGET_TYPE (type); + *ctype =3D type->target_type (); =20 if (cfull_expression) *cfull_expression =3D string_printf ("*(%s)", parent_expression.c_str ()); @@ -482,7 +482,7 @@ c_value_of_variable (const struct varobj *var, =20 /* Strip top-level references. */ while (TYPE_IS_REFERENCE (type)) - type =3D check_typedef (TYPE_TARGET_TYPE (type)); + type =3D check_typedef (type->target_type ()); =20 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 =3D TYPE_TARGET_TYPE (type); - struct type *real_target =3D TYPE_TARGET_TYPE (real_type); + struct type *target =3D type->target_type (); + struct type *real_target =3D real_type->target_type (); int field_size =3D real_target->num_fields () * sizeof (struct field); =20 TYPE_LENGTH (target) =3D TYPE_LENGTH (real_target); @@ -1509,7 +1509,7 @@ patch_opaque_types (struct symtab *s) if (real_sym->aclass () =3D=3D LOC_TYPEDEF && real_sym->domain () =3D=3D VAR_DOMAIN && real_sym->type ()->code () =3D=3D TYPE_CODE_PTR - && TYPE_LENGTH (TYPE_TARGET_TYPE (real_sym->type ())) !=3D 0) + && TYPE_LENGTH (real_sym->type ()->target_type ()) !=3D 0) { const char *name =3D real_sym->linkage_name (); int hash =3D 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 () =3D=3D TYPE_CODE_PTR - && TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) =3D=3D 0 - && TYPE_TARGET_TYPE (sym->type ())->code () + && TYPE_LENGTH (sym->type ()->target_type ()) =3D=3D 0 + && sym->type ()->target_type ()->code () !=3D TYPE_CODE_UNDEF) { int i =3D hashname (sym->linkage_name ()); diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbol= s.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 =3D check_typedef (type); =20 if (TYPE_IS_REFERENCE (type)) - type =3D check_typedef (TYPE_TARGET_TYPE (type)); + type =3D check_typedef (type->target_type ()); =20 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; =20 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 =3D context->convert_type (TYPE_TARGET_TYPE (type)); + gcc_type target =3D context->convert_type (type->target_type ()); =20 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 =3D type->index_type (); =20 - element_type =3D context->convert_type (TYPE_TARGET_TYPE (type)); + element_type =3D context->convert_type (type->target_type ()); =20 if (range->bounds ()->low.kind () !=3D 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 =3D type->has_varargs () || !type->is_prototyped (); =20 - struct type *target_type =3D TYPE_TARGET_TYPE (type); + struct type *target_type =3D type->target_type (); =20 /* 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 =3D context->convert_type (TYPE_TARGET_TYPE (type)); + gcc_type base =3D context->convert_type (type->target_type ()); =20 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 =3D instance->convert_type (TYPE_TARGET_TYPE (type)); + gcc_type target =3D instance->convert_type (type->target_type ()); =20 enum gcc_cp_ref_qualifiers quals =3D 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 =3D instance->convert_type (TYPE_TARGET_TYPE (type)); + gcc_type target =3D instance->convert_type (type->target_type ()); =20 return instance->convert_pointer_base (target); } @@ -454,7 +454,7 @@ compile_cplus_convert_array (compile_cplus_instance *in= stance, struct type *type) { struct type *range =3D type->index_type (); - gcc_type element_type =3D instance->convert_type (TYPE_TARGET_TYPE (type= )); + gcc_type element_type =3D instance->convert_type (type->target_type ()); =20 if (range->bounds ()->low.kind () !=3D PROP_CONST) { @@ -697,7 +697,7 @@ compile_cplus_convert_memberptr (compile_cplus_instance= *instance, =20 gcc_type class_type =3D instance->convert_type (containing_class); gcc_type member_type - =3D instance->convert_type (TYPE_TARGET_TYPE (type)); + =3D instance->convert_type (type->target_type ()); =20 return instance->plugin ().build_pointer_to_member_type (class_type, member_type); @@ -961,7 +961,7 @@ compile_cplus_convert_func (compile_cplus_instance *ins= tance, struct type *type, bool strip_artificial) { int is_varargs =3D type->has_varargs (); - struct type *target_type =3D TYPE_TARGET_TYPE (type); + struct type *target_type =3D type->target_type (); =20 /* 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 =3D instance->convert_type (TYPE_TARGET_TYPE (type)); + gcc_type base =3D instance->convert_type (type->target_type ()); =20 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 obj= file *objfile, gdb_ptr_type =3D check_typedef (gdb_ptr_type); if (gdb_ptr_type->code () !=3D TYPE_CODE_PTR) error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE); - gdb_type_from_ptr =3D check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type)); + gdb_type_from_ptr =3D check_typedef (gdb_ptr_type->target_type ()); =20 if (types_deeply_equal (gdb_type, gdb_type_from_ptr)) { @@ -489,7 +489,7 @@ get_out_value_type (struct symbol *func_sym, struct obj= file *objfile, switch (gdb_type_from_ptr->code ()) { case TYPE_CODE_ARRAY: - gdb_type_from_ptr =3D TYPE_TARGET_TYPE (gdb_type_from_ptr); + gdb_type_from_ptr =3D 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 obj= file *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)); =20 - regs_type =3D check_typedef (TYPE_TARGET_TYPE (regsp_type)); + regs_type =3D check_typedef (regsp_type->target_type ()); if (regs_type->code () !=3D 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_nam= es, "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 *lang= def, return {}; =20 =20 - type =3D check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())= ); + type =3D 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 =3D otype; =20 /* Find the last typedef for the type. */ - while (TYPE_TARGET_TYPE (last) !=3D NULL - && (TYPE_TARGET_TYPE (last)->code () + while (last->target_type () !=3D NULL + && (last->target_type ()->code () =3D=3D TYPE_CODE_TYPEDEF)) - last =3D TYPE_TARGET_TYPE (last); + last =3D last->target_type (); =20 /* 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 () =3D=3D TYPE_CODE_TYPEDEF) type =3D check_typedef (type); else - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } =20 type_name =3D 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 () =3D=3D TYPE_CODE_PTR) { - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); if (type->code () =3D=3D TYPE_CODE_ARRAY) { - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); if (type->code () =3D=3D TYPE_CODE_STRUCT /* if not using thunks */ || type->code () =3D=3D 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 =3D TYPE_TARGET_TYPE (type); + struct type *target_type =3D type->target_type (); =20 first_dont_print =3D (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 =3D copy_type (base_type); inner_array =3D base_type; =20 - while (TYPE_TARGET_TYPE (inner_array)->code () =3D=3D TYPE_CODE_ARRAY) + while (inner_array->target_type ()->code () =3D=3D TYPE_CODE_ARRAY) { - inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_arr= ay))); - inner_array =3D TYPE_TARGET_TYPE (inner_array); + inner_array->set_target_type (copy_type (inner_array->target_type ()= )); + inner_array =3D inner_array->target_type (); } =20 - el_type =3D TYPE_TARGET_TYPE (inner_array); + el_type =3D inner_array->target_type (); cnst |=3D TYPE_CONST (el_type); voltl |=3D TYPE_VOLATILE (el_type); inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullpt= r)); @@ -936,7 +936,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t ti= d, else this_type->set_target_type (nullptr); =20 - this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) !=3D nullptr= ); + this_type->set_target_is_stub (this_type->target_type () !=3D nullptr); =20 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 =3D=3D NULL) return {}; =20 - type =3D check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())); + type =3D check_typedef (lang_this.symbol->type ()->target_type ()); classname =3D type->name (); nested =3D 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 =3D unpack_field_as_long (type, valaddr + embedded_offset, 0); =20 ptr_type =3D type->field (1).type (); - elttype =3D check_typedef (TYPE_TARGET_TYPE (ptr_type)); + elttype =3D check_typedef (ptr_type->target_type ()); addr =3D 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 f= rame_info *frame, union call_site_parameter_u kind_u) { struct type *checked_type =3D check_typedef (type); - struct type *target_type =3D TYPE_TARGET_TYPE (checked_type); + struct type *target_type =3D checked_type->target_type (); struct frame_info *caller_frame =3D 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 f= rame_info *frame, entry value. */ =20 if (!TYPE_IS_REFERENCE (checked_type) - || TYPE_TARGET_TYPE (checked_type) =3D=3D NULL) + || checked_type->target_type () =3D=3D NULL) return outer_val; =20 target_val =3D dwarf_entry_parameter_to_value (parameter, @@ -1430,16 +1430,16 @@ fetch_const_value_from_synthetic_pointer (sect_offs= et die, LONGEST byte_offset, if (bytes !=3D NULL) { if (byte_offset >=3D 0 - && byte_offset + TYPE_LENGTH (TYPE_TARGET_TYPE (type)) <=3D len) + && byte_offset + TYPE_LENGTH (type->target_type ()) <=3D len) { bytes +=3D byte_offset; - result =3D value_from_contents (TYPE_TARGET_TYPE (type), bytes); + result =3D value_from_contents (type->target_type (), bytes); } else invalid_synthetic_pointer (); } else - result =3D allocate_optimized_out_value (TYPE_TARGET_TYPE (type)); + result =3D allocate_optimized_out_value (type->target_type ()); =20 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 () =3D=3D 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, struc= t 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, struc= t die_info *die, } else { - fnp->fcontext - =3D TYPE_TARGET_TYPE (this_type->field (0).type ()); + fnp->fcontext =3D this_type->field (0).type ()->target_type (); } } } @@ -14328,19 +14327,19 @@ quirk_gcc_member_function_pointer (struct type *t= ype, struct objfile *objfile) pfn_type =3D type->field (0).type (); if (pfn_type =3D=3D NULL || pfn_type->code () !=3D TYPE_CODE_PTR - || TYPE_TARGET_TYPE (pfn_type)->code () !=3D TYPE_CODE_FUNC) + || pfn_type->target_type ()->code () !=3D TYPE_CODE_FUNC) return; =20 /* Look for the "this" argument. */ - pfn_type =3D TYPE_TARGET_TYPE (pfn_type); + pfn_type =3D pfn_type->target_type (); if (pfn_type->num_fields () =3D=3D 0 /* || pfn_type->field (0).type () =3D=3D NULL */ || pfn_type->field (0).type ()->code () !=3D TYPE_CODE_PTR) return; =20 - self_type =3D TYPE_TARGET_TYPE (pfn_type->field (0).type ()); + self_type =3D pfn_type->field (0).type ()->target_type (); new_type =3D 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 =3D index_type->bounds (); =20 /* Handle multi-dimensional arrays. */ - struct type *new_target =3D rewrite_array_type (TYPE_TARGET_TYPE (type)); + struct type *new_target =3D rewrite_array_type (type->target_type ()); if (new_target =3D=3D nullptr) { /* Maybe we don't need to rewrite this array. */ @@ -14428,7 +14427,7 @@ quirk_ada_thick_pointer_struct (struct die_info *di= e, struct dwarf2_cu *cu, because those may be referenced in other contexts where this rewriting is undesirable. */ struct type *new_ary_type - =3D rewrite_array_type (TYPE_TARGET_TYPE (type->field (0).type ())); + =3D rewrite_array_type (type->field (0).type ()->target_type ()); if (new_ary_type !=3D 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) !=3D NULL && !TYPE_TARGET_TYPE (type)->is_st= ub ()) + if (type->target_type () !=3D NULL && !type->target_type ()->is_stub ()) { - struct type *underlying_type =3D TYPE_TARGET_TYPE (type); + struct type *underlying_type =3D type->target_type (); underlying_type =3D check_typedef (underlying_type); =20 type->set_is_unsigned (underlying_type->is_unsigned ()); @@ -15543,7 +15542,7 @@ quirk_ada_thick_pointer (struct die_info *die, stru= ct dwarf2_cu *cu, iter->main_type->dyn_prop_list =3D nullptr; iter->set_index_type (create_static_range_type (NULL, bounds->field (i).type (), 1, 0)); - iter =3D TYPE_TARGET_TYPE (iter); + iter =3D iter->target_type (); } =20 struct type *result =3D 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 =3D alloc_type (cu->per_objfile->objfile); =20 - 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 =3D lookup_methodptr_type (new_type); @@ -16284,13 +16283,13 @@ add_array_cv_type (struct die_info *die, struct d= warf2_cu *cu, base_type =3D copy_type (base_type); inner_array =3D base_type; =20 - while (TYPE_TARGET_TYPE (inner_array)->code () =3D=3D TYPE_CODE_ARRAY) + while (inner_array->target_type ()->code () =3D=3D TYPE_CODE_ARRAY) { - inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_arr= ay))); - inner_array =3D TYPE_TARGET_TYPE (inner_array); + inner_array->set_target_type (copy_type (inner_array->target_type ()= )); + inner_array =3D inner_array->target_type (); } =20 - el_type =3D TYPE_TARGET_TYPE (inner_array); + el_type =3D inner_array->target_type (); cnst |=3D TYPE_CONST (el_type); voltl |=3D 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 =3D inferior_thread (); struct gdbarch *gdbarch =3D get_frame_arch (get_current_frame ()); struct type *func_func_type =3D builtin_type (gdbarch)->builtin_func_fun= c; - struct type *value_type =3D TYPE_TARGET_TYPE (func_func_type); + struct type *value_type =3D func_func_type->target_type (); struct regcache *regcache =3D 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, struc= t type *type) { type =3D check_typedef (type); if (TYPE_IS_REFERENCE (type)) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); =20 switch (type->code ()) { @@ -649,7 +649,7 @@ evaluate_subexp_do_call (expression *exp, enum noside n= oside, ftype =3D resolved_type; } =20 - type *return_type =3D TYPE_TARGET_TYPE (ftype); + type *return_type =3D ftype->target_type (); =20 if (return_type =3D=3D NULL) return_type =3D default_return_type; @@ -690,7 +690,7 @@ operation::evaluate_funcall (struct type *expect_type, value *callee =3D evaluate_with_coercion (exp, noside); struct type *type =3D value_type (callee); if (type->code () =3D=3D TYPE_CODE_PTR) - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); for (int i =3D 0; i < args.size (); ++i) { if (i < type->num_fields ()) @@ -831,7 +831,7 @@ structop_member_base::evaluate_funcall (struct type *ex= pect_type, if (a1_type->code () =3D=3D TYPE_CODE_METHODPTR) { if (noside =3D=3D EVAL_AVOID_SIDE_EFFECTS) - callee =3D value_zero (TYPE_TARGET_TYPE (a1_type), not_lval); + callee =3D value_zero (a1_type->target_type (), not_lval); else callee =3D cplus_method_ptr_to_value (&lhs, rhs); =20 @@ -842,7 +842,7 @@ structop_member_base::evaluate_funcall (struct type *ex= pect_type, struct type *type_ptr =3D lookup_pointer_type (TYPE_SELF_TYPE (a1_type)); struct type *target_type_ptr - =3D lookup_pointer_type (TYPE_TARGET_TYPE (a1_type)); + =3D lookup_pointer_type (a1_type->target_type ()); =20 /* Now, convert this value to an address. */ lhs =3D value_cast (type_ptr, lhs); @@ -1038,7 +1038,7 @@ structop_base_operation::complete (struct expression = *exp, type =3D check_typedef (type); if (!type->is_pointer_or_reference ()) break; - type =3D TYPE_TARGET_TYPE (type); + type =3D type->target_type (); } =20 if (type->code () =3D=3D TYPE_CODE_UNION @@ -1068,7 +1068,7 @@ is_integral_or_integral_reference (struct type *type) type =3D check_typedef (type); return (type !=3D nullptr && TYPE_IS_REFERENCE (type) - && is_integral_type (TYPE_TARGET_TYPE (type))); + && is_integral_type (type->target_type ())); } =20 /* Helper function that implements the body of OP_SCOPE. */ @@ -1258,8 +1258,8 @@ eval_op_structop_ptr (struct type *expect_type, struc= t expression *exp, struct value_print_options opts; =20 get_user_print_options (&opts); - if (opts.objectprint && TYPE_TARGET_TYPE (arg_type) - && (TYPE_TARGET_TYPE (arg_type)->code () =3D=3D TYPE_CODE_STRUCT)) + if (opts.objectprint && arg_type->target_type () + && (arg_type->target_type ()->code () =3D=3D TYPE_CODE_STRUCT)) { real_type =3D value_rtti_indirect_type (arg1, &full, &top, &using_enc); @@ -1290,7 +1290,7 @@ eval_op_member (struct type *expect_type, struct expr= ession *exp, { case TYPE_CODE_METHODPTR: if (noside =3D=3D EVAL_AVOID_SIDE_EFFECTS) - return value_zero (TYPE_TARGET_TYPE (type), not_lval); + return value_zero (type->target_type (), not_lval); else { arg2 =3D cplus_method_ptr_to_value (&arg1, arg2); @@ -1305,7 +1305,7 @@ eval_op_member (struct type *expect_type, struct expr= ession *exp, =20 mem_offset =3D value_as_long (arg2); =20 - arg3 =3D value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (= type)), + arg3 =3D value_from_pointer (lookup_pointer_type (type->target_type = ()), value_as_long (arg1) + mem_offset); return value_ind (arg3); =20 @@ -1436,7 +1436,7 @@ eval_op_subscript (struct type *expect_type, struct e= xpression *exp, } =20 if (noside =3D=3D 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 expre= ssion *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 () =3D=3D TYPE_CODE_ARRAY) - return value_zero (TYPE_TARGET_TYPE (type), + return value_zero (type->target_type (), lval_memory); else if (type->code () =3D=3D TYPE_CODE_INT) /* GDB allows dereferencing an int. */ @@ -2145,8 +2145,8 @@ eval_op_objc_msgcall (struct type *expect_type, struc= t expression *exp, struct type *callee_type =3D value_type (called_method); =20 if (callee_type && callee_type->code () =3D=3D TYPE_CODE_PTR) - callee_type =3D TYPE_TARGET_TYPE (callee_type); - callee_type =3D TYPE_TARGET_TYPE (callee_type); + callee_type =3D callee_type->target_type (); + callee_type =3D callee_type->target_type (); =20 if (callee_type) { @@ -2439,7 +2439,7 @@ array_operation::evaluate (struct type *expect_type, && type->code () =3D=3D TYPE_CODE_ARRAY) { struct type *range_type =3D type->index_type (); - struct type *element_type =3D TYPE_TARGET_TYPE (type); + struct type *element_type =3D type->target_type (); struct value *array =3D allocate_value (expect_type); int element_size =3D 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 () =3D=3D TYPE_CODE_RANGE || check_type->code () =3D=3D TYPE_CODE_TYPEDEF) - check_type =3D TYPE_TARGET_TYPE (check_type); + check_type =3D check_type->target_type (); =20 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 () =3D=3D TYPE_CODE_RANGE) - range_low_type =3D TYPE_TARGET_TYPE (range_low_type); + range_low_type =3D range_low_type->target_type (); if (range_high_type->code () =3D=3D TYPE_CODE_RANGE) - range_high_type =3D TYPE_TARGET_TYPE (range_high_type); + range_high_type =3D range_high_type->target_type (); if ((range_low_type->code () !=3D range_high_type->code ()) || (range_low_type->code () =3D=3D TYPE_CODE_ENUM && (range_low_type !=3D range_high_type))) @@ -2577,7 +2577,7 @@ evaluate_subexp_for_address_base (struct expression *= exp, enum noside noside, struct type *type =3D check_typedef (value_type (x)); =20 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) =3D=3D lval_memory || value_must_coerce_to_t= arget (x)) return value_zero (lookup_pointer_type (value_type (x)), @@ -2709,7 +2709,7 @@ var_value_operation::evaluate_with_coercion (struct e= xpression *exp, { struct value *val =3D address_of_variable (var, std::get<0> (m_storage).block); - return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), va= l); + 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 *e= xp, struct type *type) type =3D check_typedef (type); if (exp->language_defn->la_language =3D=3D language_cplus [...] [diff truncated at 100000 bytes]