]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove TYPE_FIELD_TYPE macro
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:20 +0000 (15:26 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:31 +0000 (15:26 -0400)
Remove the `TYPE_FIELD_TYPE` macro, changing all the call sites to use
`type::field` and `field::type` directly.

gdb/ChangeLog:

* gdbtypes.h (TYPE_FIELD_TYPE): Remove.  Change all call sites
to use type::field and field::type instead.

Change-Id: Ifda6226a25c811cfd334a756a9fbc5c0afdddff3

62 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/ada-typeprint.c
gdb/ada-valprint.c
gdb/ada-varobj.c
gdb/amd64-tdep.c
gdb/arm-tdep.c
gdb/ax-gdb.c
gdb/c-lang.c
gdb/c-typeprint.c
gdb/c-valprint.c
gdb/c-varobj.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-c-types.c
gdb/compile/compile-cplus-types.c
gdb/compile/compile-object-load.c
gdb/compile/compile-object-run.c
gdb/completer.c
gdb/cp-valprint.c
gdb/d-valprint.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/f-typeprint.c
gdb/f-valprint.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v2-abi.c
gdb/gnu-v3-abi.c
gdb/go-lang.c
gdb/go-valprint.c
gdb/i386-darwin-tdep.c
gdb/i386-tdep.c
gdb/i386-windows-tdep.c
gdb/ia64-tdep.c
gdb/infcall.c
gdb/m2-lang.c
gdb/m2-typeprint.c
gdb/m2-valprint.c
gdb/m68k-tdep.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/nds32-tdep.c
gdb/p-exp.y
gdb/p-lang.c
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/ppc-sysv-tdep.c
gdb/python/py-type.c
gdb/riscv-tdep.c
gdb/rust-lang.c
gdb/rx-tdep.c
gdb/score-tdep.c
gdb/sh-tdep.c
gdb/sparc64-tdep.c
gdb/typeprint.c
gdb/v850-tdep.c
gdb/valops.c
gdb/valprint.c
gdb/value.c

index c658014d0754f015f764800b68ba6a087c5ec2fe..26310c429b33f32e6cf97b4d9c60459cdd107e2a 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-08  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (TYPE_FIELD_TYPE): Remove.  Change all call sites
+       to use type::field and field::type instead.
+
 2020-06-08  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (FIELD_TYPE): Remove.  Change all call sites
index 91ea562248df9d553b86a698d7b4a4576ad35f60..5e7d0d0b8682af04ce4f01fd999d26c9eb459932 100644 (file)
@@ -1352,7 +1352,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
            if (field_is_static (&type->field (i)))
              continue;
 
-           struct type *member = check_typedef (TYPE_FIELD_TYPE (type, i));
+           struct type *member = check_typedef (type->field (i).type ());
 
            int sub_count = aapcs_is_vfp_call_or_return_candidate_1
                              (member, fundamental_type);
index 2ae9830dbbb865e0cfa02dca3ccec7c3483219e4..57d89b01fec6c6c44886a14ab89561d4f5afaa4e 100644 (file)
@@ -1158,7 +1158,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
 
       fieldno = ada_get_field_index (type, field_name, 1);
       if (fieldno >= 0)
-        return TYPE_FIELD_TYPE (type, fieldno);
+        return type->field (fieldno).type ();
 
       subfield_name = field_name;
       while (*subfield_name != '\0' && *subfield_name != '.' 
@@ -1173,7 +1173,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
       if (fieldno < 0)
         return NULL;
 
-      type = TYPE_FIELD_TYPE (type, fieldno);
+      type = type->field (fieldno).type ();
       field_name = subfield_name;
     }
 
index 20c27c4e8aa09211614b39da6dd364d7451513dd..f7b973f36ee16ad235a74a85073e810c963f33e2 100644 (file)
@@ -1420,8 +1420,8 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
      If our INDEX_DESC_TYPE was generated using the older encoding,
      the field type should be a meaningless integer type whose name
      is not equal to the field name.  */
-  if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL
-      && strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (),
+  if (index_desc_type->field (0).type ()->name () != NULL
+      && strcmp (index_desc_type->field (0).type ()->name (),
                  TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
     return;
 
@@ -1622,7 +1622,7 @@ fat_pntr_bounds_bitsize (struct type *type)
   if (TYPE_FIELD_BITSIZE (type, 1) > 0)
     return TYPE_FIELD_BITSIZE (type, 1);
   else
-    return 8 * TYPE_LENGTH (ada_check_typedef (TYPE_FIELD_TYPE (type, 1)));
+    return 8 * TYPE_LENGTH (ada_check_typedef (type->field (1).type ()));
 }
 
 /* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@@ -1637,7 +1637,7 @@ desc_data_target_type (struct type *type)
 
   /* NOTE: The following is bogus; see comment in desc_bounds.  */
   if (is_thin_pntr (type))
-    return desc_base_type (TYPE_FIELD_TYPE (thin_descriptor_type (type), 1));
+    return desc_base_type (thin_descriptor_type (type)->field (1).type ());
   else if (is_thick_pntr (type))
     {
       struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
@@ -1688,7 +1688,7 @@ fat_pntr_data_bitsize (struct type *type)
   if (TYPE_FIELD_BITSIZE (type, 0) > 0)
     return TYPE_FIELD_BITSIZE (type, 0);
   else
-    return TARGET_CHAR_BIT * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
+    return TARGET_CHAR_BIT * TYPE_LENGTH (type->field (0).type ());
 }
 
 /* If BOUNDS is an array-bounds structure (or pointer to one), return
@@ -1727,7 +1727,7 @@ desc_bound_bitsize (struct type *type, int i, int which)
   if (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0)
     return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2);
   else
-    return 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 2 * i + which - 2));
+    return 8 * TYPE_LENGTH (type->field (2 * i + which - 2).type ());
 }
 
 /* If TYPE is the type of an array-bounds structure, the type of its
@@ -2078,7 +2078,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
 
   index_type_desc = ada_find_parallel_type (type, "___XA");
   if (index_type_desc)
-    index_type = to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, 0),
+    index_type = to_fixed_range_type (index_type_desc->field (0).type (),
                                      NULL);
   else
     index_type = type->index_type ();
@@ -2948,7 +2948,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
     }
 
   if (index_type_desc != NULL)
-    index_type = to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, n - 1),
+    index_type = to_fixed_range_type (index_type_desc->field (n - 1).type (),
                                      NULL);
   else
     {
@@ -3163,7 +3163,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
        {
          if (i > 0)
            fprintf_filtered (stream, "; ");
-         ada_print_type (TYPE_FIELD_TYPE (type, i), NULL, stream, -1, 0,
+         ada_print_type (type->field (i).type (), NULL, stream, -1, 0,
                          flags);
        }
       fprintf_filtered (stream, ")");
@@ -3854,8 +3854,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
         return 0;
       else
         {
-          struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type,
-                                                                  i));
+          struct type *ftype = ada_check_typedef (func_type->field (i).type ());
           struct type *atype = ada_check_typedef (value_type (actuals[i]));
 
           if (!ada_type_match (ftype, atype, 1))
@@ -4505,14 +4504,14 @@ make_array_descriptor (struct type *type, struct value *arr)
   modify_field (value_type (descriptor),
                value_contents_writeable (descriptor),
                value_pointer (ensure_lval (arr),
-                              TYPE_FIELD_TYPE (desc_type, 0)),
+                              desc_type->field (0).type ()),
                fat_pntr_data_bitpos (desc_type),
                fat_pntr_data_bitsize (desc_type));
 
   modify_field (value_type (descriptor),
                value_contents_writeable (descriptor),
                value_pointer (bounds,
-                              TYPE_FIELD_TYPE (desc_type, 1)),
+                              desc_type->field (1).type ()),
                fat_pntr_bounds_bitpos (desc_type),
                fat_pntr_bounds_bitsize (desc_type));
 
@@ -6480,8 +6479,8 @@ ada_is_ignored_field (struct type *type, int field_num)
   /* If this is the dispatch table of a tagged type or an interface tag,
      then ignore.  */
   if (ada_is_tagged_type (type, 1)
-      && (ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num))
-         || ada_is_interface_tag (TYPE_FIELD_TYPE (type, field_num))))
+      && (ada_is_dispatch_table_ptr_type (type->field (field_num).type ())
+         || ada_is_interface_tag (type->field (field_num).type ())))
     return 1;
 
   /* Not a special field, so it should not be ignored.  */
