]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add type::name / type::set_name
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 16 May 2020 16:15:54 +0000 (12:15 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Sat, 16 May 2020 16:36:05 +0000 (12:36 -0400)
Add the `name` and `set_name` methods on `struct type`, in order to
remove the `TYPE_NAME` macro.  In this patch, the `TYPE_NAME` macro is
changed to use `type::name`, so all the call sites that are used to set
the type name are changed to use `type::set_name`.  The next patch will
remove `TYPE_NAME` completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <name, set_name>: New methods.
(TYPE_CODE): Use type::name.  Change all call sites used to set
the name to use type::set_name instead.

21 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/arm-tdep.c
gdb/coffread.c
gdb/csky-tdep.c
gdb/ctfread.c
gdb/dwarf2/read.c
gdb/fbsd-tdep.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/i386-tdep.c
gdb/linux-tdep.c
gdb/mdebugread.c
gdb/opencl-lang.c
gdb/riscv-tdep.c
gdb/rs6000-tdep.c
gdb/rust-lang.c
gdb/stabsread.c
gdb/target-descriptions.c
gdb/windows-tdep.c

index def9db59b83b02b690299249a8a99c91cecf9c06..3f92a6d6c5eeb1592715a648747bd51bf159bece 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-16  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (struct type) <name, set_name>: New methods.
+       (TYPE_CODE): Use type::name.  Change all call sites used to set
+       the name to use type::set_name instead.
+
 2020-05-16  Tom Tromey  <tom@tromey.com>
 
        * top.c (quit_force): Update.
index e5288e2370c9128bed0864253a5b491cb8266170..98488242c8e53d27903f2caf08dc1c2866d0b4d4 100644 (file)
@@ -2144,7 +2144,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
                                   elt_bits);
   create_array_type (new_type, new_elt_type, index_type);
   TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
-  TYPE_NAME (new_type) = ada_type_name (type);
+  new_type->set_name (ada_type_name (type));
 
   if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE
        && is_dynamic_type (check_typedef (index_type)))
@@ -8029,7 +8029,7 @@ empty_record (struct type *templ)
   TYPE_NFIELDS (type) = 0;
   TYPE_FIELDS (type) = NULL;
   INIT_NONE_SPECIFIC (type);
-  TYPE_NAME (type) = "<empty>";
+  type->set_name ("<empty>");
   TYPE_LENGTH (type) = 0;
   return type;
 }
@@ -8087,7 +8087,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
   TYPE_FIELDS (rtype) = (struct field *)
     TYPE_ALLOC (rtype, nfields * sizeof (struct field));
   memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
-  TYPE_NAME (rtype) = ada_type_name (type);
+  rtype->set_name (ada_type_name (type));
   TYPE_FIXED_INSTANCE (rtype) = 1;
 
   off = 0;
@@ -8363,7 +8363,7 @@ template_to_static_fixed_type (struct type *type0)
                TYPE_ALLOC (type, nfields * sizeof (struct field));
              memcpy (TYPE_FIELDS (type), TYPE_FIELDS (type0),
                      sizeof (struct field) * nfields);
-             TYPE_NAME (type) = ada_type_name (type0);
+             type->set_name (ada_type_name (type0));
              TYPE_FIXED_INSTANCE (type) = 1;
              TYPE_LENGTH (type) = 0;
            }
@@ -8412,7 +8412,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
     (struct field *) TYPE_ALLOC (rtype, nfields * sizeof (struct field));
   memcpy (TYPE_FIELDS (rtype), TYPE_FIELDS (type),
           sizeof (struct field) * nfields);
-  TYPE_NAME (rtype) = ada_type_name (type);
+  rtype->set_name (ada_type_name (type));
   TYPE_FIXED_INSTANCE (rtype) = 1;
   TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
 
@@ -8734,7 +8734,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
   /* We want to preserve the type name.  This can be useful when
      trying to get the type name of a value that has already been
      printed (for instance, if the user did "print VAR; whatis $".  */
