]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add field::type / field::set_type
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:04 +0000 (15:26 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:04 +0000 (15:26 -0400)
Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro.  In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.

Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`.  It is not
private per-se, because we can't make `struct field` a non-POD yet, but
it should be considered private anyway (not accessed outside `struct
field`).

gdb/ChangeLog:

* gdbtypes.h (struct field) <type, set_type>: New methods.
Rename `type` field to...
<m_type>: ... this.  Change references throughout to use type or
set_type methods.
(FIELD_TYPE): Use field::type.  Change call sites that modify
the field's type to use field::set_type instead.

Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0

16 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/buildsym.c
gdb/c-typeprint.c
gdb/coffread.c
gdb/ctfread.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/iq2000-tdep.c
gdb/mdebugread.c
gdb/rust-lang.c
gdb/stabsread.c
gdb/valops.c

index 38f9fadf5f9546937ed223d623e9adc37d2d98c1..7d3bcfc4d22d47a5d3e19f9a39a6b0e6aa3404ba 100644 (file)
@@ -1,3 +1,12 @@
+2020-06-08  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (struct field) <type, set_type>: New methods.
+       Rename `type` field to...
+       <m_type>: ... this.  Change references throughout to use type or
+       set_type methods.
+       (FIELD_TYPE): Use field::type.  Change call sites that modify
+       the field's type to use field::set_type instead.
+
 2020-06-08  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (TYPE_INDEX_TYPE): Remove.  Change all call sites
index 4f6c6b465aea3d69a6136966384b4fbd5df0a1bc..20c27c4e8aa09211614b39da6dd364d7451513dd 100644 (file)
@@ -1432,7 +1432,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
      struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
 
      if (raw_type)
-       TYPE_FIELD_TYPE (index_desc_type, i) = raw_type;
+       index_desc_type->field (i).set_type (raw_type);
    }
 }
 
@@ -8088,7 +8088,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
             record size.  */
          ada_ensure_varsize_limit (field_type);
 
-         TYPE_FIELD_TYPE (rtype, f) = field_type;
+         rtype->field (f).set_type (field_type);
           TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
          /* The multiplication can potentially overflow.  But because
             the field length has been size-checked just above, and
@@ -8111,7 +8111,7 @@ 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.  */
-          TYPE_FIELD_TYPE (rtype, f) = TYPE_FIELD_TYPE (type, f);
+          rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f));
           TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
           if (TYPE_FIELD_BITSIZE (type, f) > 0)
             fld_bit_len =
@@ -8173,7 +8173,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
         }
       else
         {
-          TYPE_FIELD_TYPE (rtype, variant_field) = branch_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)) *
@@ -8289,7 +8289,7 @@ template_to_static_fixed_type (struct type *type0)
              TYPE_FIXED_INSTANCE (type) = 1;
              TYPE_LENGTH (type) = 0;
            }
-         TYPE_FIELD_TYPE (type, f) = new_type;
+         type->field (f).set_type (new_type);
          TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (type0, f);
        }
     }
@@ -8358,7 +8358,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
     }
   else
     {
-      TYPE_FIELD_TYPE (rtype, variant_field) = branch_type;
+      rtype->field (variant_field).set_type (branch_type);
       TYPE_FIELD_NAME (rtype, variant_field) = "S";
       TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
       TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
index 33bf6523e905bb2a9f54ab3e7e007c9795fba18c..0c4c3007eaf231d284a03631e426a719b3107a07 100644 (file)
@@ -286,7 +286,7 @@ buildsym_compunit::finish_block_internal
 
                  if (SYMBOL_IS_ARGUMENT (sym))
                    {
-                     TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
+                     ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
                      TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
                      iparams++;
                    }
index 35cfd219edcae6f723d2aa8f01af9a6bcf6568aa..2636a5387cfc973aadbb04f7e3e43ce61d6a63cc 100644 (file)
@@ -302,7 +302,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
          if (FIELD_ARTIFICIAL (arg))
            continue;
 
-         c_print_type (arg.type, "", stream, 0, 0, flags);
+         c_print_type (arg.type (), "", stream, 0, 0, flags);
 
          if (i == nargs && varargs)
            fprintf_filtered (stream, ", ...");
@@ -327,8 +327,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
       struct type *domain;
 
       gdb_assert (nargs > 0);
-      gdb_assert (args[0].type->code () == TYPE_CODE_PTR);
-      domain = TYPE_TARGET_TYPE (args[0].type);
+      gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
+      domain = TYPE_TARGET_TYPE (args[0].type ());
 
       if (TYPE_CONST (domain))
        fprintf_filtered (stream, " const");
index 8b1f040f95f4fa157536fb2ee2504d88fad73239..1592dc645cdb7e07dc64b2f285f43d9ef86fe711 100644 (file)
@@ -2008,8 +2008,8 @@ coff_read_struct_type (int index, int length, int lastsym,
 
          /* Save the data.  */
          list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
-         FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
-                                                 &sub_aux, objfile);
+         list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
+                                            objfile));
          SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
          FIELD_BITSIZE (list->field) = 0;
          nfields++;
@@ -2024,8 +2024,8 @@ coff_read_struct_type (int index, int length, int lastsym,
 
          /* Save the data.  */
          list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
-         FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
-                                                 &sub_aux, objfile);
+         list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
+                                            objfile));
          SET_FIELD_BITPOS (list->field, ms->c_value);
          FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
          nfields++;
index 57a376329385eb6763c4288ea14b4b3dc96db929..e296b133c2f487b9dd1043556c575335100a658c 100644 (file)
@@ -379,7 +379,7 @@ ctf_add_member_cb (const char *name,
   if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
     process_struct_members (ccp, tid, t);
 
-  FIELD_TYPE (*fp) = t;
+  fp->set_type (t);
   SET_FIELD_BITPOS (*fp, offset / TARGET_CHAR_BIT);
   FIELD_BITSIZE (*fp) = get_bitsize (ccp->fp, tid, kind);
 
@@ -401,7 +401,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
 
   fp = &new_field.field;
   FIELD_NAME (*fp) = name;
-  FIELD_TYPE (*fp) = NULL;
+  fp->set_type (NULL);
   SET_FIELD_ENUMVAL (*fp, enum_value);
   FIELD_BITSIZE (*fp) = 0;
 
@@ -1152,9 +1152,9 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
     {
       atyp = get_tid_type (ccp->of, argv[iparam]);
       if (atyp)
-       TYPE_FIELD_TYPE (ftype, iparam) = atyp;
+       ftype->field (iparam).set_type (atyp);
       else
-       TYPE_FIELD_TYPE (ftype, iparam) = void_type;
+       ftype->field (iparam).set_type (void_type);
     }
 
   sym = new_symbol (ccp, ftype, tid);
index 477c382b81b56bb172e0b55c81b186c6dd28235d..52feff0b23d73c54626d046a593524fb919eaa27 100644 (file)
@@ -9504,7 +9504,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
        ((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
 
       /* Put the discriminant at index 0.  */
-      TYPE_FIELD_TYPE (type, 0) = field_type;
+      type->field (0).set_type (field_type);
       TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
       TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
       SET_FIELD_BITPOS (type->field (0), bit_offset);
@@ -9523,7 +9523,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
                              name);
       struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
                                              dataless_name);
-      TYPE_FIELD_TYPE (type, 2) = dataless_type;
+      type->field (2).set_type (dataless_type);
       /* NAME points into the original discriminant name, which
         already has the correct lifetime.  */
       TYPE_FIELD_NAME (type, 2) = name;
@@ -14539,7 +14539,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
       /* Data member other than a C++ static data member.  */
 
       /* Get type of field.  */
-      fp->type = die_type (die, cu);
+      fp->set_type (die_type (die, cu));
 
       SET_FIELD_BITPOS (*fp, 0);
 
@@ -14593,7 +14593,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
                     the bit field must be inferred from the type
                     attribute of the data member containing the
                     bit field.  */
-                 anonymous_size = TYPE_LENGTH (fp->type);
+                 anonymous_size = TYPE_LENGTH (fp->type ());
                }
              SET_FIELD_BITPOS (*fp,
                                (FIELD_BITPOS (*fp)
@@ -14659,7 +14659,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
       /* The name is already allocated along with this objfile, so we don't
         need to duplicate it for the type.  */
       SET_FIELD_PHYSNAME (*fp, physname ? physname : "");
-      FIELD_TYPE (*fp) = die_type (die, cu);
+      fp->set_type (die_type (die, cu));
       FIELD_NAME (*fp) = fieldname;
     }
   else if (die->tag == DW_TAG_inheritance)
@@ -14667,8 +14667,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
       /* C++ base class field.  */
       handle_data_member_location (die, cu, fp);
       FIELD_BITSIZE (*fp) = 0;
-      FIELD_TYPE (*fp) = die_type (die, cu);
-      FIELD_NAME (*fp) = fp->type->name ();
+      fp->set_type (die_type (die, cu));
+      FIELD_NAME (*fp) = fp->type ()->name ();
     }
   else
     gdb_assert_not_reached ("missing case in dwarf2_add_field");
@@ -17227,7 +17227,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
       /* TYPE_FIELD_TYPE must never be NULL.  Pre-fill the array to ensure it
         even if we error out during the parameters reading below.  */
       for (iparams = 0; iparams < nparams; iparams++)
-       TYPE_FIELD_TYPE (ftype, iparams) = void_type;
+       ftype->field (iparams).set_type (void_type);
 
       iparams = 0;
       child_die = die->child;
@@ -17284,7 +17284,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
                                             arg_type, 0);
                }
 
-             TYPE_FIELD_TYPE (ftype, iparams) = arg_type;
+             ftype->field (iparams).set_type (arg_type);
              iparams++;
            }
          child_die = child_die->sibling;
index 6759d228fc89daf7c4303ae6a11eb955bc2a0e50..61f5ba77d833403c7d4dbf8fd04819635b33c924 100644 (file)
@@ -686,7 +686,7 @@ fake_method::fake_method (type_instance_flags flags,
     ((struct field *) xzalloc (sizeof (struct field) * num_types));
 
   while (num_types-- > 0)
-    TYPE_FIELD_TYPE (type, num_types) = param_types[num_types];
+    type->field (num_types).set_type (param_types[num_types]);
 }
 
 fake_method::~fake_method ()
index b2afb186beb42ab9f03ba52e488fbbc1b1b0ef9d..58aae9f137b4e4cc5b3e13f9b85cd558df207141 100644 (file)
@@ -566,7 +566,7 @@ lookup_function_type_with_arguments (struct type *type,
   fn->set_fields
     ((struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
   for (i = 0; i < nparams; ++i)
-    TYPE_FIELD_TYPE (fn, i) = param_types[i];
+    fn->field (i).set_type (param_types[i]);
 
   return fn;
 }
@@ -1405,7 +1405,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
       if (low_bound >= 0)
        TYPE_UNSIGNED (result_type) = 1;
     }
-  TYPE_FIELD_TYPE (result_type, 0) = domain_type;
+  result_type->field (0).set_type (domain_type);
 
   return result_type;
 }
@@ -2263,7 +2263,7 @@ resolve_dynamic_union (struct type *type,
 
       t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
                                         addr_stack, 0);
-      TYPE_FIELD_TYPE (resolved_type, i) = t;
+      resolved_type->field (i).set_type (t);
       if (TYPE_LENGTH (t) > max_len)
        max_len = TYPE_LENGTH (t);
     }
@@ -2511,9 +2511,9 @@ resolve_dynamic_struct (struct type *type,
           + (TYPE_FIELD_BITPOS (resolved_type, i) / TARGET_CHAR_BIT));
       pinfo.next = addr_stack;
 
-      TYPE_FIELD_TYPE (resolved_type, i)
-       resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
-                                        &pinfo, 0);
+      resolved_type->field (i).set_type
+       (resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
+                                       &pinfo, 0));
       gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
                  == FIELD_LOC_KIND_BITPOS);
 
@@ -3011,7 +3011,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
     argcount = 0;
   else
     {
-      argtypes[0].type = lookup_pointer_type (type);
+      argtypes[0].set_type (lookup_pointer_type (type));
       argcount = 1;
     }
 
@@ -3027,8 +3027,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
              if (strncmp (argtypetext, "...", p - argtypetext) != 0
                  && strncmp (argtypetext, "void", p - argtypetext) != 0)
                {
-                 argtypes[argcount].type =
-                   safe_parse_type (gdbarch, argtypetext, p - argtypetext);
+                 argtypes[argcount].set_type
+                   (safe_parse_type (gdbarch, argtypetext, p - argtypetext));
                  argcount += 1;
                }
              argtypetext = p + 1;
@@ -4712,7 +4712,7 @@ print_args (struct field *args, int nargs, int spaces)
        {
          printfi_filtered (spaces, "[%d] name '%s'\n", i,
                            args[i].name != NULL ? args[i].name : "<NULL>");
-         recursive_dump_type (args[i].type, spaces + 2);
+         recursive_dump_type (args[i].type (), spaces + 2);
        }
     }
 }
@@ -5321,9 +5321,9 @@ copy_type_recursive (struct objfile *objfile,
            TYPE_FIELD_ARTIFICIAL (type, i);
          TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
          if (TYPE_FIELD_TYPE (type, i))
-           TYPE_FIELD_TYPE (new_type, i)
-             copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
-                                    copied_types);
+           new_type->field (i).set_type
+             (copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
+                                   copied_types));
          if (TYPE_FIELD_NAME (type, i))
            TYPE_FIELD_NAME (new_type, i) = 
              xstrdup (TYPE_FIELD_NAME (type, i));
@@ -5596,7 +5596,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
   gdb_assert (name != NULL);
 
   TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
-  TYPE_FIELD_TYPE (type, field_nr) = field_type;
+  type->field (field_nr).set_type (field_type);
   SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
   TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
   type->set_num_fields (type->num_fields () + 1);
@@ -5647,7 +5647,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
                             t->num_fields ()));
   f = &t->field (t->num_fields () - 1);
   memset (f, 0, sizeof f[0]);
-  FIELD_TYPE (f[0]) = field;
+  f[0].set_type (field);
   FIELD_NAME (f[0]) = name;
   return f;
 }
index ffb8a616cfbb1eee14751020ceaffad8da10c58b..af5587592a4525b57eb3c570e9415a90fa0ddb13 100644 (file)
@@ -635,6 +635,16 @@ union field_location
 
 struct field
 {
+  struct type *type () const
+  {
+    return this->m_type;
+  }
+
+  void set_type (struct type *type)
+  {
+    this->m_type = type;
+  }
+
   union field_location loc;
 
   /* * For a function or member type, this is 1 if the argument is
@@ -660,7 +670,7 @@ struct field
      - In a function or member type, type of this argument.
      - In an array type, the domain-type of the array.  */
 
-  struct type *type;
+  struct type *m_type;
 
   /* * Name of field, value or argument.
      NULL for range bounds, array domains, and member function
@@ -935,12 +945,12 @@ struct type
 
   type *index_type () const
   {
-    return this->field (0).type;
+    return this->field (0).type ();
   }
 
   void set_index_type (type *index_type)
   {
-    this->field (0).type = index_type;
+    this->field (0).set_type (index_type);
   }
 
   /* * Return the dynamic property of the requested KIND from this type's
@@ -1600,7 +1610,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
   (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
     : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
 
-#define FIELD_TYPE(thisfld) ((thisfld).type)
+#define FIELD_TYPE(thisfld) ((thisfld).type ())
 #define FIELD_NAME(thisfld) ((thisfld).name)
 #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
 #define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
index 255cfd14ea728e411cd333bda33d886f65be76cc..8209d1b653d599b9d32198ce9814a4f4051f0899 100644 (file)
@@ -135,28 +135,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
 
   /* ptrdiff_t vcall_and_vbase_offsets[0]; */
   FIELD_NAME (*field) = "vcall_and_vbase_offsets";
-  FIELD_TYPE (*field) = lookup_array_range_type (ptrdiff_type, 0, -1);
+  field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
 
   /* ptrdiff_t offset_to_top; */
   FIELD_NAME (*field) = "offset_to_top";
-  FIELD_TYPE (*field) = ptrdiff_type;
+  field->set_type (ptrdiff_type);
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
 
   /* void *type_info; */
   FIELD_NAME (*field) = "type_info";
-  FIELD_TYPE (*field) = void_ptr_type;
+  field->set_type (void_ptr_type);
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
 
   /* void (*virtual_functions[0]) (); */
   FIELD_NAME (*field) = "virtual_functions";
-  FIELD_TYPE (*field) = lookup_array_range_type (ptr_to_void_fn_type, 0, -1);
+  field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
@@ -1039,14 +1039,14 @@ build_std_type_info_type (struct gdbarch *arch)
 
   /* The vtable.  */
   FIELD_NAME (*field) = "_vptr.type_info";
-  FIELD_TYPE (*field) = void_ptr_type;
+  field->set_type (void_ptr_type);
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
 
   /* The name.  */
   FIELD_NAME (*field) = "__name";
-  FIELD_TYPE (*field) = char_ptr_type;
+  field->set_type (char_ptr_type);
   SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
   offset += TYPE_LENGTH (FIELD_TYPE (*field));
   field++;
index b35b45ea4c5ebef2e2ad78a6f1bb7bd63d9f525b..cd53ec7bde339746384a7ebe6fb98a50d5abc98a 100644 (file)
@@ -607,7 +607,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
   if (type->num_fields () != 1)
     return 1;
   /* Get field type.  */
-  ftype = type->field (0).type;
+  ftype = type->field (0).type ();
   /* The field type must have size 8, otherwise pass by address.  */
   if (TYPE_LENGTH (ftype) != 8)
     return 1;
index 20fdd40d5083950047e94af3244d414f74ae485a..07613a5b356d7bc012c7cc728585ba5dd7b0025c 100644 (file)
@@ -1051,7 +1051,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                  break;
 
                SET_FIELD_ENUMVAL (*f, tsym.value);
-               FIELD_TYPE (*f) = t;
+               f->set_type (t);
                FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
                FIELD_BITSIZE (*f) = 0;
 
@@ -1198,7 +1198,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
                      if (SYMBOL_IS_ARGUMENT (sym))
                        {
-                         TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
+                         ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
                          TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
                          iparams++;
                        }
@@ -1238,8 +1238,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
        FIELD_NAME (*f) = name;
        SET_FIELD_BITPOS (*f, sh->value);
        bitsize = 0;
-       FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index,
-                                     &bitsize, bigend, name);
+       f->set_type (parse_type (cur_fd, ax, sh->index, &bitsize, bigend,
+                                name));
        FIELD_BITSIZE (*f) = bitsize;
       }
       break;
index 7fe6d3d1eb6472acc12f65018f238fa43e9042e8..20bfbd6bc50f2526d002c61e92a1341fb4ed2a53 100644 (file)
@@ -988,7 +988,7 @@ rust_composite_type (struct type *original,
       bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
 
       FIELD_NAME (*field) = field1;
-      FIELD_TYPE (*field) = type1;
+      field->set_type (type1);
       ++i;
     }
   if (field2 != NULL)
@@ -1008,7 +1008,7 @@ rust_composite_type (struct type *original,
       SET_FIELD_BITPOS (*field, bitpos);
 
       FIELD_NAME (*field) = field2;
-      FIELD_TYPE (*field) = type2;
+      field->set_type (type2);
       ++i;
     }
 
index 179a0fb610bc8f9b2d1330ec924db8b5875f1999..6d581ba862d1eb31a578de7dc32eed27d217d329 100644 (file)
@@ -1007,7 +1007,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
                 FIXME: Do we need a new builtin_promoted_int_arg ?  */
              if (ptype->code () == TYPE_CODE_VOID)
                ptype = objfile_type (objfile)->builtin_int;
-             TYPE_FIELD_TYPE (ftype, nparams) = ptype;
+             ftype->field (nparams).set_type (ptype);
              TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
            }
          ftype->set_num_fields (nparams);
@@ -1849,7 +1849,7 @@ again:
              when we read it, so the list is reversed.  Build the
              fields array right-to-left.  */
           for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
-            TYPE_FIELD_TYPE (func_type, i) = t->type;
+            func_type->field (i).set_type (t->type);
         }
         func_type->set_num_fields (num_args);
         TYPE_PROTOTYPED (func_type) = 1;
@@ -2788,7 +2788,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
          invalid_cpp_abbrev_complaint (*pp);
          return 0;
        }
-      fip->list->field.type = read_type (pp, objfile);
+      fip->list->field.set_type (read_type (pp, objfile));
       if (**pp == ',')
        (*pp)++;                /* Skip the comma.  */
       else
@@ -2840,7 +2840,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
       fip->list->visibility = VISIBILITY_PUBLIC;
     }
 
-  fip->list->field.type = read_type (pp, objfile);
+  fip->list->field.set_type (read_type (pp, objfile));
   if (**pp == ':')
     {
       p = ++(*pp);
@@ -3161,8 +3161,8 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
          base class.  Read it, and remember it's type name as this
          field's name.  */
 
-      newobj->field.type = read_type (pp, objfile);
-      newobj->field.name = newobj->field.type->name ();
+      newobj->field.set_type (read_type (pp, objfile));
+      newobj->field.name = newobj->field.type ()->name ();
 
       /* Skip trailing ';' and bump count of number of fields seen.  */
       if (**pp == ';')
@@ -4242,7 +4242,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
 
   rval = XCNEWVEC (struct field, n);
   for (i = 0; i < n; i++)
-    rval[i].type = types[i];
+    rval[i].set_type (types[i]);
   *nargsp = n;
   return rval;
 }
index 2bc58ca4652a2d1af8ca4ae99b7251043b81fa23..eb7fd6e54e9ccc85da5edca1ba79884d4ecb6104 100644 (file)
@@ -1707,7 +1707,7 @@ typecmp (int staticp, int varargs, int nargs,
     t2 ++;
 
   for (i = 0;
-       (i < nargs) && t1[i].type->code () != TYPE_CODE_VOID;
+       (i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID;
        i++)
     {
       struct type *tt1, *tt2;
@@ -1715,7 +1715,7 @@ typecmp (int staticp, int varargs, int nargs,
       if (!t2[i])
        return i + 1;
 
-      tt1 = check_typedef (t1[i].type);
+      tt1 = check_typedef (t1[i].type ());
       tt2 = check_typedef (value_type (t2[i]));
 
       if (TYPE_IS_REFERENCE (tt1)
@@ -1754,7 +1754,7 @@ typecmp (int staticp, int varargs, int nargs,
       /* We should be doing much hairier argument matching (see
          section 13.2 of the ARM), but as a quick kludge, just check
          for the same type code.  */
-      if (t1[i].type->code () != value_type (t2[i])->code ())
+      if (t1[i].type ()->code () != value_type (t2[i])->code ())
        return i + 1;
     }
   if (varargs || t2[i] == NULL)
@@ -2967,7 +2967,7 @@ find_oload_champ (gdb::array_view<value *> args,
          for (jj = 0; jj < nparms; jj++)
            {
              type *t = (methods != NULL
-                        ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type)
+                        ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
                         : TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
                                            jj));
              parm_types.push_back (t);