@@ -6792,7 +6791,7 @@ ada_parent_type (struct type *type)
   for (i = 0; i < type->num_fields (); i += 1)
     if (ada_is_parent_field (type, i))
       {
-        struct type *parent_type = TYPE_FIELD_TYPE (type, i);
+        struct type *parent_type = type->field (i).type ();
 
         /* If the _parent field is a pointer, then dereference it.  */
         if (parent_type->code () == TYPE_CODE_PTR)
@@ -6860,7 +6859,7 @@ ada_is_variant_part (struct type *type, int field_num)
   if (!ADA_TYPE_P (type))
     return 0;
 
-  struct type *field_type = TYPE_FIELD_TYPE (type, field_num);
+  struct type *field_type = type->field (field_num).type ();
 
   return (field_type->code () == TYPE_CODE_UNION
          || (is_dynamic_field (type, field_num)
@@ -7049,7 +7048,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
   struct type *type;
 
   arg_type = ada_check_typedef (arg_type);
-  type = TYPE_FIELD_TYPE (arg_type, fieldno);
+  type = arg_type->field (fieldno).type ();
 
   /* Handle packed fields.  It might be that the field is not packed
      relative to its containing structure, but the structure itself is
@@ -7180,7 +7179,7 @@ find_struct_field (const char *name, struct type *type, int offset,
           int bit_size = TYPE_FIELD_BITSIZE (type, i);
 
          if (field_type_p != NULL)
-           *field_type_p = TYPE_FIELD_TYPE (type, i);
+           *field_type_p = type->field (i).type ();
          if (byte_offset_p != NULL)
            *byte_offset_p = fld_offset;
          if (bit_offset_p != NULL)
@@ -7191,7 +7190,7 @@ find_struct_field (const char *name, struct type *type, int offset,
         }
       else if (ada_is_wrapper_field (type, i))
         {
-         if (find_struct_field (name, TYPE_FIELD_TYPE (type, i), fld_offset,
+         if (find_struct_field (name, type->field (i).type (), fld_offset,
                                 field_type_p, byte_offset_p, bit_offset_p,
                                 bit_size_p, index_p))
             return 1;
@@ -7202,11 +7201,11 @@ find_struct_field (const char *name, struct type *type, int offset,
             fixed type?? */
           int j;
           struct type *field_type
-           = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+           = ada_check_typedef (type->field (i).type ());
 
           for (j = 0; j < field_type->num_fields (); j += 1)
             {
-              if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j),
+              if (find_struct_field (name, field_type->field (j).type (),
                                      fld_offset
                                      + TYPE_FIELD_BITPOS (field_type, j) / 8,
                                      field_type_p, byte_offset_p,
@@ -7226,7 +7225,7 @@ find_struct_field (const char *name, struct type *type, int offset,
       int bit_pos = TYPE_FIELD_BITPOS (type, parent_offset);
       int fld_offset = offset + bit_pos / 8;
 
-      if (find_struct_field (name, TYPE_FIELD_TYPE (type, parent_offset),
+      if (find_struct_field (name, type->field (parent_offset).type (),
                              fld_offset, field_type_p, byte_offset_p,
                              bit_offset_p, bit_size_p, index_p))
         return 1;
@@ -7293,7 +7292,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
           struct value *v =     /* Do not let indent join lines here.  */
             ada_search_struct_field (name, arg,
                                      offset + TYPE_FIELD_BITPOS (type, i) / 8,
-                                     TYPE_FIELD_TYPE (type, i));
+                                     type->field (i).type ());
 
           if (v != NULL)
             return v;
@@ -7303,8 +7302,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
         {
          /* PNH: Do we ever get here?  See find_struct_field.  */
           int j;
-          struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
-                                                                       i));
+          struct type *field_type = ada_check_typedef (type->field (i).type ());
           int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
 
           for (j = 0; j < field_type->num_fields (); j += 1)
@@ -7313,7 +7311,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
                                                           break.  */
                 (name, arg,
                  var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
-                 TYPE_FIELD_TYPE (field_type, j));
+                 field_type->field (j).type ());
 
               if (v != NULL)
                 return v;
@@ -7328,7 +7326,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
     {
       struct value *v = ada_search_struct_field (
        name, arg, offset + TYPE_FIELD_BITPOS (type, parent_offset) / 8,
-       TYPE_FIELD_TYPE (type, parent_offset));
+       type->field (parent_offset).type ());
 
       if (v != NULL)
         return v;
@@ -7374,7 +7372,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
           struct value *v =     /* Do not let indent join lines here.  */
             ada_index_struct_field_1 (index_p, arg,
                                      offset + TYPE_FIELD_BITPOS (type, i) / 8,
-                                     TYPE_FIELD_TYPE (type, i));
+                                     type->field (i).type ());
 
           if (v != NULL)
             return v;
@@ -7481,11 +7479,11 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
         }
 
       else if (field_name_match (t_field_name, name))
-       return TYPE_FIELD_TYPE (type, i);
+       return type->field (i).type ();
 
       else if (ada_is_wrapper_field (type, i))
         {
-          t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name,
+          t = ada_lookup_struct_elt_type (type->field (i).type (), name,
                                           0, 1);
           if (t != NULL)
            return t;
@@ -7494,8 +7492,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
       else if (ada_is_variant_part (type, i))
         {
           int j;
-          struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
-                                                                       i));
+          struct type *field_type = ada_check_typedef (type->field (i).type ());
 
           for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
             {
@@ -7507,10 +7504,9 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
 
              if (v_field_name != NULL 
                  && field_name_match (v_field_name, name))
-               t = TYPE_FIELD_TYPE (field_type, j);
+               t = field_type->field (j).type ();
              else
-               t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type,
-                                                                j),
+               t = ada_lookup_struct_elt_type (field_type->field (j).type (),
                                                name, 0, 1);
 
               if (t != NULL)
@@ -7527,7 +7523,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
       {
         struct type *t;
 
-        t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, parent_offset),
+        t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
                                         name, 0, 1);
         if (t != NULL)
          return t;
@@ -7916,7 +7912,7 @@ is_dynamic_field (struct type *templ_type, int field_num)
   const char *name = TYPE_FIELD_NAME (templ_type, field_num);
 
   return name != NULL
-    && TYPE_FIELD_TYPE (templ_type, field_num)->code () == TYPE_CODE_PTR
+    && templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
     && strstr (name, "___XVL") != NULL;
 }
 
@@ -8029,7 +8025,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
          const gdb_byte *field_valaddr = valaddr;
          CORE_ADDR field_address = address;
          struct type *field_type =
-           TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f));
+           TYPE_TARGET_TYPE (type->field (f).type ());
 
           if (dval0 == NULL)
            {
@@ -8097,7 +8093,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
             adding overflow recovery code to this already complex code,
             we just assume that it's not going to happen.  */
           fld_bit_len =
-            TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, f)) * TARGET_CHAR_BIT;
+            TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
         }
       else
         {
@@ -8111,14 +8107,14 @@ ada_template_to_fixed_record_type_1 (struct type *type,
             structure, the typedef is the only clue which allows us
             to distinguish between the two options.  Stripping it
             would prevent us from printing this field appropriately.  */
-          rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f));
+          rtype->field (f).set_type (type->field (f).type ());
           TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
           if (TYPE_FIELD_BITSIZE (type, f) > 0)
             fld_bit_len =
               TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
           else
            {
-             struct type *field_type = TYPE_FIELD_TYPE (type, f);
+             struct type *field_type = type->field (f).type ();
 
              /* We need to be careful of typedefs when computing
                 the length of our field.  If this is a typedef,
@@ -8162,7 +8158,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
 
       branch_type =
         to_fixed_variant_branch_type
-        (TYPE_FIELD_TYPE (type, variant_field),
+        (type->field (variant_field).type (),
          cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
          cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
       if (branch_type == NULL)
@@ -8176,7 +8172,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
           rtype->field (variant_field).set_type (branch_type);
           TYPE_FIELD_NAME (rtype, variant_field) = "S";
           fld_bit_len =
-            TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) *
+            TYPE_LENGTH (rtype->field (variant_field).type ()) *
             TARGET_CHAR_BIT;
           if (off + fld_bit_len > bit_len)
             bit_len = off + fld_bit_len;
@@ -8257,7 +8253,7 @@ template_to_static_fixed_type (struct type *type0)
 
   for (f = 0; f < nfields; f += 1)
     {
-      struct type *field_type = TYPE_FIELD_TYPE (type0, f);
+      struct type *field_type = type0->field (f).type ();
       struct type *new_type;
 
       if (is_dynamic_field (type0, f))
@@ -8341,7 +8337,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
   TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
 
   branch_type = to_fixed_variant_branch_type
-    (TYPE_FIELD_TYPE (type, variant_field),
+    (type->field (variant_field).type (),
      cond_offset_host (valaddr,
                        TYPE_FIELD_BITPOS (type, variant_field)
                        / TARGET_CHAR_BIT),
@@ -8363,7 +8359,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
       TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
       TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
     }
-  TYPE_LENGTH (rtype) -= TYPE_LENGTH (TYPE_FIELD_TYPE (type, variant_field));
+  TYPE_LENGTH (rtype) -= TYPE_LENGTH (type->field (variant_field).type ());
 
   value_free_to_mark (mark);
   return rtype;
@@ -8449,14 +8445,14 @@ 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 (TYPE_FIELD_TYPE (var_type, which)),
+      (TYPE_TARGET_TYPE (var_type->field (which).type ()),
        valaddr, address, dval);
-  else if (variant_field_index (TYPE_FIELD_TYPE (var_type, which)) >= 0)
+  else if (variant_field_index (var_type->field (which).type ()) >= 0)
     return
       to_fixed_record_type
-      (TYPE_FIELD_TYPE (var_type, which), valaddr, address, dval);
+      (var_type->field (which).type (), valaddr, address, dval);
   else
-    return TYPE_FIELD_TYPE (var_type, which);
+    return var_type->field (which).type ();
 }
 
 /* Assuming RANGE_TYPE is a TYPE_CODE_RANGE, return nonzero if
@@ -8523,7 +8519,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
   for (i = 0; i < desc_type->num_fields (); i++)
     {
       if (!ada_is_redundant_range_encoding (this_layer->index_type (),
-                                           TYPE_FIELD_TYPE (desc_type, i)))
+                                           desc_type->field (i).type ()))
        return 0;
       this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
     }
@@ -8645,7 +8641,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
       for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
         {
           struct type *range_type =
-            to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, i), dval);
+            to_fixed_range_type (index_type_desc->field (i).type (), dval);
 
           result = create_array_type (alloc_type_copy (elt_type0),
                                       result, range_type);
@@ -8900,7 +8896,7 @@ static_unwrap_type (struct type *type)
 {
   if (ada_is_aligner_type (type))
     {
-      struct type *type1 = TYPE_FIELD_TYPE (ada_check_typedef (type), 0);
+      struct type *type1 = ada_check_typedef (type)->field (0).type ();
       if (ada_type_name (type1) == NULL)
        type1->set_name (ada_type_name (type));
 
@@ -9202,7 +9198,7 @@ ada_get_base_type (struct type *raw_type)
       || real_type_namer->num_fields () != 1)
     return raw_type;
 
-  if (TYPE_FIELD_TYPE (real_type_namer, 0)->code () != TYPE_CODE_REF)
+  if (real_type_namer->field (0).type ()->code () != TYPE_CODE_REF)
     {
       /* This is an older encoding form where the base type needs to be
         looked up by name.  We prefer the newer encoding because it is
@@ -9215,7 +9211,7 @@ ada_get_base_type (struct type *raw_type)
     }
 
   /* The field in our XVS type is a reference to the base type.  */
-  return TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (real_type_namer, 0));
+  return TYPE_TARGET_TYPE (real_type_namer->field (0).type ());
 }
 
 /* The type of value designated by TYPE, with all aligners removed.  */
@@ -9224,7 +9220,7 @@ struct type *
 ada_aligned_type (struct type *type)
 {
   if (ada_is_aligner_type (type))
-    return ada_aligned_type (TYPE_FIELD_TYPE (type, 0));
+    return ada_aligned_type (type->field (0).type ());
   else
     return ada_get_base_type (type);
 }