-  TYPE_NAME (result) = TYPE_NAME (type0);
+  result->set_name (TYPE_NAME (type0));
 
   if (constrained_packed_array_p)
     {
@@ -8978,7 +8978,7 @@ static_unwrap_type (struct type *type)
     {
       struct type *type1 = TYPE_FIELD_TYPE (ada_check_typedef (type), 0);
       if (ada_type_name (type1) == NULL)
-        TYPE_NAME (type1) = ada_type_name (type);
+       type1->set_name (ada_type_name (type));
 
       return static_unwrap_type (type1);
     }
@@ -9420,7 +9420,7 @@ unwrap_value (struct value *val)
       struct type *val_type = ada_check_typedef (value_type (v));
 
       if (ada_type_name (val_type) == NULL)
-        TYPE_NAME (val_type) = ada_type_name (type);
+       val_type->set_name (ada_type_name (type));
 
       return unwrap_value (v);
     }
@@ -11674,7 +11674,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
          to match the size of the base_type, which is not what we want.
          Set it back to the original range type's length.  */
       TYPE_LENGTH (type) = TYPE_LENGTH (raw_type);
-      TYPE_NAME (type) = name;
+      type->set_name (name);
       return type;
     }
 }
@@ -13836,8 +13836,8 @@ ada_language_arch_info (struct gdbarch *gdbarch,
   lai->primitive_type_vector [ada_primitive_type_system_address]
     = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
                                      "void"));
-  TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address])
-    = "system__address";
+  lai->primitive_type_vector [ada_primitive_type_system_address]
+    ->set_name ("system__address");
 
   /* Create the equivalent of the System.Storage_Elements.Storage_Offset
      type.  This is a signed integral type whose size is the same as
index 40bffbb2dd1b23855f7df51672f582f076d618d7..45df1bd39dea5828c7015a8df23f29b4eeaa1832 100644 (file)
@@ -3920,7 +3920,7 @@ arm_neon_double_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "f64", elem);
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "neon_d";
+      t->set_name ("neon_d");
       tdep->neon_double_type = t;
     }
 
@@ -3959,7 +3959,7 @@ arm_neon_quad_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "f64", init_vector_type (elem, 2));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "neon_q";
+      t->set_name ("neon_q");
       tdep->neon_quad_type = t;
     }
 
index 7e3cb4a6fdac6bea698c5a13083eaaf391fd7bca..c08c9de2ff0825380ae96fdf7c24ef00f6291302 100644 (file)
@@ -1469,7 +1469,7 @@ patch_type (struct type *type, struct type *real_type)
         process_coff_symbol.  */
       if (TYPE_NAME (target))
        xfree ((char*) TYPE_NAME (target));
-      TYPE_NAME (target) = xstrdup (TYPE_NAME (real_target));
+      target->set_name (xstrdup (TYPE_NAME (real_target)));
     }
 }
 
@@ -1684,8 +1684,7 @@ process_coff_symbol (struct coff_symbol *cs,
                  ;
                }
              else
-               TYPE_NAME (SYMBOL_TYPE (sym)) =
-                 xstrdup (sym->linkage_name ());
+               SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ()));
            }
 
          /* Keep track of any type which points to empty structured
@@ -1720,7 +1719,7 @@ process_coff_symbol (struct coff_symbol *cs,
            if (sym->linkage_name () != NULL
                && *sym->linkage_name () != '~'
                && *sym->linkage_name () != '.')
-             TYPE_NAME (SYMBOL_TYPE (sym)) = xstrdup (sym->linkage_name ());
+             SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ()));
 
          add_symbol_to_list (sym, get_file_symbols ());
          break;
@@ -1881,7 +1880,7 @@ decode_base_type (struct coff_symbol *cs,
          /* Anonymous structure type.  */
          type = coff_alloc_type (cs->c_symnum);
          type->set_code (TYPE_CODE_STRUCT);
-         TYPE_NAME (type) = NULL;
+         type->set_name (NULL);
          INIT_CPLUS_SPECIFIC (type);
          TYPE_LENGTH (type) = 0;
          TYPE_FIELDS (type) = 0;