@@ -9237,7 +9233,7 @@ const gdb_byte *
 ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr)
 {
   if (ada_is_aligner_type (type))
-    return ada_aligned_value_addr (TYPE_FIELD_TYPE (type, 0),
+    return ada_aligned_value_addr (type->field (0).type (),
                                    valaddr +
                                    TYPE_FIELD_BITPOS (type,
                                                       0) / TARGET_CHAR_BIT);
index dfabac3767427d737a8869c773781396eca7d526..785a91c6ed0ba78663273497db6f8c769d2ae347 100644 (file)
@@ -430,7 +430,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
       array_fieldno = ada_get_field_index (type, "P_ARRAY", 0);
       bounds_fieldno = ada_get_field_index (type, "P_BOUNDS", 0);
 
-      bounds_type = TYPE_FIELD_TYPE (type, bounds_fieldno);
+      bounds_type = type->field (bounds_fieldno).type ();
       if (bounds_type->code () == TYPE_CODE_PTR)
         bounds_type = TYPE_TARGET_TYPE (bounds_type);
       if (bounds_type->code () != TYPE_CODE_STRUCT)
index c6056a32106553eff03d3a4fba87db455e260da9..165ea0ee4aa8b28352e3aef54f5c69e69675205c 100644 (file)
@@ -424,7 +424,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
            {
              if (k > 0)
                fprintf_filtered (stream, ", ");
-             print_range_type (TYPE_FIELD_TYPE (range_desc_type, k),
+             print_range_type (range_desc_type->field (k).type (),
                                stream, 0 /* bounds_prefered_p */);
              if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
                bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
@@ -549,7 +549,7 @@ print_variant_clauses (struct type *type, int field_num,
   struct type *var_type, *par_type;
   struct type *discr_type;
 
-  var_type = TYPE_FIELD_TYPE (type, field_num);
+  var_type = type->field (field_num).type ();
   discr_type = ada_variant_discrim_type (var_type, outer_type);
 
   if (var_type->code () == TYPE_CODE_PTR)
@@ -568,7 +568,7 @@ print_variant_clauses (struct type *type, int field_num,
       fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
       if (print_choices (var_type, i, stream, discr_type))
        {
-         if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i),
+         if (print_record_field_types (var_type->field (i).type (),
                                        outer_type, stream, show, level + 4,
                                        flags)
              <= 0)
@@ -594,7 +594,7 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
                    const struct type_print_options *flags)
 {
   const char *variant
-    = ada_variant_discrim_name (TYPE_FIELD_TYPE (type, field_num));
+    = ada_variant_discrim_name (type->field (field_num).type ());
   if (*variant == '\0')
     variant = "?";
 
@@ -633,7 +633,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
       if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i))
        ;
       else if (ada_is_wrapper_field (type, i))
-       flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
+       flds += print_record_field_types (type->field (i).type (), type,
                                          stream, show, level, flags);
       else if (ada_is_variant_part (type, i))
        {
@@ -644,7 +644,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
        {
          flds += 1;
          fprintf_filtered (stream, "\n%*s", level + 4, "");
-         ada_print_type (TYPE_FIELD_TYPE (type, i),
+         ada_print_type (type->field (i).type (),
                          TYPE_FIELD_NAME (type, i),
                          stream, show - 1, level + 4, flags);
          fprintf_filtered (stream, ";");
@@ -708,7 +708,7 @@ print_variant_part (const variant_part &part,
   else
     {
       name = TYPE_FIELD_NAME (type, part.discriminant_index);
-      discr_type = TYPE_FIELD_TYPE (type, part.discriminant_index);
+      discr_type = type->field (part.discriminant_index).type ();
     }
 
   fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", name);
@@ -875,7 +875,7 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
        {
          fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "",
                            level + 12, "");
-         ada_print_type (TYPE_FIELD_TYPE (type, i),
+         ada_print_type (type->field (i).type (),
                          TYPE_FIELD_NAME (type, i),
                          stream, show - 1, level + 12, flags);
          fprintf_filtered (stream, ";");
@@ -920,7 +920,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
              wrap_here ("    ");
            }
          fprintf_filtered (stream, "a%d: ", i + 1);
-         ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0,
+         ada_print_type (type->field (i).type (), "", stream, -1, 0,
                          flags);
        }
       fprintf_filtered (stream, ")");
index d295e55aec646f0c62d2fd1c4ceb91fbd00dee37..a36e7ca793a396e65d421e1dfd43ee8702842eb4 100644 (file)
@@ -542,7 +542,7 @@ print_variant_part (struct value *value, int field_num,
                    const struct language_defn *language)
 {
   struct type *type = value_type (value);
-  struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
+  struct type *var_type = type->field (field_num).type ();
   int which = ada_which_variant_applies (var_type, outer_value);
 
   if (which < 0)
@@ -617,7 +617,7 @@ print_field_values (struct value *value, struct value *outer_value,
          wrap_here (n_spaces (2 + 2 * recurse));
        }
 
-      annotate_field_begin (TYPE_FIELD_TYPE (type, i));
+      annotate_field_begin (type->field (i).type ());
       fprintf_filtered (stream, "%.*s",
                        ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
                        TYPE_FIELD_NAME (type, i));
@@ -641,12 +641,12 @@ print_field_values (struct value *value, struct value *outer_value,
              int bit_size = TYPE_FIELD_BITSIZE (type, i);
              struct value_print_options opts;
 
-             adjust_type_signedness (TYPE_FIELD_TYPE (type, i));
+             adjust_type_signedness (type->field (i).type ());
              v = ada_value_primitive_packed_val
                    (value, nullptr,
                     bit_pos / HOST_CHAR_BIT,
                     bit_pos % HOST_CHAR_BIT,
-                    bit_size, TYPE_FIELD_TYPE (type, i));
+                    bit_size, type->field (i).type ());
              opts = *options;
              opts.deref_ref = 0;
              common_val_print (v, stream, recurse + 1, &opts, language);
index d28beffc9619ad0c4a089a838d891725f3a607f0..f67fe5002a32d4cfbae0e0c7bf68538b6d486e3f 100644 (file)
@@ -105,7 +105,7 @@ ada_varobj_struct_elt (struct value *parent_value,
       type = value_type (value);
     }
   else
-    type = TYPE_FIELD_TYPE (parent_type, fieldno);
+    type = parent_type->field (fieldno).type ();
 
   if (child_value)
     *child_value = value;
index f96a9868259ef521d4041b81d2312bdb097f6beb..0ce9fbc2997313cdeff434d92851766a17dc510f 100644 (file)
@@ -551,7 +551,7 @@ amd64_has_unaligned_fields (struct type *type)
     {
       for (int i = 0; i < type->num_fields (); i++)
        {
-         struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
+         struct type *subtype = check_typedef (type->field (i).type ());
          int bitpos = TYPE_FIELD_BITPOS (type, i);
          int align = type_align(subtype);
 
@@ -587,7 +587,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
                                enum amd64_reg_class theclass[2],
                                unsigned int bitoffset)
 {
-  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
+  struct type *subtype = check_typedef (type->field (i).type ());
   int bitpos = bitoffset + TYPE_FIELD_BITPOS (type, i);
   int pos = bitpos / 64;
   enum amd64_reg_class subclass[2];
index 5c5efe52e6ead56d2284338425c0deac906e25a1..9cedcc8575544be5817c8b58f60e886ec279a066 100644 (file)
@@ -3502,7 +3502,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
            int sub_count = 0;
 
            if (!field_is_static (&t->field (i)))
-             sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
+             sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
                                                      base_type);
            if (sub_count == -1)
              return -1;
@@ -3528,7 +3528,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
        int i;
        for (i = 0; i < t->num_fields (); i++)
          {
-           int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
+           int sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
                                                        base_type);
            if (sub_count == -1)
              return -1;
@@ -7975,7 +7975,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
              enum type_code field_type_code;
 
              field_type_code
-               = check_typedef (TYPE_FIELD_TYPE (type, i))->code ();
+               = check_typedef (type->field (i).type ())->code ();
 
              /* Is it a floating point type field?  */
              if (field_type_code == TYPE_CODE_FLT)
index 54643dd79ba33a22454f47f7fec48c27aa461c16..34e22b289ecec951d329368cb211b853e0ff3c8e 100644 (file)
@@ -1417,7 +1417,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
 {
   /* Is this a bitfield?  */
   if (TYPE_FIELD_PACKED (type, fieldno))
-    gen_bitfield_ref (ax, value, TYPE_FIELD_TYPE (type, fieldno),
+    gen_bitfield_ref (ax, value, type->field (fieldno).type (),
                      (offset * TARGET_CHAR_BIT
                       + TYPE_FIELD_BITPOS (type, fieldno)),
                      (offset * TARGET_CHAR_BIT
@@ -1428,7 +1428,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
       gen_offset (ax, offset
                  + TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
       value->kind = axs_lvalue_memory;
-      value->type = TYPE_FIELD_TYPE (type, fieldno);
+      value->type = type->field (fieldno).type ();
     }
 }
 
@@ -1551,7 +1551,7 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value,
     {
       ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
       value->kind = axs_lvalue_memory;
-      value->type = TYPE_FIELD_TYPE (type, fieldno);
+      value->type = type->field (fieldno).type ();
       value->optimized_out = 0;
     }
   else
index 8eb0d944a75f81ed2886f1290f1b28e430366469..53137e89b85168d4f65ba775f65230471ed3c60a 100644 (file)
@@ -257,11 +257,11 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
       /* If we know the size of the array, we can use it as a limit on
         the number of characters to be fetched.  */
       if (type->num_fields () == 1
-         && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE)
+         && type->field (0).type ()->code () == TYPE_CODE_RANGE)
        {
          LONGEST low_bound, high_bound;
 
-         get_discrete_bounds (TYPE_FIELD_TYPE (type, 0),
+         get_discrete_bounds (type->field (0).type (),
                               &low_bound, &high_bound);
          fetchlimit = high_bound - low_bound + 1;
        }
index 2636a5387cfc973aadbb04f7e3e43ce61d6a63cc..e10a4858a03cc9371f7b7e63dd34a395ec2beb2b 100644 (file)
@@ -573,7 +573,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
          wrap_here ("    ");
        }
 
-      param_type = TYPE_FIELD_TYPE (type, i);
+      param_type = type->field (i).type ();
 
       if (language == language_cplus && linkage_name)
        {
@@ -1179,8 +1179,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
          int newshow = show - 1;
 
          if (!is_static && flags->print_offsets
-             && (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_STRUCT
-                 || TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION))
+             && (type->field (i).type ()->code () == TYPE_CODE_STRUCT
+                 || type->field (i).type ()->code () == TYPE_CODE_UNION))
            {
              /* If we're printing offsets and this field's type is
                 either a struct or an union, then we're interested in
@@ -1200,10 +1200,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
                 the whole struct/union.  */
              local_podata.end_bitpos
                = podata->end_bitpos
-                 - TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)) * TARGET_CHAR_BIT;
+                 - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
            }
 
-         c_print_type_1 (TYPE_FIELD_TYPE (type, i),
+         c_print_type_1 (type->field (i).type (),
                          TYPE_FIELD_NAME (type, i),
                          stream, newshow, level + 4,
                          language, &local_flags, &local_podata);
@@ -1645,7 +1645,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
                print_spaces_filtered (level + 4, stream);
                /* We pass "show" here and not "show - 1" to get enum types
                   printed.  There's no other way to see them.  */
-               c_print_type_1 (TYPE_FIELD_TYPE (type, i),
+               c_print_type_1 (type->field (i).type (),
                                TYPE_FIELD_NAME (type, i),
                                stream, show, level + 4,
                                language, &local_flags, podata);
index 7d5feb3e6bc8d9eac070038c4a903a79f4bf6ecd..eefe6f106bb7ed305a478094ff9fef497e84bbba 100644 (file)
@@ -375,7 +375,7 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
         TYPE_CODE_PTR.)  */
       struct gdbarch *gdbarch = get_type_arch (type);
       int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8;
-      struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET);
+      struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
       const gdb_byte *valaddr = value_contents_for_printing (val);
       CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
 
index 362fd79c89b4fa0a4064f8ed53b97a6eae798cae..6cc76a1e7ac60c4e31571fdf1913ce74ac118bbd 100644 (file)
@@ -348,7 +348,7 @@ c_describe_child (const struct varobj *parent, int index,
          {
            if (cname)
              {
-               if (TYPE_FIELD_TYPE (type, index)->code ()
+               if (type->field (index).type ()->code ()
                    == TYPE_CODE_STRUCT)
                  *cname = ANONYMOUS_STRUCT_NAME;
                else
@@ -380,7 +380,7 @@ c_describe_child (const struct varobj *parent, int index,
          }
 
        if (ctype)
-         *ctype = TYPE_FIELD_TYPE (type, index);
+         *ctype = type->field (index).type ();
       }
       break;
 
@@ -771,10 +771,10 @@ cplus_describe_child (const struct varobj *parent, int index,
            {
              if (cname)
                {
-                 if (TYPE_FIELD_TYPE (type, type_index)->code ()
+                 if (type->field (type_index).type ()->code ()
                      == TYPE_CODE_STRUCT)
                    *cname = ANONYMOUS_STRUCT_NAME;
-                 else if (TYPE_FIELD_TYPE (type, type_index)->code ()
+                 else if (type->field (type_index).type ()->code ()
                           == TYPE_CODE_UNION)
                    *cname = ANONYMOUS_UNION_NAME;
                }
@@ -797,7 +797,7 @@ cplus_describe_child (const struct varobj *parent, int index,
            *cvalue = value_struct_element_index (value, type_index);
 
          if (ctype)
-           *ctype = TYPE_FIELD_TYPE (type, type_index);
+           *ctype = type->field (type_index).type ();
        }
       else if (index < TYPE_N_BASECLASSES (type))
        {
@@ -806,11 +806,11 @@ cplus_describe_child (const struct varobj *parent, int index,
            *cname = TYPE_FIELD_NAME (type, index);
 
          if (cvalue && value)
-           *cvalue = value_cast (TYPE_FIELD_TYPE (type, index), value);
+           *cvalue = value_cast (type->field (index).type (), value);
 
          if (ctype)
            {
-             *ctype = TYPE_FIELD_TYPE (type, index);
+             *ctype = type->field (index).type ();
            }
 
          if (cfull_expression)
index 84148fad895ef6e270210956669cc7a782631304..4ff757acc6aea09db70f23b6bffee2e0ffa2c230 100644 (file)
@@ -529,7 +529,7 @@ generate_vla_size (compile_instance *compiler,
        for (i = 0; i < type->num_fields (); ++i)
          if (!field_is_static (&type->field (i)))
            generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
-                              TYPE_FIELD_TYPE (type, i), sym);
+                              type->field (i).type (), sym);
       }
       break;
     }
index 3cf89fddffcc200d978d8e4238bc2dd845cd1831..aad35887666865dc9980de34700fd3d4984dba1d 100644 (file)
@@ -108,9 +108,9 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
       gcc_type field_type;
       unsigned long bitsize = TYPE_FIELD_BITSIZE (type, i);
 
-      field_type = context->convert_type (TYPE_FIELD_TYPE (type, i));
+      field_type = context->convert_type (type->field (i).type ());
       if (bitsize == 0)
-       bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i));
+       bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
       context->plugin ().build_add_field (result,
                                          TYPE_FIELD_NAME (type, i),
                                          field_type,
@@ -178,7 +178,7 @@ convert_func (compile_c_instance *context, struct type *type)
   array.n_elements = type->num_fields ();
   array.elements = XNEWVEC (gcc_type, type->num_fields ());
   for (i = 0; i < type->num_fields (); ++i)
-    array.elements[i] = context->convert_type (TYPE_FIELD_TYPE (type, i));
+    array.elements[i] = context->convert_type (type->field (i).type ());
 
   result = context->plugin ().build_function_type (return_type,
                                                   &array, is_varargs);
index 20d84a549653d33e6ee743481646ecc1238b3e6e..b04d6c6e4eaaec8c9354b35d8d79cb6275fc6796 100644 (file)
@@ -593,7 +593,7 @@ compile_cplus_convert_struct_or_union_members
        field_name = nullptr;
 
       gcc_type field_type
-       = instance->convert_type (TYPE_FIELD_TYPE (type, i));
+       = instance->convert_type (type->field (i).type ());
 
       if (field_is_static (&type->field (i)))
        {
@@ -648,7 +648,7 @@ compile_cplus_convert_struct_or_union_members
            | get_field_access_flag (type, i);
 
          if (bitsize == 0)
-           bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i));
+           bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
 
          instance->plugin ().build_field
            (field_name, field_type, field_flags, bitsize,
@@ -998,7 +998,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
       else
        {
          array.elements[i - artificials]
-           = instance->convert_type (TYPE_FIELD_TYPE (type, i));
+           = instance->convert_type (type->field (i).type ());
        }
     }
 
index 7f5f5931f210381c26cbcf9860789d90736689c5..2f416079025d44b152440c4632831f316e84bdc2 100644 (file)
@@ -508,7 +508,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
   if (func_type->num_fields () == 0)
     return NULL;
 
-  regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0));
+  regsp_type = check_typedef (func_type->field (0).type ());
   if (regsp_type->code () != TYPE_CODE_PTR)
     error (_("Invalid type code %d of first parameter of function \"%s\" "
             "in compiled module \"%s\"."),
@@ -540,8 +540,8 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
       ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
       ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno);
       ULONGEST reg_offset;
-      struct type *reg_type = check_typedef (TYPE_FIELD_TYPE (regs_type,
-                                                             fieldno));
+      struct type *reg_type
+       = check_typedef (regs_type->field (fieldno).type ());
       ULONGEST reg_size = TYPE_LENGTH (reg_type);
       int regnum;
       struct value *regval;
index d8e285325663767576ab737739380fff44a33d46..a2f39900053255d7f7ad1ebdad94f362fd78422e 100644 (file)
@@ -158,14 +158,14 @@ compile_object_run (struct compile_module *module)
        {
          gdb_assert (regs_addr != 0);
          vargs[current_arg] = value_from_pointer
-                         (TYPE_FIELD_TYPE (func_type, current_arg), regs_addr);
+                         (func_type->field (current_arg).type (), regs_addr);
          ++current_arg;
        }
       if (func_type->num_fields () >= 2)
        {
          gdb_assert (data->out_value_addr != 0);
          vargs[current_arg] = value_from_pointer
-              (TYPE_FIELD_TYPE (func_type, current_arg), data->out_value_addr);
+              (func_type->field (current_arg).type (), data->out_value_addr);
          ++current_arg;
        }
       gdb_assert (current_arg == func_type->num_fields ());
index ad33b98c696812ca553053006603e601bf5d977b..1ec0a0ed4f1f79c8488e0a6e324ab2756fdebd2b 100644 (file)
@@ -1103,10 +1103,10 @@ add_struct_fields (struct type *type, completion_list &output,
                             fieldname, namelen))
                output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i)));
            }
-         else if (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION)
+         else if (type->field (i).type ()->code () == TYPE_CODE_UNION)
            {
              /* Recurse into anonymous unions.  */
-             add_struct_fields (TYPE_FIELD_TYPE (type, i),
+             add_struct_fields (type->field (i).type (),
                                 output, fieldname, namelen);
            }
        }
index 0c79b025bd3a98896cc3cb9c35c4744bb2130436..a02fee6b5524f7ace301787dff0922e67bd6c6cb 100644 (file)
@@ -223,7 +223,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
              wrap_here (n_spaces (2 + 2 * recurse));
            }
 
-         annotate_field_begin (TYPE_FIELD_TYPE (type, i));
+         annotate_field_begin (type->field (i).type ());
 
          if (field_is_static (&type->field (i)))
            {
@@ -301,7 +301,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
                    {
                      struct value *v = value_static_field (type, i);
 
-                     cp_print_static_field (TYPE_FIELD_TYPE (type, i),
+                     cp_print_static_field (type->field (i).type (),
                                             v, stream, recurse + 1,
                                             opts);
                    }
@@ -315,7 +315,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
              else if (i == vptr_fieldno && type == vptr_basetype)
                {
                  int i_offset = TYPE_FIELD_BITPOS (type, i) / 8;
-                 struct type *i_type = TYPE_FIELD_TYPE (type, i);
+                 struct type *i_type = type->field (i).type ();
 
                  if (valprint_check_validity (stream, i_type, i_offset, val))
                    {
@@ -655,11 +655,11 @@ cp_find_class_member (struct type **self_p, int *fieldno,
   for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
     {
       LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
-      LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (self, i));
+      LONGEST bitsize = 8 * TYPE_LENGTH (self->field (i).type ());
 
       if (offset >= bitpos && offset < bitpos + bitsize)
        {
-         *self_p = TYPE_FIELD_TYPE (self, i);
+         *self_p = self->field (i).type ();
          cp_find_class_member (self_p, fieldno, offset - bitpos);
          return;
        }
index 34f8b05a62b438d108b4f3b8d8b35d1fe3cd6d84..1c2ddae6f6d4281b09269755678a401533e6cd1c 100644 (file)
@@ -35,7 +35,7 @@ dynamic_array_type (struct type *type,
                    const struct value_print_options *options)
 {
   if (type->num_fields () == 2
-      && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_INT
+      && type->field (0).type ()->code () == TYPE_CODE_INT
       && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
       && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0
       && !value_bits_any_optimized_out (val,
@@ -52,7 +52,7 @@ dynamic_array_type (struct type *type,
 
       length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
 
-      ptr_type = TYPE_FIELD_TYPE (type, 1);
+      ptr_type = type->field (1).type ();
       elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type));
       addr = unpack_pointer (ptr_type,
                             valaddr + TYPE_FIELD_BITPOS (type, 1) / 8
index f44e4eee84fe0cbb36bc7076ff56ff5faacc7285..97d1771a6295eaf36b4f4e93c13c25e9be287127 100644 (file)
@@ -9418,8 +9418,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type,
 
   variant_part *part = new (obstack) variant_part;
   part->discriminant_index = discriminant_index;
-  part->is_unsigned = TYPE_UNSIGNED (TYPE_FIELD_TYPE (type,
-                                                     discriminant_index));
+  part->is_unsigned = TYPE_UNSIGNED (type->field (discriminant_index).type ());
   part->variants = gdb::array_view<variant> (variants, n_variants);
 
   void *storage = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>));
@@ -9471,7 +9470,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       /* Decode the field name to find the offset of the
         discriminant.  */
       ULONGEST bit_offset = 0;
-      struct type *field_type = TYPE_FIELD_TYPE (type, 0);
+      struct type *field_type = type->field (0).type ();
       while (name[0] >= '0' && name[0] <= '9')
        {
          char *tail;
@@ -9491,7 +9490,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
          ++name;
 
          bit_offset += TYPE_FIELD_BITPOS (field_type, index);
-         field_type = TYPE_FIELD_TYPE (field_type, index);
+         field_type = field_type->field (index).type ();
        }
 
       /* Smash this type to be a structure type.  We have to do this
@@ -9513,8 +9512,8 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
         field at index 1 and the data-less field at index 2.  */
       type->field (1) = saved_field;
       TYPE_FIELD_NAME (type, 1)
-       = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
-      TYPE_FIELD_TYPE (type, 1)->set_name
+       = rust_last_path_segment (type->field (1).type ()->name ());
+      type->field (1).type ()->set_name
        (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
                             TYPE_FIELD_NAME (type, 1)));
 
@@ -9541,7 +9540,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
         because the type has already been recorded.  */
       type->set_code (TYPE_CODE_STRUCT);
 
-      struct type *field_type = TYPE_FIELD_TYPE (type, 0);
+      struct type *field_type = type->field (0).type ();
       const char *variant_name
        = rust_last_path_segment (field_type->name ());
       TYPE_FIELD_NAME (type, 0) = variant_name;
@@ -9554,7 +9553,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       struct type *disr_type = nullptr;
       for (int i = 0; i < type->num_fields (); ++i)
        {
-         disr_type = TYPE_FIELD_TYPE (type, i);
+         disr_type = type->field (i).type ();
 
          if (disr_type->code () != TYPE_CODE_STRUCT)
            {
@@ -9631,7 +9630,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
             That name can be used to look up the correct
             discriminant.  */
          const char *variant_name
-           = rust_last_path_segment (TYPE_FIELD_TYPE (type, i)->name ());
+           = rust_last_path_segment (type->field (i).type ()->name ());
 
          auto iter = discriminant_map.find (variant_name);
          if (iter != discriminant_map.end ())
@@ -9641,7 +9640,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
            }
 
          /* Remove the discriminant field, if it exists.  */
-         struct type *sub_type = TYPE_FIELD_TYPE (type, i);
+         struct type *sub_type = type->field (i).type ();
          if (sub_type->num_fields () > 0)
            {
              sub_type->set_num_fields (sub_type->num_fields () - 1);
@@ -10482,9 +10481,8 @@ dwarf2_compute_name (const char *name,
                     the two cases.  */
                  if (type->num_fields () > 0
                      && TYPE_FIELD_ARTIFICIAL (type, 0)
-                     && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR
-                     && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type,
-                                                                       0))))
+                     && type->field (0).type ()->code () == TYPE_CODE_PTR
+                     && TYPE_CONST (TYPE_TARGET_TYPE (type->field (0).type ())))
                    buf.puts (" const");
                }
            }
@@ -15242,7 +15240,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
              else
                {
                  fnp->fcontext
-                   = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0));
+                   = TYPE_TARGET_TYPE (this_type->field (0).type ());
                }
            }
        }
@@ -15340,7 +15338,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
     return;
 
   /* Find the type of the method.  */
-  pfn_type = TYPE_FIELD_TYPE (type, 0);
+  pfn_type = type->field (0).type ();
   if (pfn_type == NULL
       || pfn_type->code () != TYPE_CODE_PTR
       || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
@@ -15349,11 +15347,11 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
   /* Look for the "this" argument.  */
   pfn_type = TYPE_TARGET_TYPE (pfn_type);
   if (pfn_type->num_fields () == 0
-      /* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */
-      || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR)
+      /* || pfn_type->field (0).type () == NULL */
+      || pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
     return;
 
-  self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
+  self_type = TYPE_TARGET_TYPE (pfn_type->field (0).type ());
   new_type = alloc_type (objfile);
   smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
                        pfn_type->fields (), pfn_type->num_fields (),
index 61f5ba77d833403c7d4dbf8fd04819635b33c924..f975081621635f9382ff0e88d7bc61c56ae0ecc5 100644 (file)
@@ -300,7 +300,7 @@ evaluate_struct_tuple (struct value *struct_val,
        fieldno++;
       if (fieldno >= struct_type->num_fields ())
        error (_("too many initializers"));
-      field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
+      field_type = struct_type->field (fieldno).type ();
       if (field_type->code () == TYPE_CODE_UNION
          && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
        error (_("don't know which variant you want to set"));
@@ -314,7 +314,7 @@ evaluate_struct_tuple (struct value *struct_val,
         subfieldno is the index of the actual real (named inner) field
         in substruct_type.  */
 
-      field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
+      field_type = struct_type->field (fieldno).type ();
       if (val == 0)
        val = evaluate_subexp (field_type, exp, pos, noside);
 
@@ -1059,8 +1059,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
            {
              for (; tem <= nargs && tem <= type->num_fields (); tem++)
                {
-                 argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type,
-                                                                 tem - 1),
+                 argvec[tem] = evaluate_subexp (type->field (tem - 1).type (),
                                                 exp, pos, noside);
                }
            }
index 7057a06ef40417fbe5db940855c1f14f09e36e30..f09a4b1f21bfe2da4df7ce74f30f115b7da1f4c8 100644 (file)
@@ -273,7 +273,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
                  fputs_filtered (", ", stream);
                  wrap_here ("    ");
                }
-             f_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, 0);
+             f_print_type (type->field (i).type (), "", stream, -1, 0, 0);
            }
        fprintf_filtered (stream, ")");
       }
@@ -432,12 +432,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
          fputs_filtered ("\n", stream);
          for (index = 0; index < type->num_fields (); index++)
            {
-             f_type_print_base (TYPE_FIELD_TYPE (type, index), stream,
+             f_type_print_base (type->field (index).type (), stream,
                                 show - 1, level + 4);
              fputs_filtered (" :: ", stream);
              fputs_styled (TYPE_FIELD_NAME (type, index),
                            variable_name_style.style (), stream);
-             f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
+             f_type_print_varspec_suffix (type->field (index).type (),
                                           stream, show - 1, 0, 0, 0, false);
              fputs_filtered ("\n", stream);
            }
index 26646b32ac8553b1501d0b1aee918b13a99e53de..972d1652db72727971a2aabb9d605eb4dfb86a2f 100644 (file)
@@ -317,7 +317,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse,
         {
          struct value *field = value_field (val, index);
 
-         struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index));
+         struct type *field_type = check_typedef (type->field (index).type ());
 
 
          if (field_type->code () != TYPE_CODE_FUNC)
index a94fe8dd84a9c142ac610dc8b45770c274f77e7a..b5a13107ede0425ca22a350718af1fba20637511 100644 (file)
@@ -1771,7 +1771,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
      else if (!t_field_name || *t_field_name == '\0')
        {
          struct_elt elt
-           = lookup_struct_elt (TYPE_FIELD_TYPE (type, i), name, 1);
+           = lookup_struct_elt (type->field (i).type (), name, 1);
          if (elt.field != NULL)
            {
              elt.offset += TYPE_FIELD_BITPOS (type, i);
@@ -2051,7 +2051,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
            if (field_is_static (&type->field (i)))
              continue;
            /* If the field has dynamic type, then so does TYPE.  */
-           if (is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
+           if (is_dynamic_type_internal (type->field (i).type (), 0))
              return 1;
            /* If the field is at a fixed offset, then it is not
               dynamic.  */
@@ -2261,7 +2261,7 @@ resolve_dynamic_union (struct type *type,
       if (field_is_static (&type->field (i)))
        continue;
 
-      t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
+      t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
                                         addr_stack, 0);
       resolved_type->field (i).set_type (t);
       if (TYPE_LENGTH (t) > max_len)
@@ -2358,7 +2358,7 @@ compute_variant_fields_inner (struct type *type,
          LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
          LONGEST size = bitsize / 8;
          if (size == 0)
-           size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, idx));
+           size = TYPE_LENGTH (type->field (idx).type ());
 
          gdb_byte bits[sizeof (ULONGEST)];
          read_memory (addr, bits, size);
@@ -2366,7 +2366,7 @@ compute_variant_fields_inner (struct type *type,
          LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx)
                            % TARGET_CHAR_BIT);
 
-         discr_value = unpack_bits_as_long (TYPE_FIELD_TYPE (type, idx),
+         discr_value = unpack_bits_as_long (type->field (idx).type (),
                                             bits, bitpos, bitsize);
        }
     }
@@ -2479,7 +2479,7 @@ resolve_dynamic_struct (struct type *type,
        {
          struct dwarf2_property_baton baton;
          baton.property_type
-           = lookup_pointer_type (TYPE_FIELD_TYPE (resolved_type, i));
+           = lookup_pointer_type (resolved_type->field (i).type ());
          baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i);
 
          struct dynamic_prop prop;
@@ -2504,7 +2504,7 @@ resolve_dynamic_struct (struct type *type,
        error (_("Cannot determine struct field location"
                 " (invalid location kind)"));
 
-      pinfo.type = check_typedef (TYPE_FIELD_TYPE (resolved_type, i));
+      pinfo.type = check_typedef (resolved_type->field (i).type ());
       pinfo.valaddr = addr_stack->valaddr;
       pinfo.addr
        = (addr_stack->addr
@@ -2512,7 +2512,7 @@ resolve_dynamic_struct (struct type *type,
       pinfo.next = addr_stack;
 
       resolved_type->field (i).set_type
-       (resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
+       (resolve_dynamic_type_internal (resolved_type->field (i).type (),
                                        &pinfo, 0));
       gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
                  == FIELD_LOC_KIND_BITPOS);
@@ -2521,7 +2521,7 @@ resolve_dynamic_struct (struct type *type,
       if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
        new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
       else
-       new_bit_length += (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_type, i))
+       new_bit_length += (TYPE_LENGTH (resolved_type->field (i).type ())
                           * TARGET_CHAR_BIT);
 
       /* Normally, we would use the position and size of the last field
@@ -3403,7 +3403,7 @@ type_align (struct type *type)
            if (!field_is_static (&type->field (i)))
              {
                number_of_non_static_fields++;
-               ULONGEST f_align = type_align (TYPE_FIELD_TYPE (type, i));
+               ULONGEST f_align = type_align (type->field (i).type ());
                if (f_align == 0)
                  {
                    /* Don't pretend we know something we don't.  */
@@ -3552,14 +3552,14 @@ is_scalar_type_recursive (struct type *t)
     }
   /* Are we dealing with a struct with one element?  */
   else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1)
-    return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0));
+    return is_scalar_type_recursive (t->field (0).type ());
   else if (t->code () == TYPE_CODE_UNION)
     {
       int i, n = t->num_fields ();
 
       /* If all elements of the union are scalar, then the union is scalar.  */
       for (i = 0; i < n; i++)
-       if (!is_scalar_type_recursive (TYPE_FIELD_TYPE (t, i)))
+       if (!is_scalar_type_recursive (t->field (i).type ()))
          return 0;
 
       return 1;
@@ -3960,7 +3960,7 @@ types_equal (struct type *a, struct type *b)
        return false;
 
       for (i = 0; i < a->num_fields (); ++i)
-       if (!types_equal (TYPE_FIELD_TYPE (a, i), TYPE_FIELD_TYPE (b, i)))
+       if (!types_equal (a->field (i).type (), b->field (i).type ()))
          return false;
 
       return true;
@@ -4553,8 +4553,8 @@ rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value
     {
       /* Not in C++ */
     case TYPE_CODE_SET:
-      return rank_one_type (TYPE_FIELD_TYPE (parm, 0),
-                           TYPE_FIELD_TYPE (arg, 0), NULL);
+      return rank_one_type (parm->field (0).type (),
+                           arg->field (0).type (), NULL);
     default:
       return INCOMPATIBLE_TYPE_BADNESS;
     }
@@ -5125,16 +5125,16 @@ recursive_dump_type (struct type *type, int spaces)
                          "[%d] bitpos %s bitsize %d type ",
                          idx, plongest (TYPE_FIELD_BITPOS (type, idx)),
                          TYPE_FIELD_BITSIZE (type, idx));
-      gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
+      gdb_print_host_address (type->field (idx).type (), gdb_stdout);
       printf_filtered (" name '%s' (",
                       TYPE_FIELD_NAME (type, idx) != NULL
                       ? TYPE_FIELD_NAME (type, idx)
                       : "<NULL>");
       gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
       printf_filtered (")\n");
-      if (TYPE_FIELD_TYPE (type, idx) != NULL)
+      if (type->field (idx).type () != NULL)
        {
-         recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
+         recursive_dump_type (type->field (idx).type (), spaces + 4);
        }
     }
   if (type->code () == TYPE_CODE_RANGE)
@@ -5320,9 +5320,9 @@ copy_type_recursive (struct objfile *objfile,
          TYPE_FIELD_ARTIFICIAL (new_type, i) = 
            TYPE_FIELD_ARTIFICIAL (type, i);
          TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
-         if (TYPE_FIELD_TYPE (type, i))
+         if (type->field (i).type ())
            new_type->field (i).set_type
-             (copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
+             (copy_type_recursive (objfile, type->field (i).type (),
                                    copied_types));
          if (TYPE_FIELD_NAME (type, i))
            TYPE_FIELD_NAME (new_type, i) = 
index d1132d333280441e6ece2471ea25f205afbfda71..28d42efb7285e1a94ade25a30ab334952bfabcee 100644 (file)
@@ -1598,7 +1598,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
 #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
 #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
 #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
-#define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index)
+#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
 #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
 #define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
@@ -1637,7 +1637,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
 #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
 #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
 
-#define TYPE_FIELD_TYPE(thistype, n) ((thistype)->field (n).type ())
 #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME((thistype)->field (n))
 #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
 #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
index 9238f10986d9eb9f69a86bdc99250a60a60ece5f..9f7dd0ac12f076e7afe592ece43a8e068da778fe 100644 (file)
@@ -312,7 +312,7 @@ vb_match (struct type *type, int index, struct type *basetype)
 
   /* It's a virtual baseclass pointer, now we just need to find out whether
      it is for this baseclass.  */
-  fieldtype = TYPE_FIELD_TYPE (type, index);
+  fieldtype = type->field (index).type ();
   if (fieldtype == NULL
       || fieldtype->code () != TYPE_CODE_PTR)
     /* "Can't happen".  */
@@ -362,7 +362,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
              int field_length;
              CORE_ADDR addr;
 
-             field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
+             field_type = check_typedef (type->field (i).type ());
              field_offset = TYPE_FIELD_BITPOS (type, i) / 8;
              field_length = TYPE_LENGTH (field_type);
 
index 8aa3e68f123906c2c595fc34aab69cf41814d396..23c9c940ca3bde76878096f1e5578e96d6a71ba5 100644 (file)
@@ -182,7 +182,7 @@ vtable_ptrdiff_type (struct gdbarch *gdbarch)
     = (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data);
 
   /* The "offset_to_top" field has the appropriate (ptrdiff_t) type.  */
-  return TYPE_FIELD_TYPE (vtable_type, vtable_field_offset_to_top);
+  return vtable_type->field (vtable_field_offset_to_top).type ();
 }
 
 /* Return the offset from the start of the imaginary `struct
@@ -221,7 +221,7 @@ gnuv3_dynamic_class (struct type *type)
 
   for (fieldnum = 0; fieldnum < TYPE_N_BASECLASSES (type); fieldnum++)
     if (BASETYPE_VIA_VIRTUAL (type, fieldnum)
-       || gnuv3_dynamic_class (TYPE_FIELD_TYPE (type, fieldnum)))
+       || gnuv3_dynamic_class (type->field (fieldnum).type ()))
       {
        TYPE_CPLUS_DYNAMIC (type) = 1;
        return 1;
@@ -467,7 +467,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
     {
       struct dwarf2_property_baton baton;
       baton.property_type
-       = lookup_pointer_type (TYPE_FIELD_TYPE (type, index));
+       = lookup_pointer_type (type->field (index).type ());
       baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (type, index);
 
       struct dynamic_prop prop;
@@ -550,7 +550,7 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset,
        continue;
 
       pos = TYPE_BASECLASS_BITPOS (domain, i) / 8;
-      basetype = TYPE_FIELD_TYPE (domain, i);
+      basetype = domain->field (i).type ();
       /* Recurse with a modified adjustment.  We don't need to adjust
         voffset.  */
       if (adjustment >= pos && adjustment < pos + TYPE_LENGTH (basetype))
@@ -1331,7 +1331,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
 
   /* ...and the second argument should be the same as the class
      type, with the expected type code...  */
-  struct type *arg_type = TYPE_FIELD_TYPE (method_type, 1);
+  struct type *arg_type = method_type->field (1).type ();
 
   if (arg_type->code () != expected)
     return false;
@@ -1345,7 +1345,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
      constructor.  */
   for (int i = 2; i < method_type->num_fields (); i++)
     {
-      arg_type = TYPE_FIELD_TYPE (method_type, i);
+      arg_type = method_type->field (i).type ();
       /* FIXME aktemur/2019-10-31: As of this date, neither
         clang++-7.0.0 nor g++-8.2.0 produce a DW_AT_default_value
         attribute.  GDB is also not set to read this attribute, yet.
@@ -1529,7 +1529,7 @@ gnuv3_pass_by_reference (struct type *type)
   for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++)
     if (!field_is_static (&type->field (fieldnum)))
       {
-       struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);
+       struct type *field_type = type->field (fieldnum).type ();
 
        /* For arrays, make the decision based on the element type.  */
        if (field_type->code () == TYPE_CODE_ARRAY)
index 3975dfcb482ee2c0400e4ce9cfe3b45dc430013e..6a60e1864d979516eaea8a8a5c721a2ac28b6c30 100644 (file)
@@ -75,8 +75,8 @@ gccgo_string_p (struct type *type)
 
   if (type->num_fields () == 2)
     {
-      struct type *type0 = TYPE_FIELD_TYPE (type, 0);
-      struct type *type1 = TYPE_FIELD_TYPE (type, 1);
+      struct type *type0 = type->field (0).type ();
+      struct type *type1 = type->field (1).type ();
 
       type0 = check_typedef (type0);
       type1 = check_typedef (type1);
index 1933e98ed29e3daca53082e9722ee44b4a865eed..df0c029785d5595d8af765a7cb99580a97519364 100644 (file)
@@ -44,7 +44,7 @@ print_go_string (struct type *type,
                 const struct value_print_options *options)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
-  struct type *elt_ptr_type = TYPE_FIELD_TYPE (type, 0);
+  struct type *elt_ptr_type = type->field (0).type ();
   struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
   LONGEST length;
   /* TODO(dje): The encapsulation of what a pointer is belongs in value.c.
index 8f9fc2dcb2e718fb10fccc280ebefafc2145c8bb..88f5757b98bee70dd88040889e92420da03813d3 100644 (file)
@@ -139,7 +139,7 @@ i386_darwin_arg_type_alignment (struct type *type)
       for (i = 0; i < type->num_fields (); i++)
        {
          int align
-           = i386_darwin_arg_type_alignment (TYPE_FIELD_TYPE (type, i));
+           = i386_darwin_arg_type_alignment (type->field (i).type ());
 
          res = std::max (res, align);
        }
index e87d7f363564a42466a6cb747b70b50e9e52d6c3..9b905c1996afdebf6a9df34f8868e714e0c0122d 100644 (file)
@@ -2645,7 +2645,7 @@ i386_16_byte_align_p (struct type *type)
       int i;
       for (i = 0; i < type->num_fields (); i++)
        {
-         if (i386_16_byte_align_p (TYPE_FIELD_TYPE (type, i)))
+         if (i386_16_byte_align_p (type->field (i).type ()))
            return 1;
        }
     }
@@ -2954,7 +2954,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
      double' member are returned in %st(0).  */
   if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
-      type = check_typedef (TYPE_FIELD_TYPE (type, 0));
+      type = check_typedef (type->field (0).type ());
       if (type->code () == TYPE_CODE_FLT)
        return (len == 4 || len == 8 || len == 12);
     }
@@ -3022,7 +3022,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
      here.  */
   if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
-      type = check_typedef (TYPE_FIELD_TYPE (type, 0));
+      type = check_typedef (type->field (0).type ());
       return i386_return_value (gdbarch, function, type, regcache,
                                readbuf, writebuf);
     }
index b2db9bc8310822322e00a8fe02e173beaf4dec54..ae61ed8291cd0e26dfb7abcdc049b84c6f5b941a 100644 (file)
@@ -221,7 +221,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   if (type->code () == TYPE_CODE_METHOD
       && type->num_fields () > 0
       && TYPE_FIELD_ARTIFICIAL (type, 0)
-      && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR)
+      && type->field (0).type ()->code () == TYPE_CODE_PTR)
     thiscall = 1;
 
   return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr,
index 1d1fd2e5f0ee479edfccd2da05442e06d43a03a5..5d68f7fb4ffa0e2a24a947e734ce42f016cb8417 100644 (file)
@@ -3342,7 +3342,7 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
 
        for (i = 0; i < t->num_fields (); i++)
          if (!is_float_or_hfa_type_recurse
-             (check_typedef (TYPE_FIELD_TYPE (t, i)), etp))
+             (check_typedef (t->field (i).type ()), etp))
            return 0;
        return 1;
       }