@@ -1901,7 +1900,7 @@ decode_base_type (struct coff_symbol *cs,
        {
          /* Anonymous union type.  */
          type = coff_alloc_type (cs->c_symnum);
-         TYPE_NAME (type) = NULL;
+         type->set_name (NULL);
          INIT_CPLUS_SPECIFIC (type);
          TYPE_LENGTH (type) = 0;
          TYPE_FIELDS (type) = 0;
@@ -1923,7 +1922,7 @@ decode_base_type (struct coff_symbol *cs,
          /* Anonymous enum type.  */
          type = coff_alloc_type (cs->c_symnum);
          type->set_code (TYPE_CODE_ENUM);
-         TYPE_NAME (type) = NULL;
+         type->set_name (NULL);
          TYPE_LENGTH (type) = 0;
          TYPE_FIELDS (type) = 0;
          TYPE_NFIELDS (type) = 0;
index 955238bb014a34cf07720ca182812bf3718f5161..7e5b71eece0f497f0c44ed89c522d8e0a8bb1135 100644 (file)
@@ -267,7 +267,7 @@ csky_vector_type (struct gdbarch *gdbarch)
                               init_vector_type (bt->builtin_int8, 16));
 
   TYPE_VECTOR (t) = 1;
-  TYPE_NAME (t) = "builtin_type_vec128i";
+  t->set_name ("builtin_type_vec128i");
 
   return t;
 }
index 74355a019b95afd485b4bc5a349cf9bb973db426..b5bdb5f9cf1eeef3af644b3cfae322b107dd9b32 100644 (file)
@@ -596,7 +596,7 @@ read_structure_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get() ) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   kind = ctf_type_kind (fp, tid);
   if (kind == CTF_K_UNION)
@@ -654,7 +654,7 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get ()) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   type->set_code (TYPE_CODE_FUNC);
   ctf_func_type_info (fp, tid, &cfi);
@@ -680,7 +680,7 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get ()) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   type->set_code (TYPE_CODE_ENUM);
   TYPE_LENGTH (type) = ctf_type_size (fp, tid);
index 245ce07de748b55754f4502f7e250e46ea311ea7..2c81a4eed65bf87e52d8dffadbc2737093c1d291 100644 (file)
@@ -9343,9 +9343,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       TYPE_FIELD (type, 1) = saved_field;
       TYPE_FIELD_NAME (type, 1)
        = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, 1)));
-      TYPE_NAME (TYPE_FIELD_TYPE (type, 1))
-       rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
-                             TYPE_FIELD_NAME (type, 1));
+      TYPE_FIELD_TYPE (type, 1)->set_name
+       (rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+                            TYPE_FIELD_NAME (type, 1)));
 
       const char *dataless_name
        = rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
@@ -9374,9 +9374,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       const char *variant_name
        = rust_last_path_segment (TYPE_NAME (field_type));
       TYPE_FIELD_NAME (type, 0) = variant_name;
-      TYPE_NAME (field_type)
-       rust_fully_qualify (&objfile->objfile_obstack,
-                             TYPE_NAME (type), variant_name);
+      field_type->set_name
+       (rust_fully_qualify (&objfile->objfile_obstack,
+                            TYPE_NAME (type), variant_name));
     }
   else
     {
@@ -9477,9 +9477,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
              ++TYPE_FIELDS (sub_type);
            }
          TYPE_FIELD_NAME (type, i) = variant_name;
-         TYPE_NAME (sub_type)
-           rust_fully_qualify (&objfile->objfile_obstack,
-                                 TYPE_NAME (type), variant_name);
+         sub_type->set_name
+           (rust_fully_qualify (&objfile->objfile_obstack,
+                                TYPE_NAME (type), variant_name));
        }
 
       /* Indicate that this is a variant type.  */
@@ -15356,13 +15356,13 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
          if (get_die_type (die, cu) != NULL)
            return get_die_type (die, cu);
 
-         TYPE_NAME (type) = full_name;
+         type->set_name (full_name);
        }
       else
        {
          /* The name is already allocated along with this objfile, so
             we don't need to duplicate it for the type.  */
-         TYPE_NAME (type) = name;
+         type->set_name (name);
        }
     }
 
@@ -15939,7 +15939,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
   type->set_code (TYPE_CODE_ENUM);
   name = dwarf2_full_name (NULL, die, cu);
   if (name != NULL)
-    TYPE_NAME (type) = name;
+    type->set_name (name);
 
   attr = dwarf2_attr (die, DW_AT_type, cu);
   if (attr != NULL)
@@ -16186,7 +16186,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
 
   name = dwarf2_name (die, cu);
   if (name)
-    TYPE_NAME (type) = name;
+    type->set_name (name);
 
   maybe_set_alignment (cu, die, type);
 
@@ -17757,7 +17757,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
 
   name = dwarf2_name (die, cu);
   if (name)
-    TYPE_NAME (range_type) = name;
+    range_type->set_name (name);
 
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr != nullptr)
@@ -17780,7 +17780,7 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
 
   type = init_type (cu->per_cu->dwarf2_per_objfile->objfile, TYPE_CODE_VOID,0,
                    NULL);
-  TYPE_NAME (type) = dwarf2_name (die, cu);
+  type->set_name (dwarf2_name (die, cu));
 
   /* In Ada, an unspecified type is typically used when the description
      of the type is deferred to a different unit.  When encountering
@@ -20905,7 +20905,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
                       with this objfile, so we don't need to
                       duplicate it for the type.  */
                    if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-                     TYPE_NAME (SYMBOL_TYPE (sym)) = sym->search_name ();
+                     SYMBOL_TYPE (sym)->set_name (sym->search_name ());
                  }
              }
          }
index 5deb251a3acf13ac45cadb4163da3d82738816b7..acf787c706a3abd2e020ae6b559f4c3a9c12f278 100644 (file)
@@ -1629,7 +1629,7 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
 
   /* union sigval */
   sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
-  TYPE_NAME (sigval_type) = xstrdup ("sigval");
+  sigval_type->set_name (xstrdup ("sigval"));
   append_composite_type_field (sigval_type, "sival_int", int_type);
   append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
 
@@ -1679,7 +1679,7 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
 
   /* struct siginfo */
   siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
+  siginfo_type->set_name (xstrdup ("siginfo"));
   append_composite_type_field (siginfo_type, "si_signo", int_type);
   append_composite_type_field (siginfo_type, "si_errno", int_type);
   append_composite_type_field (siginfo_type, "si_code", int_type);
index 8f45af6ae7a0d407258b93f911086bec277f6502..10c44ddbcacc6b6e24feee41de5145d1fbb5eeec 100644 (file)
@@ -3174,7 +3174,7 @@ init_type (struct objfile *objfile, enum type_code code, int bit,
   set_type_code (type, code);
   gdb_assert ((bit % TARGET_CHAR_BIT) == 0);
   TYPE_LENGTH (type) = bit / TARGET_CHAR_BIT;
-  TYPE_NAME (type) = name;
+  type->set_name (name);
 
   return type;
 }
@@ -3307,7 +3307,7 @@ init_complex_type (const char *name, struct type *target_type)
       t = alloc_type_copy (target_type);
       set_type_code (t, TYPE_CODE_COMPLEX);
       TYPE_LENGTH (t) = 2 * TYPE_LENGTH (target_type);
-      TYPE_NAME (t) = name;
+      t->set_name (name);
 
       TYPE_TARGET_TYPE (t) = target_type;
       TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type = t;
@@ -5290,7 +5290,7 @@ copy_type_recursive (struct objfile *objfile,
   TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
 
   if (TYPE_NAME (type))
-    TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
+    new_type->set_name (xstrdup (TYPE_NAME (type)));
 
   TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
   TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
@@ -5443,7 +5443,7 @@ arch_type (struct gdbarch *gdbarch,
   TYPE_LENGTH (type) = bit / TARGET_CHAR_BIT;
 
   if (name)
-    TYPE_NAME (type) = gdbarch_obstack_strdup (gdbarch, name);
+    type->set_name (gdbarch_obstack_strdup (gdbarch, name));
 
   return type;
 }
@@ -5615,7 +5615,7 @@ arch_composite_type (struct gdbarch *gdbarch, const char *name,
 
   gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION);
   t = arch_type (gdbarch, code, 0, NULL);
-  TYPE_NAME (t) = name;
+  t->set_name (name);
   INIT_CPLUS_SPECIFIC (t);
   return t;
 }