@@ -3391,7 +3391,7 @@ slot_alignment_is_next_even (struct type *t)
 
        for (i = 0; i < t->num_fields (); i++)
          if (slot_alignment_is_next_even
-             (check_typedef (TYPE_FIELD_TYPE (t, i))))
+             (check_typedef (t->field (i).type ())))
            return 1;
        return 0;
       }
index d211ad88df81ad9e6cd4d3eb4596e84bc8f62a45..cdb30137c3585fcf6c102762af486e86b2098b80 100644 (file)
@@ -1048,7 +1048,7 @@ call_function_by_hand_dummy (struct value *function,
        prototyped = 0;
 
       if (i < ftype->num_fields ())
-       param_type = TYPE_FIELD_TYPE (ftype, i);
+       param_type = ftype->field (i).type ();
       else
        param_type = NULL;
 
index f174ad55823f30a487441d9d5f0ee9b080707037..3e1b74e3b15a41295dfdf73a83015dea5c57ba19 100644 (file)
@@ -222,7 +222,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
            {
              struct value *temp = arg1;
 
-             type = TYPE_FIELD_TYPE (type, 1);
+             type = type->field (1).type ();
              /* i18n: Do not translate the "_m2_high" part!  */
              arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL,
                                       _("unbounded structure "
@@ -250,7 +250,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
       if (m2_is_unbounded_array (type))
        {
          struct value *temp = arg1;
-         type = TYPE_FIELD_TYPE (type, 0);
+         type = type->field (0).type ();
          if (type == NULL || (type->code () != TYPE_CODE_PTR))
            {
              warning (_("internal error: unbounded "
index 6b878ab13cf003779c8408f2699e20e2a8dac459..fe041b48c53d99e0222c3a65b1c0c910d8be6fc4 100644 (file)
@@ -294,7 +294,7 @@ m2_procedure (struct type *type, struct ui_file *stream,
              fputs_filtered (", ", stream);
              wrap_here ("    ");
            }
-         m2_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, flags);
+         m2_print_type (type->field (i).type (), "", stream, -1, 0, flags);
        }
       fprintf_filtered (stream, ") : ");
       if (TYPE_TARGET_TYPE (type) != NULL)
@@ -349,14 +349,14 @@ m2_is_long_set (struct type *type)
       len = type->num_fields ();
       for (i = TYPE_N_BASECLASSES (type); i < len; i++)
        {
-         if (TYPE_FIELD_TYPE (type, i) == NULL)
+         if (type->field (i).type () == NULL)
            return 0;
-         if (TYPE_FIELD_TYPE (type, i)->code () != TYPE_CODE_SET)
+         if (type->field (i).type ()->code () != TYPE_CODE_SET)
            return 0;
          if (TYPE_FIELD_NAME (type, i) != NULL
              && (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
            return 0;
-         range = TYPE_FIELD_TYPE (type, i)->index_type ();
+         range = type->field (i).type ()->index_type ();
          if ((i > TYPE_N_BASECLASSES (type))
              && previous_high + 1 != TYPE_LOW_BOUND (range))
            return 0;
@@ -413,11 +413,11 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
       i = TYPE_N_BASECLASSES (type);
       if (len == 0)
        return 0;
-      range = TYPE_FIELD_TYPE (type, i)->index_type ();
+      range = type->field (i).type ()->index_type ();
       target = TYPE_TARGET_TYPE (range);
 
-      l1 = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
-      h1 = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
+      l1 = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
+      h1 = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
       *of_type = target;
       if (m2_get_discrete_bounds (target, &l2, &h2) >= 0)
        return (l1 == l2 && h1 == h2);
@@ -457,12 +457,12 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
          else
            {
              fprintf_filtered(stream, "[");
-             m2_print_bounds (TYPE_FIELD_TYPE (type, i)->index_type (),
+             m2_print_bounds (type->field (i).type ()->index_type (),
                               stream, show - 1, level, 0);
 
              fprintf_filtered(stream, "..");
 
-             m2_print_bounds (TYPE_FIELD_TYPE (type, len - 1)->index_type (),
+             m2_print_bounds (type->field (len - 1).type ()->index_type (),
                               stream, show - 1, level, 1);
              fprintf_filtered(stream, "]");
            }
@@ -496,7 +496,7 @@ m2_is_unbounded_array (struct type *type)
        return 0;
       if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0)
        return 0;
-      if (TYPE_FIELD_TYPE (type, 0)->code () != TYPE_CODE_PTR)
+      if (type->field (0).type ()->code () != TYPE_CODE_PTR)
        return 0;
       return 1;
     }
@@ -517,7 +517,7 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
       if (show > 0)
        {
          fputs_filtered ("ARRAY OF ", stream);
-         m2_print_type (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
+         m2_print_type (TYPE_TARGET_TYPE (type->field (0).type ()),
                         "", stream, 0, level, flags);
        }
       return 1;
@@ -566,7 +566,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
          fputs_styled (TYPE_FIELD_NAME (type, i),
                        variable_name_style.style (), stream);
          fputs_filtered (" : ", stream);
-         m2_print_type (TYPE_FIELD_TYPE (type, i),
+         m2_print_type (type->field (i).type (),
                         "",
                         stream, 0, level + 4, flags);
          if (TYPE_FIELD_PACKED (type, i))
index 214466b447daff1c7fdece337078b40655627b14..041bc18d3fd853a9b93c4877016d5ee94beca89b 100644 (file)
@@ -55,8 +55,8 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
       i = TYPE_N_BASECLASSES (type);
       if (len == 0)
        return 0;
-      *low = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
-      *high = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
+      *low = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
+      *high = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
       return 1;
     }
   error (_("expecting long_set"));
@@ -86,7 +86,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
   if (get_long_set_bounds (type, &low_bound, &high_bound))
     {
       field = TYPE_N_BASECLASSES (type);
-      range = TYPE_FIELD_TYPE (type, field)->index_type ();
+      range = type->field (field).type ()->index_type ();
     }
   else
     {
@@ -101,7 +101,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
     {
       for (i = low_bound; i <= high_bound; i++)
        {
-         bitval = value_bit_index (TYPE_FIELD_TYPE (type, field),
+         bitval = value_bit_index (type->field (field).type (),
                                    (TYPE_FIELD_BITPOS (type, field) / 8) +
                                    valaddr + embedded_offset, i);
          if (bitval < 0)
@@ -136,7 +136,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
              field++;
              if (field == len)
                break;
-             range = TYPE_FIELD_TYPE (type, field)->index_type ();
+             range = type->field (field).type ()->index_type ();
              if (get_discrete_bounds (range, &field_low, &field_high) < 0)
                break;
              target = TYPE_TARGET_TYPE (range);
@@ -167,11 +167,11 @@ m2_print_unbounded_array (struct value *value,
   struct type *type = check_typedef (value_type (value));
   const gdb_byte *valaddr = value_contents_for_printing (value);
 
-  addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
+  addr = unpack_pointer (type->field (0).type (),
                         (TYPE_FIELD_BITPOS (type, 0) / 8) +
                         valaddr);
 
-  val = value_at_lazy (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
+  val = value_at_lazy (TYPE_TARGET_TYPE (type->field (0).type ()),
                       addr);
   len = unpack_field_as_long (type, valaddr, 1);
 
index 578cfdbf19ac3ff131803f12c49d74f23ce9701b..27870252a360024199eb468c61cd153363fd7280 100644 (file)
@@ -465,7 +465,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
      member, we don't bother to check the member's type here.  */
   if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
-      type = check_typedef (TYPE_FIELD_TYPE (type, 0));
+      type = check_typedef (type->field (0).type ());
       return m68k_svr4_return_value (gdbarch, function, type, regcache,
                                     readbuf, writebuf);
     }
index d700dd8ebd02845d651f06b381326b9278c668c2..e0f04888808d7641f559e2020c166dd2cce4fc5c 100644 (file)
@@ -4408,7 +4408,7 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
               && (typecode == TYPE_CODE_STRUCT
                   || typecode == TYPE_CODE_UNION)
               && arg_type->num_fields () == 1
-              && check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code ()
+              && check_typedef (arg_type->field (0).type ())->code ()
               == TYPE_CODE_FLT))
          && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
 }
@@ -4427,7 +4427,7 @@ mips_type_needs_double_align (struct type *type)
     {
       if (type->num_fields () < 1)
        return 0;
-      return mips_type_needs_double_align (TYPE_FIELD_TYPE (type, 0));
+      return mips_type_needs_double_align (type->field (0).type ());
     }
   else if (typecode == TYPE_CODE_UNION)
     {
@@ -4435,7 +4435,7 @@ mips_type_needs_double_align (struct type *type)
 
       n = type->num_fields ();
       for (i = 0; i < n; i++)
-       if (mips_type_needs_double_align (TYPE_FIELD_TYPE (type, i)))
+       if (mips_type_needs_double_align (type->field (i).type ()))
          return 1;
       return 0;
     }
@@ -4790,7 +4790,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
           || type->code () == TYPE_CODE_UNION)
          && type->num_fields () == 1)
        {
-         struct type *fieldtype = TYPE_FIELD_TYPE (type, 0);
+         struct type *fieldtype = type->field (0).type ();
 
          if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT)
            fp_return_type = 1;
@@ -4865,7 +4865,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
       if (pos > offset)
        return 0;
 
-      field_type = check_typedef (TYPE_FIELD_TYPE (arg_type, i));
+      field_type = check_typedef (arg_type->field (i).type ());
 
       /* If this field is entirely before the requested offset, go
         on to the next one.  */
@@ -5229,12 +5229,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
           && type->num_fields () <= 2
           && type->num_fields () >= 1
           && ((type->num_fields () == 1
-               && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
+               && (check_typedef (type->field (0).type ())->code ()
                    == TYPE_CODE_FLT))
               || (type->num_fields () == 2
-                  && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
+                  && (check_typedef (type->field (0).type ())->code ()
                       == TYPE_CODE_FLT)
-                  && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code ()
+                  && (check_typedef (type->field (1).type ())->code ()
                       == TYPE_CODE_FLT))))
     {
       /* A struct that contains one or two floats.  Each value is part
@@ -5252,7 +5252,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
          if (mips_debug)
            fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
                                offset);
-         if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16)
+         if (TYPE_LENGTH (type->field (field).type ()) == 16)
            {
              /* A 16-byte long double field goes in two consecutive
                 registers.  */
@@ -5270,7 +5270,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
          else
            mips_xfer_register (gdbarch, regcache,
                                gdbarch_num_regs (gdbarch) + regnum,
-                               TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+                               TYPE_LENGTH (type->field (field).type ()),
                                gdbarch_byte_order (gdbarch),
                                readbuf, writebuf, offset);
        }
@@ -5782,12 +5782,12 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
           && type->num_fields () <= 2
           && type->num_fields () >= 1
           && ((type->num_fields () == 1
-               && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
+               && (TYPE_CODE (type->field (0).type ())
                    == TYPE_CODE_FLT))
               || (type->num_fields () == 2
-                  && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
+                  && (TYPE_CODE (type->field (0).type ())
                       == TYPE_CODE_FLT)
-                  && (TYPE_CODE (TYPE_FIELD_TYPE (type, 1))
+                  && (TYPE_CODE (type->field (1).type ())
                       == TYPE_CODE_FLT)))
           && tdep->mips_fpu_type != MIPS_FPU_NONE)
     {
@@ -5806,7 +5806,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
                                offset);
          mips_xfer_register (gdbarch, regcache,
                              gdbarch_num_regs (gdbarch) + regnum,
-                             TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+                             TYPE_LENGTH (type->field (field).type ()),
                              gdbarch_byte_order (gdbarch),
                              readbuf, writebuf, offset);
        }
index 7f81c5985fff53637f9c1095644f498d335bce93..5d960347d21c9a41fdc810fdab5a320ab689ec65 100644 (file)
@@ -109,7 +109,7 @@ mn10300_type_align (struct type *type)
     case TYPE_CODE_UNION:
       for (i = 0; i < type->num_fields (); i++)
        {
-         int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i));
+         int falign = mn10300_type_align (type->field (i).type ());
          while (align < falign)
            align <<= 1;
        }
@@ -144,7 +144,7 @@ mn10300_use_struct_convention (struct type *type)
       /* Structures with a single field are handled as the field
         itself.  */
       if (type->num_fields () == 1)
-       return mn10300_use_struct_convention (TYPE_FIELD_TYPE (type, 0));
+       return mn10300_use_struct_convention (type->field (0).type ());
 
       /* Structures with word or double-word size are passed in memory, as
         long as they require at least word alignment.  */
index d403b71f10b0e9c4ff17f9dfbc2df0ce7485995f..94ac234d3fb20679afcaa86b0b7cc4b1ff447af7 100644 (file)
@@ -1408,7 +1408,7 @@ nds32_check_calling_use_fpr (struct type *type)
       else if (t->num_fields () != 1)
        return 0;
       else
-       t = TYPE_FIELD_TYPE (t, 0);
+       t = t->field (0).type ();
     }
 
   return typecode == TYPE_CODE_FLT;
index 6403e410571656d971faea7f3a6ce1bc17467995..85ef4bd385297a7ee2a31bbff27140f92aae2f6d 100644 (file)
@@ -316,8 +316,9 @@ exp :       exp '['
                              stringsval.ptr = buf;
                              stringsval.length = strlen (arrayname);
                              strcpy (buf, arrayname);
-                             current_type = TYPE_FIELD_TYPE (current_type,
-                               arrayfieldindex - 1);
+                             current_type
+                               = (current_type
+                                  ->field (arrayfieldindex - 1).type ());
                              write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
                              write_exp_string (pstate, stringsval);
                              write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
index 777f1ffe217a2c42325769983a354c86ea2cb599..f3d10d0ec6e5d08199e52cd02581c5f69f123e0b 100644 (file)
@@ -113,11 +113,11 @@ is_pascal_string_type (struct type *type,int *length_pos,
           if (length_pos)
            *length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
           if (length_size)
-           *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
+           *length_size = TYPE_LENGTH (type->field (0).type ());
           if (string_pos)
            *string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
           if (char_type)
-           *char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 1));
+           *char_type = TYPE_TARGET_TYPE (type->field (1).type ());
          if (arrayname)
            *arrayname = TYPE_FIELD_NAME (type, 1);
          return 2;
@@ -133,13 +133,13 @@ is_pascal_string_type (struct type *type,int *length_pos,
          if (length_pos)
            *length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
          if (length_size)
-           *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1));
+           *length_size = TYPE_LENGTH (type->field (1).type ());
          if (string_pos)
            *string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
           /* FIXME: how can I detect wide chars in GPC ??  */
           if (char_type)
            {
-             *char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2));
+             *char_type = TYPE_TARGET_TYPE (type->field (2).type ());
 
              if ((*char_type)->code () == TYPE_CODE_ARRAY)
                *char_type = TYPE_TARGET_TYPE (*char_type);
index edde01b2f37a197eaa8c9976c5825d84bab68b41..75c1e25f5faa110fb809e40cb38e8922a3409580 100644 (file)
@@ -327,7 +327,7 @@ pascal_print_func_args (struct type *type, struct ui_file *stream,
          {
          fprintf_filtered (stream, "var ");
          } */
-      pascal_print_type (TYPE_FIELD_TYPE (type, i), "" /* TYPE_FIELD_NAME
+      pascal_print_type (type->field (i).type (), ""   /* TYPE_FIELD_NAME
                                                           seems invalid!  */
                         ,stream, -1, 0, flags);
     }
@@ -620,7 +620,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
              print_spaces_filtered (level + 4, stream);
              if (field_is_static (&type->field (i)))
                fprintf_filtered (stream, "static ");
-             pascal_print_type (TYPE_FIELD_TYPE (type, i),
+             pascal_print_type (type->field (i).type (),
                                 TYPE_FIELD_NAME (type, i),
                                 stream, show - 1, level + 4, flags);
              if (!field_is_static (&type->field (i))
index 064e81905d0ddc035a03d2875902be145e9c3255..3b1303d1248871214b2610bc74ef54b3a8e838a1 100644 (file)
@@ -305,12 +305,10 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
          /* Extract the address, assume that it is unsigned.  */
          print_address_demangle
            (options, gdbarch,
-            extract_unsigned_integer (valaddr
-                                      + TYPE_FIELD_BITPOS (type,
-                                                           VTBL_FNADDR_OFFSET) / 8,
-                                      TYPE_LENGTH (TYPE_FIELD_TYPE (type,
-                                                                    VTBL_FNADDR_OFFSET)),
-                                      byte_order),
+            extract_unsigned_integer
+              (valaddr + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+               TYPE_LENGTH (type->field (VTBL_FNADDR_OFFSET).type ()),
+               byte_order),
             stream, demangle);
        }
       else
@@ -580,7 +578,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
              wrap_here (n_spaces (2 + 2 * recurse));
            }
 
-         annotate_field_begin (TYPE_FIELD_TYPE (type, i));
+         annotate_field_begin (type->field (i).type ());
 
          if (field_is_static (&type->field (i)))
            {
index 2dc896202dc7f01c556336d3cf8f374ecde2119f..f0f618c5eba5e7e85a442df925bb733d876f362d 100644 (file)
@@ -1146,7 +1146,7 @@ ppc64_aggregate_candidate (struct type *type,
                continue;
 
              sub_count = ppc64_aggregate_candidate
-                          (TYPE_FIELD_TYPE (type, i), field_type);
+                          (type->field (i).type (), field_type);
              if (sub_count == -1)
                return -1;
 
@@ -1498,7 +1498,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
        {
          while (type->code () == TYPE_CODE_STRUCT
                 && type->num_fields () == 1)
-           type = check_typedef (TYPE_FIELD_TYPE (type, 0));
+           type = check_typedef (type->field (0).type ());
 
          if (type->code () == TYPE_CODE_FLT)
            ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
index b871a6d167bb0e006b23ad8993838dcc9d8d0c33..34cb849937cccde436442191d115a394ac3314c0 100644 (file)
@@ -242,10 +242,10 @@ convert_field (struct type *type, int field)
     return NULL;
 
   /* A field can have a NULL type in some situations.  */
-  if (TYPE_FIELD_TYPE (type, field) == NULL)
+  if (type->field (field).type () == NULL)
     arg = gdbpy_ref<>::new_reference (Py_None);
   else
-    arg.reset (type_to_type_object (TYPE_FIELD_TYPE (type, field)));
+    arg.reset (type_to_type_object (type->field (field).type ()));
   if (arg == NULL)
     return NULL;
   if (PyObject_SetAttrString (result.get (), "type", arg.get ()) < 0)
index 0842dcbcb239abdf82c01c3585c542bdd7d51c18..fa43c8d02f2f873d5988bdd9bb85f5ee7d92b246 100644 (file)
@@ -643,13 +643,13 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
   if (regtype->code () == TYPE_CODE_FLT
       || (regtype->code () == TYPE_CODE_UNION
          && regtype->num_fields () == 2
-         && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
-         && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT)
+         && regtype->field (0).type ()->code () == TYPE_CODE_FLT
+         && regtype->field (1).type ()->code () == TYPE_CODE_FLT)
       || (regtype->code () == TYPE_CODE_UNION
          && regtype->num_fields () == 3
-         && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
-         && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT
-         && TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT))
+         && regtype->field (0).type ()->code () == TYPE_CODE_FLT
+         && regtype->field (1).type ()->code () == TYPE_CODE_FLT
+         && regtype->field (2).type ()->code () == TYPE_CODE_FLT))
     {
       struct value_print_options opts;
       const gdb_byte *valaddr = value_contents_for_printing (val);
@@ -2052,7 +2052,7 @@ riscv_struct_info::analyse_inner (struct type *type, int offset)
       if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_BITPOS)
        continue;
 
-      struct type *field_type = TYPE_FIELD_TYPE (type, i);
+      struct type *field_type = type->field (i).type ();
       field_type = check_typedef (field_type);
       int field_offset
        = offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT;
index 20bfbd6bc50f2526d002c61e92a1341fb4ed2a53..449dfca59e9c92f5d959dac4ba6bd9b528406144 100644 (file)
@@ -486,7 +486,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
 
   int variant_fieldno = rust_enum_variant (type);
   val = value_field (val, variant_fieldno);
-  struct type *variant_type = TYPE_FIELD_TYPE (type, variant_fieldno);
+  struct type *variant_type = type->field (variant_fieldno).type ();
 
   int nfields = variant_type->num_fields ();
 
@@ -775,7 +775,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
                          styled_string (variable_name_style.style (),
                                         TYPE_FIELD_NAME (type, i)));
 