index a8cd44a75bf6b1c032c4ea09535e5a75d8443830..aeed06ba5da1fea6e3e30f333ad246f37d49b2da 100644 (file)
@@ -889,6 +889,18 @@ struct type
     this->main_type->code = code;
   }
 
+  /* Get the name of this type.  */
+  const char *name () const
+  {
+    return this->main_type->name;
+  }
+
+  /* Set the name of this type.  */
+  void set_name (const char *name)
+  {
+    this->main_type->name = name;
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@@ -1404,7 +1416,7 @@ extern void allocate_gnat_aux_type (struct type *);
 
 #define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
-#define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name
+#define TYPE_NAME(thistype) ((thistype)->name ())
 #define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
 #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
 #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
index 1fe3a9670cfe44f49e127d5a611b0b8a106571e7..df5818b300ec2e288650eb9357a6e83131a2c36d 100644 (file)
@@ -167,7 +167,7 @@ build_gdb_vtable_type (struct gdbarch *arch)
   t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
   TYPE_NFIELDS (t) = field - field_list;
   TYPE_FIELDS (t) = field_list;
-  TYPE_NAME (t) = "gdb_gnu_v3_abi_vtable";
+  t->set_name ("gdb_gnu_v3_abi_vtable");
   INIT_CPLUS_SPECIFIC (t);
 
   return make_type_with_address_space (t, TYPE_INSTANCE_FLAG_CODE_SPACE);
@@ -1056,7 +1056,7 @@ build_std_type_info_type (struct gdbarch *arch)
   t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
   TYPE_NFIELDS (t) = field - field_list;
   TYPE_FIELDS (t) = field_list;
-  TYPE_NAME (t) = "gdb_gnu_v3_type_info";
+  t->set_name ("gdb_gnu_v3_type_info");
   INIT_CPLUS_SPECIFIC (t);
 
   return t;
index 0f8d9aa7409933b83ea921a8b9743bedfd004fc1..f4fe3a20c708d39a04ae05f437e15b4fd7f2a680 100644 (file)
@@ -3080,7 +3080,7 @@ i386_bnd_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "lbound", bt->builtin_data_ptr);
       append_composite_type_field (t, "ubound", bt->builtin_data_ptr);
 
-      TYPE_NAME (t) = "builtin_type_bound128";
+      t->set_name ("builtin_type_bound128");
       tdep->i386_bnd_type = t;
     }
 
@@ -3133,7 +3133,7 @@ i386_zmm_type (struct gdbarch *gdbarch)
                                   init_vector_type (bt->builtin_int128, 4));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "builtin_type_vec512i";
+      t->set_name ("builtin_type_vec512i");
       tdep->i386_zmm_type = t;
     }
 
@@ -3186,7 +3186,7 @@ i386_ymm_type (struct gdbarch *gdbarch)
                                   init_vector_type (bt->builtin_int128, 2));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "builtin_type_vec256i";
+      t->set_name ("builtin_type_vec256i");
       tdep->i386_ymm_type = t;
     }
 
@@ -3228,7 +3228,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
                                   init_vector_type (bt->builtin_int8, 8));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "builtin_type_vec64i";
+      t->set_name ("builtin_type_vec64i");
       tdep->i386_mmx_type = t;
     }
 
index ed84d6ace6b61b518dde3d9b02bfd2202056b783..0f9559355f15dd4d6874474ab85b6ff36ca6d174 100644 (file)
@@ -258,7 +258,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
 
   /* sival_t */
   sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
-  TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
+  sigval_type->set_name (xstrdup ("sigval_t"));
   append_composite_type_field (sigval_type, "sival_int", int_type);
   append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
 
@@ -352,7 +352,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
 
   /* struct siginfo */
   siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
+  siginfo_type->set_name (xstrdup ("siginfo"));
   append_composite_type_field (siginfo_type, "si_signo", int_type);
   append_composite_type_field (siginfo_type, "si_errno", int_type);
   append_composite_type_field (siginfo_type, "si_code", int_type);
index ba53512636e417dadfb581cf126d1a3a191c67f3..cd08d26bafaef1a6cd2c0c426590afa82308a12b 100644 (file)
@@ -1010,10 +1010,10 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
           (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
           Alpha cc puts out an sh->iss of zero for those.  */
        if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
-         TYPE_NAME (t) = NULL;
+         t->set_name (NULL);
        else
-         TYPE_NAME (t) = obconcat (&mdebugread_objfile->objfile_obstack,
-                                   name, (char *) NULL);
+         t->set_name (obconcat (&mdebugread_objfile->objfile_obstack,
+                                name, (char *) NULL));
 
        t->set_code (type_code);
        TYPE_LENGTH (t) = sh->value;
@@ -1324,7 +1324,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                 for anything except pointers or functions.  */
            }
          else
-           TYPE_NAME (SYMBOL_TYPE (s)) = s->linkage_name ();
+           SYMBOL_TYPE (s)->set_name (s->linkage_name ());
        }
       break;
 
@@ -1674,11 +1674,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          /* Do not set the tag name if it is a compiler generated tag name
             (.Fxx or .xxfake or empty) for unnamed struct/union/enums.  */
          if (name[0] == '.' || name[0] == '\0')
-           TYPE_NAME (tp) = NULL;
+           tp->set_name (NULL);
          else if (TYPE_NAME (tp) == NULL
                   || strcmp (TYPE_NAME (tp), name) != 0)
-           TYPE_NAME (tp)
-             = obstack_strdup (&mdebugread_objfile->objfile_obstack, name);
+           tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
+                                         name));
        }
     }
 
@@ -1713,8 +1713,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
            }
          if (TYPE_NAME (tp) == NULL
              || strcmp (TYPE_NAME (tp), name) != 0)
-           TYPE_NAME (tp)
-             = obstack_strdup (&mdebugread_objfile->objfile_obstack, name);
+           tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
+                                         name));
        }
     }
   if (t->bt == btTypedef)
@@ -4736,7 +4736,7 @@ new_type (char *name)
   struct type *t;
 
   t = alloc_type (mdebugread_objfile);
-  TYPE_NAME (t) = name;
+  t->set_name (name);
   INIT_CPLUS_SPECIFIC (t);
   return t;
 }