-      rust_internal_print_type (TYPE_FIELD_TYPE (type, i), NULL,
+      rust_internal_print_type (type->field (i).type (), NULL,
                                stream, (is_enum ? show : show - 1),
                                level + 2, flags, is_enum, podata);
       if (!for_rust_enum || flags->print_offsets)
@@ -860,7 +860,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
          QUIT;
          if (i > 0)
            fputs_filtered (", ", stream);
-         rust_internal_print_type (TYPE_FIELD_TYPE (type, i), "", stream,
+         rust_internal_print_type (type->field (i).type (), "", stream,
                                    -1, 0, flags, false, podata);
        }
       fputs_filtered (")", stream);
@@ -1015,7 +1015,7 @@ rust_composite_type (struct type *original,
   if (i > 0)
     TYPE_LENGTH (result)
       = (TYPE_FIELD_BITPOS (result, i - 1) / TARGET_CHAR_BIT +
-        TYPE_LENGTH (TYPE_FIELD_TYPE (result, i - 1)));
+        TYPE_LENGTH (result->field (i - 1).type ()));
   return result;
 }
 
@@ -1119,7 +1119,7 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
   if (fn_type->num_fields () == 0)
     error (_("Function '%s' takes no arguments"), name.c_str ());
 
-  if (TYPE_FIELD_TYPE (fn_type, 0)->code () == TYPE_CODE_PTR)
+  if (fn_type->field (0).type ()->code () == TYPE_CODE_PTR)
     args[0] = value_addr (args[0]);
 
   function = address_of_variable (sym.symbol, block);