index 0cd3501c4d9906c70288b5ea5bdd95b164dc69df..d686c6ea922149b3ff2513bc07f128cbf8c11b82 100644 (file)
@@ -1105,21 +1105,21 @@ build_opencl_types (struct gdbarch *gdbarch)
 #define BUILD_OCL_VTYPES(TYPE)\
   types[opencl_primitive_type_##TYPE##2] \
     = init_vector_type (types[opencl_primitive_type_##TYPE], 2); \
-  TYPE_NAME (types[opencl_primitive_type_##TYPE##2]) = OCL_STRING(TYPE ## 2); \
+  types[opencl_primitive_type_##TYPE##2]->set_name (OCL_STRING(TYPE ## 2)); \
   types[opencl_primitive_type_##TYPE##3] \
     = init_vector_type (types[opencl_primitive_type_##TYPE], 3); \
-  TYPE_NAME (types[opencl_primitive_type_##TYPE##3]) = OCL_STRING(TYPE ## 3); \
+  types[opencl_primitive_type_##TYPE##3]->set_name (OCL_STRING(TYPE ## 3)); \
   TYPE_LENGTH (types[opencl_primitive_type_##TYPE##3]) \
     = 4 * TYPE_LENGTH (types[opencl_primitive_type_##TYPE]); \
   types[opencl_primitive_type_##TYPE##4] \
     = init_vector_type (types[opencl_primitive_type_##TYPE], 4); \
-  TYPE_NAME (types[opencl_primitive_type_##TYPE##4]) = OCL_STRING(TYPE ## 4); \
+  types[opencl_primitive_type_##TYPE##4]->set_name (OCL_STRING(TYPE ## 4)); \
   types[opencl_primitive_type_##TYPE##8] \
     = init_vector_type (types[opencl_primitive_type_##TYPE], 8); \
-  TYPE_NAME (types[opencl_primitive_type_##TYPE##8]) = OCL_STRING(TYPE ## 8); \
+  types[opencl_primitive_type_##TYPE##8]->set_name (OCL_STRING(TYPE ## 8)); \
   types[opencl_primitive_type_##TYPE##16] \
     = init_vector_type (types[opencl_primitive_type_##TYPE], 16); \
-  TYPE_NAME (types[opencl_primitive_type_##TYPE##16]) = OCL_STRING(TYPE ## 16)
+  types[opencl_primitive_type_##TYPE##16]->set_name (OCL_STRING(TYPE ## 16))
 
   types[opencl_primitive_type_char]
     = arch_integer_type (gdbarch, 8, 0, "char");
index c1c466f1a10317702e0f9afe5f2e077d99097e78..e4edd7ca3e81b7a2c6c5f7bf56611d51c28381b8 100644 (file)
@@ -544,7 +544,7 @@ riscv_fpreg_d_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "float", bt->builtin_float);
       append_composite_type_field (t, "double", bt->builtin_double);
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "builtin_type_fpreg_d";
+      t->set_name ("builtin_type_fpreg_d");
       tdep->riscv_fpreg_d_type = t;
     }
 
index 3ccb307ec29f13138391c0dfa773c7070c3cfa34..84278e708e79ccd48c9786ac4156ad4be29b9f95 100644 (file)
@@ -2274,7 +2274,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
                                   init_vector_type (bt->builtin_int8, 8));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "ppc_builtin_type_vec64";
+      t->set_name ("ppc_builtin_type_vec64");
       tdep->ppc_builtin_type_vec64 = t;
     }
 
@@ -2321,7 +2321,7 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
                                   init_vector_type (bt->builtin_int8, 16));
 
       TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "ppc_builtin_type_vec128";
+      t->set_name ("ppc_builtin_type_vec128");
       tdep->ppc_builtin_type_vec128 = t;
     }
 
index b8cc4daab558dbc07186513688193d3aae4f382a..3fa550d769471d70f91e9c127ae0de4ec6cf7fcc 100644 (file)
@@ -982,7 +982,7 @@ rust_composite_type (struct type *original,
     ++nfields;
 
   result->set_code (TYPE_CODE_STRUCT);
-  TYPE_NAME (result) = name;
+  result->set_name (name);
 
   TYPE_NFIELDS (result) = nfields;
   TYPE_FIELDS (result)
index 716b5f3f531d891e303c25c7d095f7be9629f816..12e164c2d228391c0a0bf243cde0c1f7721e59cb 100644 (file)
@@ -1294,12 +1294,10 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
 
              /* Pascal accepts names for pointer types.  */
              if (get_current_subfile ()->language == language_pascal)
-               {
-                 TYPE_NAME (SYMBOL_TYPE (sym)) = sym->linkage_name ();
-               }
+               SYMBOL_TYPE (sym)->set_name (sym->linkage_name ());
            }
          else
-           TYPE_NAME (SYMBOL_TYPE (sym)) = sym->linkage_name ();
+           SYMBOL_TYPE (sym)->set_name (sym->linkage_name ());
        }
 
       add_symbol_to_list (sym, get_file_symbols ());
@@ -1314,12 +1312,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
           SYMBOL_VALUE (struct_sym) = valu;
           SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
           if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-            TYPE_NAME (SYMBOL_TYPE (sym))
-             obconcat (&objfile->objfile_obstack, sym->linkage_name (),
-                         (char *) NULL);
+           SYMBOL_TYPE (sym)->set_name
+             (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
+                        (char *) NULL));
           add_symbol_to_list (struct_sym, get_file_symbols ());
         }
-      
+
       break;
 
     case 'T':
@@ -1341,9 +1339,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
       if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-       TYPE_NAME (SYMBOL_TYPE (sym))
-         obconcat (&objfile->objfile_obstack, sym->linkage_name (),
-                     (char *) NULL);
+       SYMBOL_TYPE (sym)->set_name
+         (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
+                    (char *) NULL));
       add_symbol_to_list (sym, get_file_symbols ());
 
       if (synonym)
@@ -1356,9 +1354,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
          SYMBOL_VALUE (typedef_sym) = valu;
          SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
          if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-           TYPE_NAME (SYMBOL_TYPE (sym))
-             obconcat (&objfile->objfile_obstack, sym->linkage_name (),
-                         (char *) NULL);
+           SYMBOL_TYPE (sym)->set_name
+             (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
+                        (char *) NULL));
          add_symbol_to_list (typedef_sym, get_file_symbols ());
        }
       break;
@@ -1688,7 +1686,7 @@ again:
           type.  */
        type = dbx_alloc_type (typenums, objfile);
        type->set_code (code);
-       TYPE_NAME (type) = type_name;
+       type->set_name (type_name);
        INIT_CPLUS_SPECIFIC (type);
        TYPE_STUB (type) = 1;
 
@@ -1752,7 +1750,7 @@ again:
                "complete_this_type" function, but never create unnecessary
                copies of a type otherwise.  */
            replace_type (type, xtype);
-           TYPE_NAME (type) = NULL;
+           type->set_name (NULL);
          }
        else
          {
index 2ec07a3e3bd62b0db01909cc00565067dffefef0..20a3a640f4f8f0016ee57415c8c32289ecce1614 100644 (file)
@@ -156,7 +156,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 
       type *element_gdb_type = make_gdb_type (m_gdbarch, e->element_type);
       m_type = init_vector_type (element_gdb_type, e->count);
-      TYPE_NAME (m_type) = xstrdup (e->name.c_str ());
+      m_type->set_name (xstrdup (e->name.c_str ()));
       return;
     }
 
@@ -192,7 +192,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
     void make_gdb_type_struct (const tdesc_type_with_fields *e)
     {
       m_type = arch_composite_type (m_gdbarch, NULL, TYPE_CODE_STRUCT);
-      TYPE_NAME (m_type) = xstrdup (e->name.c_str ());
+      m_type->set_name (xstrdup (e->name.c_str ()));
 
       for (const tdesc_type_field &f : e->fields)
        {
@@ -247,7 +247,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
     void make_gdb_type_union (const tdesc_type_with_fields *e)
     {
       m_type = arch_composite_type (m_gdbarch, NULL, TYPE_CODE_UNION);
-      TYPE_NAME (m_type) = xstrdup (e->name.c_str ());
+      m_type->set_name (xstrdup (e->name.c_str ()));
 
       for (const tdesc_type_field &f : e->fields)
        {
index 7772df4c2870f6ab591b9486dfce83199081e773..086038af0d49817061dbd03f4141888c966a63f2 100644 (file)
@@ -230,7 +230,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
   /* list entry */
 
   list_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (list_type) = xstrdup ("list");
+  list_type->set_name (xstrdup ("list"));
 
   module_list_ptr_type = void_ptr_type;
 
@@ -242,7 +242,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
   /* Structured Exception Handler */
 
   seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (seh_type) = xstrdup ("seh");
+  seh_type->set_name (xstrdup ("seh"));
 
   seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
                            TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
@@ -255,7 +255,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
 
   /* struct _PEB_LDR_DATA */
   peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (peb_ldr_type) = xstrdup ("peb_ldr_data");
+  peb_ldr_type->set_name (xstrdup ("peb_ldr_data"));
 
   append_composite_type_field (peb_ldr_type, "length", dword32_type);
   append_composite_type_field (peb_ldr_type, "initialized", dword32_type);
@@ -324,7 +324,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
 
   /* struct process environment block */
   peb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (peb_type) = xstrdup ("peb");
+  peb_type->set_name (xstrdup ("peb"));
 
   /* First bytes contain several flags.  */
   append_composite_type_field (peb_type, "flags", dword_ptr_type);
@@ -343,7 +343,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
 
   /* struct thread information block */
   tib_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
-  TYPE_NAME (tib_type) = xstrdup ("tib");
+  tib_type->set_name (xstrdup ("tib"));
 
   /* uint32_t current_seh;                     %fs:0x0000 */
   append_composite_type_field (tib_type, "current_seh", seh_ptr_type);