@@ -1314,7 +1314,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
            {
              if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0)
                {
-                 base_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, i));
+                 base_type = TYPE_TARGET_TYPE (type->field (i).type ());
                  break;
                }
            }
index 0a9b1e8e47a19620fd54ea9afdefb414ccad3d83..1148eeae0e3ba61c4785bb4f2e4be7c39b3ded5c 100644 (file)
@@ -799,7 +799,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                          && i < func_type->num_fields ())
                        {
                          struct type *p_arg_type =
-                           TYPE_FIELD_TYPE (func_type, i);
+                           func_type->field (i).type ();
                          p_arg_size = TYPE_LENGTH (p_arg_type);
                        }
 
index b4f00e46ad4a81ebdfaeee8572dff9cf57648946..90cb0fa312a2bbdd4c51ca14a6ac6ad80b9f3b3e 100644 (file)
@@ -480,7 +480,7 @@ score_type_needs_double_align (struct type *type)
 
       n = type->num_fields ();
       for (i = 0; i < n; i++)
-        if (score_type_needs_double_align (TYPE_FIELD_TYPE (type, i)))
+        if (score_type_needs_double_align (type->field (i).type ()))
           return 1;
       return 0;
     }
index f134cf1c917c73b9fd272500e5c61eacceb91935..7aadf9165ca5755c5a3411be4ef962dba133bc0b 100644 (file)
@@ -832,13 +832,13 @@ sh_use_struct_convention (int renesas_abi, struct type *type)
 
   /* If the first field in the aggregate has the same length as the entire
      aggregate type, the type is returned in registers.  */
-  if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == len)
+  if (TYPE_LENGTH (type->field (0).type ()) == len)
     return 0;
 
   /* If the size of the aggregate is 8 bytes and the first field is
      of size 4 bytes its alignment is equal to long long's alignment,
      so it's returned in registers.  */
-  if (len == 8 && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
+  if (len == 8 && TYPE_LENGTH (type->field (0).type ()) == 4)
     return 0;
 
   /* Otherwise use struct convention.  */
@@ -1050,7 +1050,7 @@ sh_treat_as_flt_p (struct type *type)
     return 0;
   /* Otherwise if the type of that member is float, the whole type is
      treated as float.  */
-  if (TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_FLT)
+  if (type->field (0).type ()->code () == TYPE_CODE_FLT)
     return 1;
   /* Otherwise it's not treated as float.  */
   return 0;
index 5d6ef071099fe5ef97c35c22ca2d8e16919d521f..f4810523dfaae13d2fc8b30532059be7044fe6e1 100644 (file)
@@ -1181,7 +1181,7 @@ sparc64_16_byte_align_p (struct type *type)
 
       for (i = 0; i < type->num_fields (); i++)
        {
-         struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
+         struct type *subtype = check_typedef (type->field (i).type ());
 
          if (sparc64_16_byte_align_p (subtype))
            return 1;
@@ -1258,7 +1258,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
 
       for (i = 0; i < type->num_fields (); i++)
        {
-         struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
+         struct type *subtype = check_typedef (type->field (i).type ());
          int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
 
          sparc64_store_floating_fields (regcache, subtype, valbuf,
@@ -1276,7 +1276,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
          value in %f1 too (we already have stored in %f0).  */
       if (type->num_fields () == 1)
        {
-         struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0));
+         struct type *subtype = check_typedef (type->field (0).type ());
 
          if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4)
            regcache->cooked_write (SPARC_F1_REGNUM, valbuf);
@@ -1346,7 +1346,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
 
       for (i = 0; i < type->num_fields (); i++)
        {
-         struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
+         struct type *subtype = check_typedef (type->field (i).type ());
          int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
 
          sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
index 3d1204e244c972f87abb3d3fd516dc88810d911a..37409d9a21033a67e8b19a6b70498cdfefd5a6ba 100644 (file)
@@ -116,7 +116,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
       return;
     }
 
-  struct type *ftype = check_typedef (TYPE_FIELD_TYPE (type, field_idx));
+  struct type *ftype = check_typedef (type->field (field_idx).type ());
   if (type->code () == TYPE_CODE_UNION)
     {
       /* Since union fields don't have the concept of offsets, we just
index 298613e42c31d35cb179e2e94f6ac75411d0a016..cba662c862d94b4afc316fd08a82b8de182419ac 100644 (file)
@@ -534,7 +534,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
        || type->code () == TYPE_CODE_UNION)
        && type->num_fields () == 1)
     {
-      fld_type = TYPE_FIELD_TYPE (type, 0);
+      fld_type = type->field (0).type ();
       if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
        return 0;
 
@@ -550,12 +550,12 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
      and which contains no arrays of more than two elements -> returned in
      register.  */
   if (type->code () == TYPE_CODE_STRUCT
-      && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0))
-      && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
+      && v850_type_is_scalar (type->field (0).type ())
+      && TYPE_LENGTH (type->field (0).type ()) == 4)
     {
       for (i = 1; i < type->num_fields (); ++i)
         {
-         fld_type = TYPE_FIELD_TYPE (type, 0);
+         fld_type = type->field (0).type ();
          if (fld_type->code () == TYPE_CODE_ARRAY)
            {
              tgt_type = TYPE_TARGET_TYPE (fld_type);
@@ -574,7 +574,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
     {
       for (i = 0; i < type->num_fields (); ++i)
         {
-         fld_type = TYPE_FIELD_TYPE (type, 0);
+         fld_type = type->field (0).type ();
          if (!v850_use_struct_convention (gdbarch, fld_type))
            return 0;
        }
@@ -983,7 +983,7 @@ v850_eight_byte_align_p (struct type *type)
 
       for (i = 0; i < type->num_fields (); i++)
        {
-         if (v850_eight_byte_align_p (TYPE_FIELD_TYPE (type, i)))
+         if (v850_eight_byte_align_p (type->field (i).type ()))
            return 1;
        }
     }
index eb7fd6e54e9ccc85da5edca1ba79884d4ecb6104..afdb429dc37711da3bf90b1099176df00321316c 100644 (file)
@@ -1824,7 +1824,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
        if (t_field_name
            && t_field_name[0] == '\0')
          {
-           struct type *field_type = TYPE_FIELD_TYPE (type, i);
+           struct type *field_type = type->field (i).type ();
 
            if (field_type->code () == TYPE_CODE_UNION
                || field_type->code () == TYPE_CODE_STRUCT)
@@ -2223,7 +2223,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
     {
       if (!field_is_static (&t->field (i))
          && bitpos == TYPE_FIELD_BITPOS (t, i)
-         && types_equal (ftype, TYPE_FIELD_TYPE (t, i)))
+         && types_equal (ftype, t->field (i).type ()))
        return value_primitive_field (*argp, 0, i, t);
     }
 
@@ -2968,8 +2968,7 @@ find_oload_champ (gdb::array_view<value *> args,
            {
              type *t = (methods != NULL
                         ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
-                        : TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
-                                           jj));
+                        : SYMBOL_TYPE (functions[ix])->field (jj).type ());
              parm_types.push_back (t);
            }
        }
@@ -3206,7 +3205,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
   /* Special case: a method taking void.  T1 will contain no
      non-artificial fields, and T2 will contain TYPE_CODE_VOID.  */
   if ((t1->num_fields () - start) == 0 && t2->num_fields () == 1
-      && TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID)
+      && t2->field (0).type ()->code () == TYPE_CODE_VOID)
     return 1;
 
   if ((t1->num_fields () - start) == t2->num_fields ())
@@ -3215,8 +3214,8 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
 
       for (i = 0; i < t2->num_fields (); ++i)
        {
-         if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
-                                           TYPE_FIELD_TYPE (t2, i), NULL),
+         if (compare_ranks (rank_one_type (t1->field (start + i).type (),
+                                           t2->field (i).type (), NULL),
                             EXACT_MATCH_BADNESS) != 0)
            return 0;
        }
@@ -3240,7 +3239,7 @@ get_baseclass_offset (struct type *vt, struct type *cls,
 {
   for (int i = 0; i < TYPE_N_BASECLASSES (vt); i++)
     {
-      struct type *t = TYPE_FIELD_TYPE (vt, i);
+      struct type *t = vt->field (i).type ();
       if (types_equal (t, cls))
         {
           if (BASETYPE_VIA_VIRTUAL (vt, i))
@@ -3311,10 +3310,10 @@ value_struct_elt_for_reference (struct type *domain, int offset,
 
          if (want_address)
            return value_from_longest
-             (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain),
+             (lookup_memberptr_type (t->field (i).type (), domain),
               offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
          else if (noside != EVAL_NORMAL)
-           return allocate_value (TYPE_FIELD_TYPE (t, i));
+           return allocate_value (t->field (i).type ());
          else
            {
              /* Try to evaluate NAME as a qualified name with implicit
index 7051fcef13f68e131d3faa922ec9a4b4605eeb22..d5490898b9be706b79fd536ae21af8c9df2f8c50 100644 (file)
@@ -1139,7 +1139,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
     {
       if (TYPE_FIELD_NAME (type, field)[0] != '\0')
        {
-         struct type *field_type = TYPE_FIELD_TYPE (type, field);
+         struct type *field_type = type->field (field).type ();
 
          if (field_type == bool_type
              /* We require boolean types here to be one bit wide.  This is a
index cb860509f80547c8a32dc1e5dea68b22a1fb59d4..97a099ddbd3eccb06bbf42b7d7fec1f3e5a6d2c8 100644 (file)
@@ -2838,7 +2838,7 @@ value_static_field (struct type *type, int fieldno)
   switch (TYPE_FIELD_LOC_KIND (type, fieldno))
     {
     case FIELD_LOC_KIND_PHYSADDR:
-      retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
+      retval = value_at_lazy (type->field (fieldno).type (),
                              TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
       break;
     case FIELD_LOC_KIND_PHYSNAME:
@@ -2853,7 +2853,7 @@ value_static_field (struct type *type, int fieldno)
             reported as non-debuggable symbols.  */
          struct bound_minimal_symbol msym
            = lookup_minimal_symbol (phys_name, NULL, NULL);
-         struct type *field_type = TYPE_FIELD_TYPE (type, fieldno);
+         struct type *field_type = type->field (fieldno).type ();
 
          if (!msym.minsym)
            retval = allocate_optimized_out_value (field_type);
@@ -2906,7 +2906,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
   int unit_size = gdbarch_addressable_memory_unit_size (arch);
 
   arg_type = check_typedef (arg_type);
-  type = TYPE_FIELD_TYPE (arg_type, fieldno);
+  type = arg_type->field (fieldno).type ();
 
   /* Call check_typedef on our type to make sure that, if TYPE
      is a TYPE_CODE_TYPEDEF, its length is set to the length
@@ -3158,7 +3158,7 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
 {
   int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
   int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
-  struct type *field_type = TYPE_FIELD_TYPE (type, fieldno);
+  struct type *field_type = type->field (fieldno).type ();
   int bit_offset;
 
   gdb_assert (val != NULL);
@@ -3181,7 +3181,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
 {
   int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
   int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
-  struct type *field_type = TYPE_FIELD_TYPE (type, fieldno);
+  struct type *field_type = type->field (fieldno).type ();
 
   return unpack_bits_as_long (field_type, valaddr, bitpos, bitsize);
 }
@@ -3246,7 +3246,7 @@ value_field_bitfield (struct type *type, int fieldno,
 {
   int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
   int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
-  struct value *res_val = allocate_value (TYPE_FIELD_TYPE (type, fieldno));
+  struct value *res_val = allocate_value (type->field (fieldno).type ());
 
   unpack_value_bitfield (res_val, bitpos, bitsize,
                         valaddr, embedded_offset, val);