+2020-05-16  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (TYPE_NAME): Remove.  Change all cal sites to use
+       type::name instead.
+
 2020-05-16  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (struct type) <name, set_name>: New methods.
 
 
   if (!maybe_missing)
     error (_("Unable to find field %s in struct %s.  Aborting"),
-           field_name, TYPE_NAME (struct_type));
+           field_name, struct_type->name ());
 
   return -1;
 }
      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_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)) != NULL
-      && strcmp (TYPE_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)),
+  if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL
+      && strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (),
                  TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
     return;
 
                               SYMBOL_LINE (syms[i].symbol));
            }
           else if (is_enumeral
-                   && TYPE_NAME (SYMBOL_TYPE (syms[i].symbol)) != NULL)
+                   && SYMBOL_TYPE (syms[i].symbol)->name () != NULL)
             {
               printf_filtered (("[%d] "), i + first_choice);
               ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
      So, to extract the scope, we search for the "___XR" extension,
      and then backtrack until we find the first "__".  */
 
-  const char *name = TYPE_NAME (renaming_type);
+  const char *name = renaming_type->name ();
   const char *suffix = strstr (name, "___XR");
   const char *last;
 
   if (type->code () != TYPE_CODE_PTR)
     return 0;
 
-  name = TYPE_NAME (TYPE_TARGET_TYPE (type));
+  name = TYPE_TARGET_TYPE (type)->name ();
   if (name == NULL)
     return 0;
 
 static int
 ada_is_interface_tag (struct type *type)
 {
-  const char *name = TYPE_NAME (type);
+  const char *name = type->name ();
 
   if (name == NULL)
     return 0;
     return 1;
   else if (type0->code () == TYPE_CODE_VOID)
     return 0;
-  else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL)
+  else if (type1->name () == NULL && type0->name () != NULL)
     return 1;
   else if (ada_is_constrained_packed_array_type (type0))
     return 1;
     return 1;
   else
     {
-      const char *type0_name = TYPE_NAME (type0);
-      const char *type1_name = TYPE_NAME (type1);
+      const char *type0_name = type0->name ();
+      const char *type1_name = type1->name ();
 
       if (type0_name != NULL && strstr (type0_name, "___XR") != NULL
          && (type1_name == NULL || strstr (type1_name, "___XR") == NULL))
 {
   if (type == NULL)
     return NULL;
-  return TYPE_NAME (type);
+  return type->name ();
 }
 
 /* Search the list of "descriptive" types associated to TYPE for a type
      the current RTYPE length might be good enough for our purposes.  */
   if (TYPE_LENGTH (type) <= 0)
     {
-      if (TYPE_NAME (rtype))
+      if (rtype->name ())
        warning (_("Invalid type size for `%s' detected: %s."),
-                TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type)));
+                rtype->name (), pulongest (TYPE_LENGTH (type)));
       else
        warning (_("Invalid type size for <unnamed> detected: %s."),
                 pulongest (TYPE_LENGTH (type)));
   if (is_dynamic_type (range_type))
     return 0;
 
-  if (TYPE_NAME (encoding_type) == NULL)
+  if (encoding_type->name () == NULL)
     return 0;
 
-  bounds_str = strstr (TYPE_NAME (encoding_type), "___XDLU_");
+  bounds_str = strstr (encoding_type->name (), "___XDLU_");
   if (bounds_str == NULL)
     return 0;
 
   /* 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 $".  */
-  result->set_name (TYPE_NAME (type0));
+  result->set_name (type0->name ());
 
   if (constrained_packed_array_p)
     {
   type = check_typedef (type);
   if (type == NULL || type->code () != TYPE_CODE_ENUM
       || !TYPE_STUB (type)
-      || TYPE_NAME (type) == NULL)
+      || type->name () == NULL)
     return type;
   else
     {
-      const char *name = TYPE_NAME (type);
+      const char *name = type->name ();
       struct type *type1 = ada_find_any_type (name);
 
       if (type1 == NULL)
 int
 ada_is_system_address_type (struct type *type)
 {
-  return (TYPE_NAME (type)
-          && strcmp (TYPE_NAME (type), "system__address") == 0);
+  return (type->name () && strcmp (type->name (), "system__address") == 0);
 }
 
 /* Assuming that TYPE is the representation of an Ada fixed-point
   const char *subtype_info;
 
   gdb_assert (raw_type != NULL);
-  gdb_assert (TYPE_NAME (raw_type) != NULL);
+  gdb_assert (raw_type->name () != NULL);
 
   if (raw_type->code () == TYPE_CODE_RANGE)
     base_type = TYPE_TARGET_TYPE (raw_type);
   else
     base_type = raw_type;
 
-  name = TYPE_NAME (raw_type);
+  name = raw_type->name ();
   subtype_info = strstr (name, "___XD");
   if (subtype_info == NULL)
     {
 static int
 ada_is_exception_sym (struct symbol *sym)
 {
-  const char *type_name = TYPE_NAME (SYMBOL_TYPE (sym));
+  const char *type_name = SYMBOL_TYPE (sym)->name ();
 
   return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
           && SYMBOL_CLASS (sym) != LOC_BLOCK
 
       break;
     default:
       fprintf_filtered (stream, "%.*s",
-                       ada_name_prefix_len (TYPE_NAME (type)),
-                       TYPE_NAME (type));
+                       ada_name_prefix_len (type->name ()),
+                       type->name ());
       break;
     }
 }
   const char *subtype_info;
 
   gdb_assert (raw_type != NULL);
-  name = TYPE_NAME (raw_type);
+  name = raw_type->name ();
   gdb_assert (name != NULL);
 
   if (raw_type->code () == TYPE_CODE_RANGE)
 
         type.  Error out and give callers a chance to handle the failure
         gracefully.  */
       error (_("gen_fetch: Unsupported type code `%s'."),
-            TYPE_NAME (type));
+            type->name ());
     }
 }
 
   
   if (!found)
     error (_("Couldn't find member named `%s' in struct/union/class `%s'"),
-          field, TYPE_NAME (type));
+          field, type->name ());
 }
 
 static int
 
   if (!found)
     error (_("No symbol \"%s\" in namespace \"%s\"."), 
-          name, TYPE_NAME (curtype));
+          name, curtype->name ());
 
   return found;
 }
 gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
                         const struct type *curtype, char *name)
 {
-  const char *namespace_name = TYPE_NAME (curtype);
+  const char *namespace_name = curtype->name ();
   struct block_symbol sym;
 
   sym = cp_lookup_symbol_namespace (namespace_name, name,
            if (type->code () != TYPE_CODE_ARRAY
                && type->code () != TYPE_CODE_PTR)
              {
-               if (TYPE_NAME (type))
+               if (type->name ())
                  error (_("cannot subscript something of type `%s'"),
-                        TYPE_NAME (type));
+                        type->name ());
                else
                  error (_("cannot subscript requested type"));
              }
 
                                                0); }
        |       UNSIGNED type_name
                        { $$ = lookup_unsigned_typename (pstate->language (),
-                                                        TYPE_NAME($2.type)); }
+                                                        $2.type->name ()); }
        |       UNSIGNED
                        { $$ = lookup_unsigned_typename (pstate->language (),
                                                         "int"); }
        |       SIGNED_KEYWORD type_name
                        { $$ = lookup_signed_typename (pstate->language (),
-                                                      TYPE_NAME($2.type)); }
+                                                      $2.type->name ()); }
        |       SIGNED_KEYWORD
                        { $$ = lookup_signed_typename (pstate->language (),
                                                       "int"); }
 
      that would do the wrong thing.  */
   while (elttype)
     {
-      const char *name = TYPE_NAME (elttype);
+      const char *name = elttype->name ();
 
       if (elttype->code () == TYPE_CODE_CHAR || !name)
        {
 
       if ((varstring != NULL && *varstring != '\0')
          /* Need a space if going to print stars or brackets;
             but not if we will print just a type name.  */
-         || ((show > 0 || TYPE_NAME (type) == 0)
+         || ((show > 0 || type->name () == 0)
              && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
                  || code == TYPE_CODE_METHOD
                  || (code == TYPE_CODE_ARRAY
   type = check_typedef (type);
   fprintf_filtered (stream, "typedef ");
   type_print (type, "", stream, -1);
-  if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
-      || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
+  if ((SYMBOL_TYPE (new_symbol))->name () == 0
+      || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
                 new_symbol->linkage_name ()) != 0
       || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF)
     fprintf_filtered (stream, " %s", new_symbol->print_name ());
                        ? "public" : (TYPE_FIELD_PROTECTED (type, i)
                                      ? "protected" : "private"),
                        BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
-      name = TYPE_NAME (TYPE_BASECLASS (type, i));
+      name = TYPE_BASECLASS (type, i)->name ();
       if (name)
        print_name_maybe_canonical (name, flags, stream);
       else
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
     case TYPE_CODE_MEMBERPTR:
       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
                                   stream, show, 0, 0, language, flags, podata);
-      name = TYPE_NAME (TYPE_SELF_TYPE (type));
+      name = TYPE_SELF_TYPE (type)->name ();
       if (name)
        print_name_maybe_canonical (name, flags, stream);
       else
                                   stream, show, 0, 0, language, flags,
                                   podata);
       fprintf_filtered (stream, "(");
-      name = TYPE_NAME (TYPE_SELF_TYPE (type));
+      name = TYPE_SELF_TYPE (type)->name ();
       if (name)
        print_name_maybe_canonical (name, flags, stream);
       else
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
      spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
      enum}" tag for unnamed struct/union/enum's, which we don't
      want to print.  */
-  if (TYPE_NAME (type) != NULL
-      && !startswith (TYPE_NAME (type), "{unnamed"))
+  if (type->name () != NULL
+      && !startswith (type->name (), "{unnamed"))
     {
       /* When printing the tag name, we are still effectively
         printing in the outer context, hence the use of FLAGS
         here.  */
-      print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+      print_name_maybe_canonical (type->name (), flags, stream);
       if (show > 0)
        fputs_filtered (" ", stream);
     }
     {
       /* If we just printed a tag name, no need to print anything
         else.  */
-      if (TYPE_NAME (type) == NULL)
+      if (type->name () == NULL)
        fprintf_filtered (stream, "{...}");
     }
-  else if (show > 0 || TYPE_NAME (type) == NULL)
+  else if (show > 0 || type->name () == NULL)
     {
       struct type *basetype;
       int vptr_fieldno;
          struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
          int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
          const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
-         const char *name = TYPE_NAME (type);
+         const char *name = type->name ();
          int is_constructor = name && strcmp (method_name,
                                               name) == 0;
 
      always just print the type name directly from the type.  */
 
   if (show <= 0
-      && TYPE_NAME (type) != NULL)
+      && type->name () != NULL)
     {
       c_type_print_modifier (type, stream, 0, 1, language);
 
            fprintf_filtered (stream, "enum ");
        }
 
-      print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+      print_name_maybe_canonical (type->name (), flags, stream);
       return;
     }
 
     case TYPE_CODE_TYPEDEF:
       /* If we get here, the typedef doesn't have a name, and we
         couldn't resolve TYPE_TARGET_TYPE.  Not much we can do.  */
-      gdb_assert (TYPE_NAME (type) == NULL);
+      gdb_assert (type->name () == NULL);
       gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
       fprintf_styled (stream, metadata_style.style (),
                      _("<unnamed typedef>"));
          "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
          tag for unnamed struct/union/enum's, which we don't
          want to print.  */
-      if (TYPE_NAME (type) != NULL
-         && !startswith (TYPE_NAME (type), "{unnamed"))
+      if (type->name () != NULL
+         && !startswith (type->name (), "{unnamed"))
        {
-         print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+         print_name_maybe_canonical (type->name (), flags, stream);
          if (show > 0)
            fputs_filtered (" ", stream);
        }
        {
          /* If we just printed a tag name, no need to print anything
             else.  */
-         if (TYPE_NAME (type) == NULL)
+         if (type->name () == NULL)
            fprintf_filtered (stream, "{...}");
        }
-      else if (show > 0 || TYPE_NAME (type) == NULL)
+      else if (show > 0 || type->name () == NULL)
        {
          LONGEST lastval = 0;
 
            {
              struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type));
 
-             if (TYPE_NAME (underlying) != NULL)
-               fprintf_filtered (stream, ": %s ", TYPE_NAME (underlying));
+             if (underlying->name () != NULL)
+               fprintf_filtered (stream, ": %s ", underlying->name ());
            }
 
          fprintf_filtered (stream, "{");
 
        c_type_print_modifier (type, stream, 0, 1, language);
        fprintf_filtered (stream, "flag ");
-       print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+       print_name_maybe_canonical (type->name (), flags, stream);
        if (show > 0)
          {
            fputs_filtered (" ", stream);
 
     case TYPE_CODE_NAMESPACE:
       fputs_filtered ("namespace ", stream);
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (type->name (), stream);
       break;
 
     default:
          as fundamental types.  For these, just print whatever the
          type name is, as recorded in the type itself.  If there is no
          type name, then complain.  */
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
          c_type_print_modifier (type, stream, 0, 1, language);
-         print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+         print_name_maybe_canonical (type->name (), flags, stream);
        }
       else
        {
 
   while (iter_type)
     {
       /* Check the name of the type.  */
-      if (TYPE_NAME (iter_type) && textual_name (TYPE_NAME (iter_type)))
+      if (iter_type->name () && textual_name (iter_type->name ()))
        return 1;
 
       if (iter_type->code () != TYPE_CODE_TYPEDEF)
          (Don't use c_textual_element_type here; quoted strings
          are always exactly (char *), (wchar_t *), or the like.  */
       if (original_type->code () == TYPE_CODE_PTR
-         && TYPE_NAME (original_type) == NULL
-         && TYPE_NAME (TYPE_TARGET_TYPE (original_type)) != NULL
-         && (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (original_type)),
+         && original_type->name () == NULL
+         && TYPE_TARGET_TYPE (original_type)->name () != NULL
+         && (strcmp (TYPE_TARGET_TYPE (original_type)->name (),
                      "char") == 0
-             || textual_name (TYPE_NAME (TYPE_TARGET_TYPE (original_type)))))
+             || textual_name (TYPE_TARGET_TYPE (original_type)->name ())))
        {
          /* Print nothing.  */
        }
                    < TYPE_LENGTH (value_enclosing_type (val)))))
            val = value_cast (real_type, val);
          fprintf_filtered (stream, "(%s%s) ",
-                           TYPE_NAME (real_type),
+                           real_type->name (),
                            full ? "" : _(" [incomplete object]"));
        }
       else if (type != check_typedef (value_enclosing_type (val)))
        {
          /* No RTTI information, so let's do our best.  */
          fprintf_filtered (stream, "(%s ?) ",
-                           TYPE_NAME (value_enclosing_type (val)));
+                           value_enclosing_type (val)->name ());
          val = value_cast (value_enclosing_type (val), val);
        }
     }
 
   /* Anonymous unions and structs are also not path_expr parents.  */
   if ((type->code () == TYPE_CODE_STRUCT
        || type->code () == TYPE_CODE_UNION)
-      && TYPE_NAME (type) == NULL)
+      && type->name () == NULL)
     {
       const struct varobj *parent = var->parent;
 
 
          TYPE_FIELDS (real_target), 
          field_size);
 
-  if (TYPE_NAME (real_target))
+  if (real_target->name ())
     {
       /* The previous copy of TYPE_NAME is allocated by
         process_coff_symbol.  */
-      if (TYPE_NAME (target))
-       xfree ((char*) TYPE_NAME (target));
-      target->set_name (xstrdup (TYPE_NAME (real_target)));
+      if (target->name ())
+       xfree ((char*) target->name ());
+      target->set_name (xstrdup (real_target->name ()));
     }
 }
 
          SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
 
          /* If type has no name, give it one.  */
-         if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+         if (SYMBOL_TYPE (sym)->name () == 0)
            {
              if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
                  || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
          /* Some compilers try to be helpful by inventing "fake"
             names for anonymous enums, structures, and unions, like
             "~0fake" or ".0fake".  Thanks, but no thanks...  */
-         if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+         if (SYMBOL_TYPE (sym)->name () == 0)
            if (sym->linkage_name () != NULL
                && *sym->linkage_name () != '~'
                && *sym->linkage_name () != '.')
 
        }
       return context->plugin ().int_type (TYPE_UNSIGNED (type),
                                          TYPE_LENGTH (type),
-                                         TYPE_NAME (type));
+                                         type->name ());
     }
   else
     return context->plugin ().int_type_v0 (TYPE_UNSIGNED (type),
 {
   if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
     return context->plugin ().float_type (TYPE_LENGTH (type),
-                                         TYPE_NAME (type));
+                                         type->name ());
   else
     return context->plugin ().float_type_v0 (TYPE_LENGTH (type));
 }
 
     }
   else
     {
-      if (TYPE_NAME (type) == nullptr)
+      if (type->name () == nullptr)
        {
          /* Anonymous type  */
 
        {
          scope_component comp
            = {
-               decl_name (TYPE_NAME (type)).get (),
-               lookup_symbol (TYPE_NAME (type), block (), VAR_DOMAIN, nullptr)
+               decl_name (type->name ()).get (),
+               lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
              };
          scope.push_back (comp);
        }
                               struct type *type,
                               enum gcc_cp_symbol_kind nested_access)
 {
-  compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+  compile_scope scope = instance->new_scope (type->name (), type);
 
   if (scope.nested_type () != GCC_TYPE_NONE)
     return scope.nested_type ();
 
   gdb::unique_xmalloc_ptr<char> name
-    = compile_cplus_instance::decl_name (TYPE_NAME (type));
+    = compile_cplus_instance::decl_name (type->name ());
 
   /* Make sure the scope for this type has been pushed.  */
   instance->enter_scope (std::move (scope));
 
   /* Get the decl name of this type.  */
   gdb::unique_xmalloc_ptr<char> name
-    = compile_cplus_instance::decl_name (TYPE_NAME (type));
+    = compile_cplus_instance::decl_name (type->name ());
 
   /* Create a new scope for TYPE.  */
-  compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+  compile_scope scope = instance->new_scope (type->name (), type);
 
   if (scope.nested_type () != GCC_TYPE_NONE)
     {
   bool scoped_enum_p = false;
 
   /* Create a new scope for this type.  */
-  compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+  compile_scope scope = instance->new_scope (type->name (), type);
 
   if (scope.nested_type () != GCC_TYPE_NONE)
     {
     }
 
   gdb::unique_xmalloc_ptr<char> name
-    = compile_cplus_instance::decl_name (TYPE_NAME (type));
+    = compile_cplus_instance::decl_name (type->name ());
 
   /* Push all scopes.  */
   instance->enter_scope (std::move (scope));
     }
 
   return instance->plugin ().get_int_type
-    (TYPE_UNSIGNED (type), TYPE_LENGTH (type), TYPE_NAME (type));
+    (TYPE_UNSIGNED (type), TYPE_LENGTH (type), type->name ());
 }
 
 /* Convert a floating-point type to its gcc representation.  */
                             struct type *type)
 {
   return instance->plugin ().get_float_type
-    (TYPE_LENGTH (type), TYPE_NAME (type));
+    (TYPE_LENGTH (type), type->name ());
 }
 
 /* Convert the 'void' type to its gcc representation.  */
 compile_cplus_convert_namespace (compile_cplus_instance *instance,
                                 struct type *type)
 {
-  compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+  compile_scope scope = instance->new_scope (type->name (), type);
   gdb::unique_xmalloc_ptr<char> name
-    = compile_cplus_instance::decl_name (TYPE_NAME (type));
+    = compile_cplus_instance::decl_name (type->name ());
 
   /* Push scope.  */
   instance->enter_scope (std::move (scope));
 
        {
          if (!computed_type_name)
            {
-             type_name = TYPE_NAME (type);
+             type_name = type->name ();
              computed_type_name = 1;
            }
          /* Omit constructors from the completion list.  */
 
       /* If TYPE_NAME is NULL, abandon trying to find this symbol.
         This can happen for lambda functions compiled with clang++,
         which outputs no name for the container class.  */
-      if (TYPE_NAME (type) == NULL)
+      if (type->name () == NULL)
        return {};
 
       /* Look for symbol NAME in this class.  */
 
   if (symbol_lookup_debug)
     {
-      const char *type_name = TYPE_NAME (saved_parent_type);
+      const char *type_name = saved_parent_type->name ();
 
       fprintf_unfiltered (gdb_stdlog,
                          "cp_lookup_nested_symbol (%s, %s, %s, %s)\n",
 
 
             If the symbol is typedef and its type name is the same
             as the symbol's name, e.g., "typedef struct foo foo;".  */
-         if (TYPE_NAME (type) != nullptr
-             && strcmp (TYPE_NAME (type), name) == 0)
+         if (type->name () != nullptr
+             && strcmp (type->name (), name) == 0)
            return 0;
 
-         is_anon = (TYPE_NAME (type) == NULL
+         is_anon = (type->name () == NULL
                     && (type->code () == TYPE_CODE_ENUM
                         || type->code () == TYPE_CODE_STRUCT
                         || type->code () == TYPE_CODE_UNION));
        type = TYPE_TARGET_TYPE (type);
     }
 
-  type_name = TYPE_NAME (type);
+  type_name = type->name ();
 
   if (type_name == NULL)
     return;
 
 int
 cp_is_vtbl_ptr_type (struct type *type)
 {
-  const char *type_name = TYPE_NAME (type);
+  const char *type_name = type->name ();
 
   return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
 }
                  fprintf_filtered (stream, "\n");
                  print_spaces_filtered (2 + 2 * recurse, stream);
                  fputs_filtered ("members of ", stream);
-                 fputs_filtered (TYPE_NAME (type), stream);
+                 fputs_filtered (type->name (), stream);
                  fputs_filtered (":", stream);
                }
            }
       LONGEST boffset = 0;
       int skip = 0;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-      const char *basename = TYPE_NAME (baseclass);
+      const char *basename = baseclass->name ();
       struct value *base_val = NULL;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
       const char *name;
 
       fputs_filtered (prefix, stream);
-      name = TYPE_NAME (self_type);
+      name = self_type->name ();
       if (name)
        fputs_filtered (name, stream);
       else
 
            return {};
 
          type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
-         classname = TYPE_NAME (type);
+         classname = type->name ();
          nested = name;
        }
       else
 
         field at index 1 and the data-less field at index 2.  */
       TYPE_FIELD (type, 1) = saved_field;
       TYPE_FIELD_NAME (type, 1)
-       = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, 1)));
+       = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
       TYPE_FIELD_TYPE (type, 1)->set_name
-       (rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+       (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
                             TYPE_FIELD_NAME (type, 1)));
 
       const char *dataless_name
-       = rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+       = rust_fully_qualify (&objfile->objfile_obstack, type->name (),
                              name);
       struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
                                              dataless_name);
 
       struct type *field_type = TYPE_FIELD_TYPE (type, 0);
       const char *variant_name
-       = rust_last_path_segment (TYPE_NAME (field_type));
+       = rust_last_path_segment (field_type->name ());
       TYPE_FIELD_NAME (type, 0) = variant_name;
       field_type->set_name
        (rust_fully_qualify (&objfile->objfile_obstack,
-                            TYPE_NAME (type), variant_name));
+                            type->name (), variant_name));
     }
   else
     {
             That name can be used to look up the correct
             discriminant.  */
          const char *variant_name
-           = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, i)));
+           = rust_last_path_segment (TYPE_FIELD_TYPE (type, i)->name ());
 
          auto iter = discriminant_map.find (variant_name);
          if (iter != discriminant_map.end ())
          TYPE_FIELD_NAME (type, i) = variant_name;
          sub_type->set_name
            (rust_fully_qualify (&objfile->objfile_obstack,
-                                TYPE_NAME (type), variant_name));
+                                type->name (), variant_name));
        }
 
       /* Indicate that this is a variant type.  */
       handle_data_member_location (die, cu, fp);
       FIELD_BITSIZE (*fp) = 0;
       FIELD_TYPE (*fp) = die_type (die, cu);
-      FIELD_NAME (*fp) = TYPE_NAME (fp->type);
+      FIELD_NAME (*fp) = fp->type->name ();
     }
   else
     gdb_assert_not_reached ("missing case in dwarf2_add_field");
                  if (i < TYPE_N_BASECLASSES (t))
                    complaint (_("virtual function table pointer "
                                 "not found when defining class '%s'"),
-                              TYPE_NAME (type) ? TYPE_NAME (type) : "");
+                              type->name () ? type->name () : "");
                }
              else
                {
 
          std::vector<const char *> excludes;
          add_using_directive (using_directives (cu),
-                              previous_prefix, TYPE_NAME (type), NULL,
+                              previous_prefix, type->name (), NULL,
                               NULL, excludes, 0, &objfile->objfile_obstack);
        }
     }
   if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
     tt = nullptr;
 
-  const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
+  const char *name = (tt == nullptr) ? nullptr : tt->name ();
   return dwarf2_init_float_type (objfile, bits, name, name_hint, byte_order);
 }
 
              {
                struct obstack *obstack
                  = &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack;
-               name = obconcat (obstack, "_Complex ", TYPE_NAME (type),
+               name = obconcat (obstack, "_Complex ", type->name (),
                                 nullptr);
              }
            type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
                    /* The symbol's name is already allocated along
                       with this objfile, so we don't need to
                       duplicate it for the type.  */
-                   if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+                   if (SYMBOL_TYPE (sym)->name () == 0)
                      SYMBOL_TYPE (sym)->set_name (sym->search_name ());
                  }
              }
           DW_TAG_namespace DIEs with a name of "::" for the global namespace.
           Work around this problem here.  */
        if (cu->language == language_cplus
-           && strcmp (TYPE_NAME (parent_type), "::") == 0)
+           && strcmp (parent_type->name (), "::") == 0)
          return "";
        /* We give a name to even anonymous namespaces.  */
-       return TYPE_NAME (parent_type);
+       return parent_type->name ();
       case DW_TAG_class_type:
       case DW_TAG_interface_type:
       case DW_TAG_structure_type:
       case DW_TAG_union_type:
       case DW_TAG_module:
        parent_type = read_type_die (parent, cu);
-       if (TYPE_NAME (parent_type) != NULL)
-         return TYPE_NAME (parent_type);
+       if (parent_type->name () != NULL)
+         return parent_type->name ();
        else
          /* An anonymous structure is only allowed non-static data
             members; no typedefs, no member functions, et cetera.
        parent_type = read_type_die (parent, cu);
        if (TYPE_DECLARED_CLASS (parent_type))
          {
-           if (TYPE_NAME (parent_type) != NULL)
-             return TYPE_NAME (parent_type);
+           if (parent_type->name () != NULL)
+             return parent_type->name ();
            return "";
          }
        /* Fall through.  */
 
       function_name = NULL;
       if (type->code () == TYPE_CODE_NAMESPACE)
        {
-         function = cp_lookup_symbol_namespace (TYPE_NAME (type),
+         function = cp_lookup_symbol_namespace (type->name (),
                                                 name,
                                                 get_selected_block (0),
                                                 VAR_DOMAIN).symbol;
          if (function == NULL)
            error (_("No symbol \"%s\" in namespace \"%s\"."),
-                  name, TYPE_NAME (type));
+                  name, type->name ());
 
          tem = 1;
          /* arg2 is left as NULL on purpose.  */
          if (type->code () != TYPE_CODE_ARRAY
              && type->code () != TYPE_CODE_PTR)
            {
-             if (TYPE_NAME (type))
+             if (type->name ())
                error (_("cannot subscript something of type `%s'"),
-                      TYPE_NAME (type));
+                      type->name ());
              else
                error (_("cannot subscript requested type"));
            }
              else
                {
                  error (_("cannot subscript something of type `%s'"),
-                        TYPE_NAME (value_type (arg1)));
+                        value_type (arg1)->name ());
                }
            }
 
                  break;
 
                default:
-                 if (TYPE_NAME (type))
+                 if (type->name ())
                    error (_("cannot subscript something of type `%s'"),
-                          TYPE_NAME (type));
+                          type->name ());
                  else
                    error (_("cannot subscript requested type"));
                }
 
     case OP_SCOPE:
       myprec = PREC_PREFIX;
       assoc = 0;
-      fputs_filtered (TYPE_NAME (exp->elts[pc + 1].type), stream);
+      fputs_filtered (exp->elts[pc + 1].type->name (), stream);
       fputs_filtered ("::", stream);
       nargs = longest_to_int (exp->elts[pc + 2].longconst);
       (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
 
       /* Need a space if going to print stars or brackets; but not if we
         will print just a type name.  */
       || ((show > 0
-          || TYPE_NAME (type) == 0)
+          || type->name () == 0)
           && (code == TYPE_CODE_FUNC
              || code == TYPE_CODE_METHOD
              || code == TYPE_CODE_ARRAY
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
   /* When SHOW is zero or less, and there is a valid type name, then always
      just print the type name directly from the type.  */
 
-  if ((show <= 0) && (TYPE_NAME (type) != NULL))
+  if ((show <= 0) && (type->name () != NULL))
     {
       const char *prefix = "";
       if (type->code () == TYPE_CODE_UNION)
        prefix = "Type, C_Union :: ";
       else if (type->code () == TYPE_CODE_STRUCT)
        prefix = "Type ";
-      fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type));
+      fprintfi_filtered (level, stream, "%s%s", prefix, type->name ());
       return;
     }
 
       {
        gdbarch *gdbarch = get_type_arch (type);
        struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
-       fprintfi_filtered (level, stream, "%s", TYPE_NAME (void_type));
+       fprintfi_filtered (level, stream, "%s", void_type->name ());
       }
       break;
 
          through as TYPE_CODE_INT since dbxstclass.h is so
          C-oriented, we must change these to "character" from "char".  */
 
-      if (strcmp (TYPE_NAME (type), "char") == 0)
+      if (strcmp (type->name (), "char") == 0)
        fprintfi_filtered (level, stream, "character");
       else
        goto default_case;
        fprintfi_filtered (level, stream, "Type, C_Union :: ");
       else
        fprintfi_filtered (level, stream, "Type ");
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (type->name (), stream);
       /* According to the definition,
          we only print structure elements in case show > 0.  */
       if (show > 0)
              fputs_filtered ("\n", stream);
            }
          fprintfi_filtered (level, stream, "End Type ");
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
        }
       break;
 
     case TYPE_CODE_MODULE:
-      fprintfi_filtered (level, stream, "module %s", TYPE_NAME (type));
+      fprintfi_filtered (level, stream, "module %s", type->name ());
       break;
 
     default_case:
          such as fundamental types.  For these, just print whatever
          the type name is, as recorded in the type itself.  If there
          is no type name, then complain.  */
-      if (TYPE_NAME (type) != NULL)
-       fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
+      if (type->name () != NULL)
+       fprintfi_filtered (level, stream, "%s", type->name ());
       else
        error (_("Invalid type code (%d) in symbol table."), type->code ());
       break;
 
 
   type = check_typedef (type);
 
-  name = TYPE_NAME (type);
+  name = type->name ();
   if (name != NULL)
     return name;
 
-  name = TYPE_NAME (saved_type);
+  name = saved_type->name ();
   objfile = TYPE_OBJFILE (saved_type);
   error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
         name ? name : "<anonymous>",
 {
   struct symbol *sym;
   char *nam = (char *) 
-    alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4);
+    alloca (strlen (name) + strlen (type->name ()) + 4);
 
   strcpy (nam, name);
   strcat (nam, "<");
-  strcat (nam, TYPE_NAME (type));
+  strcat (nam, type->name ());
   strcat (nam, " >");  /* FIXME, extra space still introduced in gcc?  */
 
   sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol;
             if the DWARF info is not correct.  Issue a warning,
             and assume no byte/bit stride (leave bit_stride = 0).  */
          warning (_("cannot determine array stride for type %s"),
-                  TYPE_NAME (type) ? TYPE_NAME (type) : "<no name>");
+                  type->name () ? type->name () : "<no name>");
        }
     }
   else
          if (currently_reading_symtab)
            return make_qualified_type (type, instance_flags, NULL);
 
-         name = TYPE_NAME (type);
+         name = type->name ();
          /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or
             VAR_DOMAIN as appropriate?  */
          if (name == NULL)
       && opaque_type_resolution 
       && !currently_reading_symtab)
     {
-      const char *name = TYPE_NAME (type);
+      const char *name = type->name ();
       struct type *newtype;
 
       if (name == NULL)
      types.  */
   else if (TYPE_STUB (type) && !currently_reading_symtab)
     {
-      const char *name = TYPE_NAME (type);
+      const char *name = type->name ();
       /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
          as appropriate?  */
       struct symbol *sym;
        {
          char *new_name
            = (char *) TYPE_ALLOC (target_type,
-                                  strlen (TYPE_NAME (target_type))
+                                  strlen (target_type->name ())
                                   + strlen ("_Complex ") + 1);
          strcpy (new_name, "_Complex ");
-         strcat (new_name, TYPE_NAME (target_type));
+         strcat (new_name, target_type->name ());
          name = new_name;
        }
 
 class_types_same_p (const struct type *a, const struct type *b)
 {
   return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
-         || (TYPE_NAME (a) && TYPE_NAME (b)
-             && !strcmp (TYPE_NAME (a), TYPE_NAME (b))));
+         || (a->name () && b->name ()
+             && !strcmp (a->name (), b->name ())));
 }
 
 /* If BASE is an ancestor of DCLASS return the distance between them.
      stubs.  The types won't point to the same address, but they
      really are the same.  */
 
-  if (TYPE_NAME (a) && TYPE_NAME (b)
-      && strcmp (TYPE_NAME (a), TYPE_NAME (b)) == 0)
+  if (a->name () && b->name ()
+      && strcmp (a->name (), b->name ()) == 0)
     return true;
 
   /* Check if identical after resolving typedefs.  */
       || TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2))
     return false;
 
-  if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
+  if (!compare_maybe_null_strings (type1->name (), type2->name ()))
     return false;
-  if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
+  if (!compare_maybe_null_strings (type1->name (), type2->name ()))
     return false;
 
   if (type1->code () == TYPE_CODE_RANGE)
                {
                  /* unsigned int -> unsigned int, or
                     unsigned long -> unsigned long */
-                 if (integer_types_same_name_p (TYPE_NAME (parm),
-                                                TYPE_NAME (arg)))
+                 if (integer_types_same_name_p (parm->name (),
+                                                arg->name ()))
                    return EXACT_MATCH_BADNESS;
-                 else if (integer_types_same_name_p (TYPE_NAME (arg),
+                 else if (integer_types_same_name_p (arg->name (),
                                                      "int")
-                          && integer_types_same_name_p (TYPE_NAME (parm),
+                          && integer_types_same_name_p (parm->name (),
                                                         "long"))
                    /* unsigned int -> unsigned long */
                    return INTEGER_PROMOTION_BADNESS;
                }
              else
                {
-                 if (integer_types_same_name_p (TYPE_NAME (arg),
+                 if (integer_types_same_name_p (arg->name (),
                                                 "long")
-                     && integer_types_same_name_p (TYPE_NAME (parm),
+                     && integer_types_same_name_p (parm->name (),
                                                    "int"))
                    /* signed long -> unsigned int */
                    return INTEGER_CONVERSION_BADNESS;
            }
          else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
            {
-             if (integer_types_same_name_p (TYPE_NAME (parm),
-                                            TYPE_NAME (arg)))
+             if (integer_types_same_name_p (parm->name (),
+                                            arg->name ()))
                return EXACT_MATCH_BADNESS;
-             else if (integer_types_same_name_p (TYPE_NAME (arg),
+             else if (integer_types_same_name_p (arg->name (),
                                                  "int")
-                      && integer_types_same_name_p (TYPE_NAME (parm),
+                      && integer_types_same_name_p (parm->name (),
                                                     "long"))
                return INTEGER_PROMOTION_BADNESS;
              else
   /* Debugging only.  */
     fprintf_filtered (gdb_stderr,
                      "------ Arg is %s [%d], parm is %s [%d]\n",
-                     TYPE_NAME (arg), arg->code (),
-                     TYPE_NAME (parm), parm->code ());
+                     arg->name (), arg->code (),
+                     parm->name (), parm->code ());
 
   /* x -> y means arg of type x being supplied for parameter of type y.  */
 
   gdb_print_host_address (type, gdb_stdout);
   printf_filtered ("\n");
   printfi_filtered (spaces, "name '%s' (",
-                   TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
-  gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
+                   type->name () ? type->name () : "<NULL>");
+  gdb_print_host_address (type->name (), gdb_stdout);
   printf_filtered (")\n");
   printfi_filtered (spaces, "code 0x%x ", type->code ());
   switch (type->code ())
   TYPE_OBJFILE_OWNED (new_type) = 0;
   TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
 
-  if (TYPE_NAME (type))
-    new_type->set_name (xstrdup (TYPE_NAME (type)));
+  if (type->name ())
+    new_type->set_name (xstrdup (type->name ()));
 
   TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
   TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
 
 
 #define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
-#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
    if the type has no name.  */
 
 #define TYPE_SAFE_NAME(type) \
-  (TYPE_NAME (type) ? TYPE_NAME (type) : _("<unnamed type>"))
+  (type->name () != nullptr ? type->name () : _("<unnamed type>"))
 
 /* * A helper macro that returns the name of an error type.  If the
    type has a name, it is used; otherwise, a default is used.  */
 
 #define TYPE_ERROR_NAME(type) \
-  (TYPE_NAME (type) ? TYPE_NAME (type) : _("<error type>"))
+  (type->name () ? type->name () : _("<error type>"))
 
 /* Given TYPE, return its floatformat.  */
 const struct floatformat *floatformat_from_type (const struct type *type);
 
   if (TYPE_TARGET_TYPE (fieldtype) == basetype)
     return 1;
 
-  if (TYPE_NAME (basetype) != NULL
-      && TYPE_NAME (TYPE_TARGET_TYPE (fieldtype)) != NULL
-      && strcmp (TYPE_NAME (basetype),
-                TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))) == 0)
+  if (basetype->name () != NULL
+      && TYPE_TARGET_TYPE (fieldtype)->name () != NULL
+      && strcmp (basetype->name (),
+                TYPE_TARGET_TYPE (fieldtype)->name ()) == 0)
     return 1;
   return 0;
 }
 
 
          if (target_type->code () == TYPE_CODE_INT
              && TYPE_LENGTH (target_type) == 1
-             && strcmp (TYPE_NAME (target_type), "uint8") == 0)
+             && strcmp (target_type->name (), "uint8") == 0)
            return 1;
        }
     }
 sixg_string_p (struct type *type)
 {
   if (TYPE_NFIELDS (type) == 2
-      && TYPE_NAME (type) != NULL
-      && strcmp (TYPE_NAME (type), "string") == 0)
+      && type->name () != NULL
+      && strcmp (type->name (), "string") == 0)
     return 1;
 
   return 0;
 
   if (type->code () == TYPE_CODE_STRUCT
       || type->code () == TYPE_CODE_UNION
       || type->code () == TYPE_CODE_ENUM)
-    tagname = TYPE_NAME (type);
+    tagname = type->name ();
 
   if (tagname == nullptr)
     return SCM_BOOL_F;
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
 
-  if (!TYPE_NAME (type))
+  if (!type->name ())
     return SCM_BOOL_F;
-  return gdbscm_scm_from_c_string (TYPE_NAME (type));
+  return gdbscm_scm_from_c_string (type->name ());
 }
 
 /* (type-print-name <gdb:type>) -> string
 
       auto info = language_pass_by_reference (param_type);
       if (!info.copy_constructible)
        error (_("expression cannot be evaluated because the type '%s' "
-                "is not copy constructible"), TYPE_NAME (param_type));
+                "is not copy constructible"), param_type->name ());
 
       if (!info.destructible)
        error (_("expression cannot be evaluated because the type '%s' "
-                "is not destructible"), TYPE_NAME (param_type));
+                "is not destructible"), param_type->name ());
 
       if (info.trivially_copyable)
        continue;
          value *copy_ctor;
          value *cctor_args[2] = { clone_ptr, original_arg };
          find_overload_match (gdb::make_array_view (cctor_args, 2),
-                              TYPE_NAME (param_type), METHOD,
+                              param_type->name (), METHOD,
                               &clone_ptr, nullptr, ©_ctor, nullptr,
                               nullptr, 0, EVAL_NORMAL);
 
          if (copy_ctor == nullptr)
            error (_("expression cannot be evaluated because a copy "
                     "constructor for the type '%s' could not be found "
-                    "(maybe inlined?)"), TYPE_NAME (param_type));
+                    "(maybe inlined?)"), param_type->name ());
 
          call_function_by_hand (copy_ctor, default_return_type,
                                 gdb::make_array_view (cctor_args, 2));
          if (dtor_name == nullptr)
            error (_("expression cannot be evaluated because a destructor "
                     "for the type '%s' could not be found "
-                    "(maybe inlined?)"), TYPE_NAME (param_type));
+                    "(maybe inlined?)"), param_type->name ());
 
          value *dtor
            = find_function_in_inferior (dtor_name, 0);
 
 
   for (p = lai->primitive_type_vector; (*p) != NULL; p++)
     {
-      if (strcmp (TYPE_NAME (*p), name) == 0)
+      if (strcmp ((*p)->name (), name) == 0)
        return p;
     }
   return NULL;
   gdbarch = TYPE_OWNER (type).gdbarch;
   symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
 
-  symbol->m_name = TYPE_NAME (type);
+  symbol->m_name = type->name ();
   symbol->set_language (lang, nullptr);
   symbol->owner.arch = gdbarch;
   SYMBOL_OBJFILE_OWNED (symbol) = 0;
 
              std::vector<struct type *> *superclasses)
 {
   int ibase;
-  const char *class_name = TYPE_NAME (t);
+  const char *class_name = t->name ();
 
   /* Ignore this class if it doesn't have a name.  This is ugly, but
      unless we figure out how to get the physname without the name of
 
       else
        if (type->code () != TYPE_CODE_ARRAY)
          {
-           if (TYPE_NAME (type))
+           if (type->name ())
              error (_("cannot subscript something of type `%s'"),
-                    TYPE_NAME (type));
+                    type->name ());
            else
              error (_("cannot subscript requested type"));
          }
 
 {
   type = check_typedef (type);
   fprintf_filtered (stream, "TYPE ");
-  if (!TYPE_NAME (SYMBOL_TYPE (new_symbol))
-      || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
+  if (!SYMBOL_TYPE (new_symbol)->name ()
+      || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
                 new_symbol->linkage_name ()) != 0)
     fprintf_filtered (stream, "%s = ", new_symbol->print_name ());
   else
 void
 m2_type_name (struct type *type, struct ui_file *stream)
 {
-  if (TYPE_NAME (type) != NULL)
-    fputs_filtered (TYPE_NAME (type), stream);
+  if (type->name () != NULL)
+    fputs_filtered (type->name (), stream);
 }
 
 /* m2_range - displays a Modula-2 subrange type.  */
 m2_typedef (struct type *type, struct ui_file *stream, int show,
            int level, const struct type_print_options *flags)
 {
-  if (TYPE_NAME (type) != NULL)
+  if (type->name () != NULL)
     {
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (type->name (), stream);
       fputs_filtered (" = ", stream);
     }
   m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
 
   if (m2_is_long_set (type))
     {
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
          if (show == 0)
            return 1;
          fputs_filtered (" = ", stream);
                  int level, const struct type_print_options *flags)
 {
   /* Print the tag if it exists.  */
-  if (TYPE_NAME (type) != NULL)
+  if (type->name () != NULL)
     {
-      if (!startswith (TYPE_NAME (type), "$$"))
+      if (!startswith (type->name (), "$$"))
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
          if (show > 0)
            fprintf_filtered (stream, " = ");
        }
   if (show < 0)
     {
       /* If we just printed a tag name, no need to print anything else.  */
-      if (TYPE_NAME (type) == NULL)
+      if (type->name () == NULL)
        fprintf_filtered (stream, "(...)");
     }
-  else if (show > 0 || TYPE_NAME (type) == NULL)
+  else if (show > 0 || type->name () == NULL)
     {
       fprintf_filtered (stream, "(");
       len = TYPE_NFIELDS (type);
 
       add_symbol (s, top_stack->cur_st, top_stack->cur_block);
 
       /* Incomplete definitions of structs should not get a name.  */
-      if (TYPE_NAME (SYMBOL_TYPE (s)) == NULL
+      if (SYMBOL_TYPE (s)->name () == NULL
          && (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0
              || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
                  && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
             (.Fxx or .xxfake or empty) for unnamed struct/union/enums.  */
          if (name[0] == '.' || name[0] == '\0')
            tp->set_name (NULL);
-         else if (TYPE_NAME (tp) == NULL
-                  || strcmp (TYPE_NAME (tp), name) != 0)
+         else if (tp->name () == NULL
+                  || strcmp (tp->name (), name) != 0)
            tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
                                          name));
        }
              bad_tag_guess_complaint (sym_name);
              tp->set_code (type_code);
            }
-         if (TYPE_NAME (tp) == NULL
-             || strcmp (TYPE_NAME (tp), name) != 0)
+         if (tp->name () == NULL
+             || strcmp (tp->name (), name) != 0)
            tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
                                          name));
        }
 
     {
       type = check_typedef (type);
       if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
-         && TYPE_NAME (type) != NULL)
+         && type->name () != NULL)
        show = 0;
     }
 
 
                          if (type->code () != TYPE_CODE_STRUCT
                              && type->code () != TYPE_CODE_UNION)
                            error (_("`%s' is not defined as an aggregate type."),
-                                  TYPE_NAME (type));
+                                  type->name ());
 
                          write_exp_elt_opcode (pstate, OP_SCOPE);
                          write_exp_elt_type (pstate, type);
 
       fprintf_filtered (stream, "%s%s ",
                        BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
                        BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
-      name = TYPE_NAME (TYPE_BASECLASS (type, i));
+      name = TYPE_BASECLASS (type, i)->name ();
       fprintf_filtered (stream, "%s", name ? name : "(null)");
     }
   if (i > 0)
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
   if (type == 0)
     return;
 
-  if (TYPE_NAME (type) && show <= 0)
+  if (type->name () && show <= 0)
     return;
 
   QUIT;
   if ((type->code () == TYPE_CODE_PTR)
       && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID))
     {
-      fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer",
+      fputs_filtered (type->name () ? type->name () : "pointer",
                      stream);
       return;
     }
      just print the type name directly from the type.  */
 
   if (show <= 0
-      && TYPE_NAME (type) != NULL)
+      && type->name () != NULL)
     {
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (type->name (), stream);
       return;
     }
 
          only after args !!  */
       break;
     case TYPE_CODE_STRUCT:
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
          fputs_filtered (" = ", stream);
        }
       if (HAVE_CPLUS_STRUCT (type))
       goto struct_union;
 
     case TYPE_CODE_UNION:
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
          fputs_filtered (" = ", stream);
        }
       fprintf_filtered (stream, "case <?> of ");
       if (show < 0)
        {
          /* If we just printed a tag name, no need to print anything else.  */
-         if (TYPE_NAME (type) == NULL)
+         if (type->name () == NULL)
            fprintf_filtered (stream, "{...}");
        }
-      else if (show > 0 || TYPE_NAME (type) == NULL)
+      else if (show > 0 || type->name () == NULL)
        {
          pascal_type_print_derivation_info (stream, type);
 
       break;
 
     case TYPE_CODE_ENUM:
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
          if (show > 0)
            fputs_filtered (" ", stream);
        }
       if (show < 0)
        {
          /* If we just printed a tag name, no need to print anything else.  */
-         if (TYPE_NAME (type) == NULL)
+         if (type->name () == NULL)
            fprintf_filtered (stream, "(...)");
        }
-      else if (show > 0 || TYPE_NAME (type) == NULL)
+      else if (show > 0 || type->name () == NULL)
        {
          fprintf_filtered (stream, "(");
          len = TYPE_NFIELDS (type);
          such as fundamental types.  For these, just print whatever
          the type name is, as recorded in the type itself.  If there
          is no type name, then complain.  */
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        {
-         fputs_filtered (TYPE_NAME (type), stream);
+         fputs_filtered (type->name (), stream);
        }
       else
        {
 
       /* Hack:  remove (char *) for char strings.  Their
          type is indicated by the quoted string anyway.  */
       if (type->code () == TYPE_CODE_PTR
-         && TYPE_NAME (type) == NULL
-         && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
-         && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
+         && type->name () == NULL
+         && TYPE_TARGET_TYPE (type)->name () != NULL
+         && strcmp (TYPE_TARGET_TYPE (type)->name (), "char") == 0)
        {
          /* Print nothing.  */
        }
 int
 pascal_object_is_vtbl_ptr_type (struct type *type)
 {
-  const char *type_name = TYPE_NAME (type);
+  const char *type_name = type->name ();
 
   return (type_name != NULL
          && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
                  fprintf_filtered (stream, "\n");
                  print_spaces_filtered (2 + 2 * recurse, stream);
                  fputs_filtered ("members of ", stream);
-                 fputs_filtered (TYPE_NAME (type), stream);
+                 fputs_filtered (type->name (), stream);
                  fputs_filtered (": ", stream);
                }
            }
     {
       LONGEST boffset = 0;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-      const char *basename = TYPE_NAME (baseclass);
+      const char *basename = baseclass->name ();
       int skip = 0;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
 
 {
   struct type *type = ((type_object *) self)->type;
 
-  if (TYPE_NAME (type) == NULL)
+  if (type->name () == NULL)
     Py_RETURN_NONE;
-  return PyString_FromString (TYPE_NAME (type));
+  return PyString_FromString (type->name ());
 }
 
 /* Return the type's tag, or None.  */
   if (type->code () == TYPE_CODE_STRUCT
       || type->code () == TYPE_CODE_UNION
       || type->code () == TYPE_CODE_ENUM)
-    tagname = TYPE_NAME (type);
+    tagname = type->name ();
 
   if (tagname == nullptr)
     Py_RETURN_NONE;
   std::string err;
   struct type *argtype;
 
-  if (TYPE_NAME (type) == NULL)
+  if (type->name () == NULL)
     {
       PyErr_SetString (PyExc_RuntimeError, _("Null type name."));
       return NULL;
   try
     {
       /* Note -- this is not thread-safe.  */
-      info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
+      info = cp_demangled_name_to_comp (type->name (), &err);
     }
   catch (const gdb_exception &except)
     {
 
          {
            static const char blt[] = "builtin_type";
 
-           t = TYPE_NAME (register_type (m_gdbarch, regnum));
+           t = register_type (m_gdbarch, regnum)->name ();
            if (t == NULL)
              {
                if (!footnote_register_type_name_null)
 
       if (flen == 8
           && type->code () == TYPE_CODE_FLT
           && TYPE_LENGTH (type) == flen
-          && (strcmp (TYPE_NAME (type), "builtin_type_ieee_double") == 0
-              || strcmp (TYPE_NAME (type), "double") == 0))
+          && (strcmp (type->name (), "builtin_type_ieee_double") == 0
+              || strcmp (type->name (), "double") == 0))
         type = riscv_fpreg_d_type (gdbarch);
     }
 
 
      nothing else in the debuginfo to distinguish a tuple from a
      struct.  */
   return (type->code () == TYPE_CODE_STRUCT
-         && TYPE_NAME (type) != NULL
-         && TYPE_NAME (type)[0] == '(');
+         && type->name () != NULL
+         && type->name ()[0] == '(');
 }
 
 /* Return true if all non-static fields of a structlike type are in a
 rust_slice_type_p (struct type *type)
 {
   return (type->code () == TYPE_CODE_STRUCT
-         && TYPE_NAME (type) != NULL
-         && (strncmp (TYPE_NAME (type), "&[", 2) == 0
-             || strcmp (TYPE_NAME (type), "&str") == 0));
+         && type->name () != NULL
+         && (strncmp (type->name (), "&[", 2) == 0
+             || strcmp (type->name (), "&str") == 0));
 }
 
 /* Return true if TYPE is a range type, otherwise false.  */
 
   if (type->code () != TYPE_CODE_STRUCT
       || TYPE_NFIELDS (type) > 2
-      || TYPE_NAME (type) == NULL
-      || strstr (TYPE_NAME (type), "::Range") == NULL)
+      || type->name () == NULL
+      || strstr (type->name (), "::Range") == NULL)
     return false;
 
   if (TYPE_NFIELDS (type) == 0)
 static bool
 rust_inclusive_range_type_p (struct type *type)
 {
-  return (strstr (TYPE_NAME (type), "::RangeInclusive") != NULL
-         || strstr (TYPE_NAME (type), "::RangeToInclusive") != NULL);
+  return (strstr (type->name (), "::RangeInclusive") != NULL
+         || strstr (type->name (), "::RangeToInclusive") != NULL);
 }
 
 /* Return true if TYPE seems to be the type "u8", otherwise false.  */
          || (type->code () == TYPE_CODE_STRUCT
              && !rust_enum_p (type)
              && rust_slice_type_p (type)
-             && strcmp (TYPE_NAME (type), "&str") == 0));
+             && strcmp (type->name (), "&str") == 0));
 }
 
 /* If VALUE represents a trait object pointer, return the underlying
   int first_field;
   struct type *type = check_typedef (value_type (val));
 
-  if (rust_slice_type_p (type) && strcmp (TYPE_NAME (type), "&str") == 0)
+  if (rust_slice_type_p (type) && strcmp (type->name (), "&str") == 0)
     {
       /* If what we are printing here is actually a string within a
         structure then VAL will be the original parent value, while TYPE
 
   if (!is_tuple)
     {
-      if (TYPE_NAME (type) != NULL)
-        fprintf_filtered (stream, "%s", TYPE_NAME (type));
+      if (type->name () != NULL)
+        fprintf_filtered (stream, "%s", type->name ());
 
       if (TYPE_NFIELDS (type) == 0)
         return;
 
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
         fputs_filtered (" ", stream);
     }
 
     {
       /* Print the enum type name here to be more clear.  */
       fprintf_filtered (stream, _("%s {%p[<No data fields>%p]}"),
-                       TYPE_NAME (type),
+                       type->name (),
                        metadata_style.style ().ptr (), nullptr);
       return;
     }
 
   bool is_tuple = rust_tuple_struct_type_p (variant_type);
 
-  fprintf_filtered (stream, "%s", TYPE_NAME (variant_type));
+  fprintf_filtered (stream, "%s", variant_type->name ());
   if (nfields == 0)
     {
       /* In case of a nullary variant like 'None', just output
     case TYPE_CODE_INT:
       /* Recognize the unit type.  */
       if (TYPE_UNSIGNED (type) && TYPE_LENGTH (type) == 0
-         && TYPE_NAME (type) != NULL && strcmp (TYPE_NAME (type), "()") == 0)
+         && type->name () != NULL && strcmp (type->name (), "()") == 0)
        {
          fputs_filtered ("()", stream);
          break;
   /* Print a tuple type simply.  */
   if (rust_tuple_type_p (type))
     {
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (type->name (), stream);
       return;
     }
 
 
   /* Compute properties of TYPE here because, in the enum case, the
      rest of the code ends up looking only at the variant part.  */
-  const char *tagname = TYPE_NAME (type);
+  const char *tagname = type->name ();
   bool is_tuple_struct = rust_tuple_struct_type_p (type);
   bool is_tuple = rust_tuple_type_p (type);
   bool is_enum = rust_enum_p (type);
 {
   QUIT;
   if (show <= 0
-      && TYPE_NAME (type) != NULL)
+      && type->name () != NULL)
     {
       /* Rust calls the unit type "void" in its debuginfo,
          but we don't want to print it as that.  */
       if (type->code () == TYPE_CODE_VOID)
         fputs_filtered ("()", stream);
       else
-        fputs_filtered (TYPE_NAME (type), stream);
+        fputs_filtered (type->name (), stream);
       return;
     }
 
        int len = 0;
 
        fputs_filtered ("enum ", stream);
-       if (TYPE_NAME (type) != NULL)
+       if (type->name () != NULL)
          {
-           fputs_filtered (TYPE_NAME (type), stream);
+           fputs_filtered (type->name (), stream);
            fputs_filtered (" ", stream);
-           len = strlen (TYPE_NAME (type));
+           len = strlen (type->name ());
          }
        fputs_filtered ("{\n", stream);
 
            QUIT;
 
            if (len > 0
-               && strncmp (name, TYPE_NAME (type), len) == 0
+               && strncmp (name, type->name (), len) == 0
                && name[len] == ':'
                && name[len + 1] == ':')
              name += len + 2;
 
     case TYPE_CODE_PTR:
       {
-       if (TYPE_NAME (type) != nullptr)
-         fputs_filtered (TYPE_NAME (type), stream);
+       if (type->name () != nullptr)
+         fputs_filtered (type->name (), stream);
        else
          {
            /* We currently can't distinguish between pointers and
        && type->code () != TYPE_CODE_ENUM)
       || rust_tuple_type_p (type))
     error (_("Method calls only supported on struct or enum types"));
-  if (TYPE_NAME (type) == NULL)
+  if (type->name () == NULL)
     error (_("Method call on nameless type"));
 
-  std::string name = std::string (TYPE_NAME (type)) + "::" + method;
+  std::string name = std::string (type->name ()) + "::" + method;
 
   block = get_selected_block (0);
   sym = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL);
                                                  "usize");
          const char *new_name = ((type != nullptr
                                   && rust_slice_type_p (type))
-                                 ? TYPE_NAME (type) : "&[*gdb*]");
+                                 ? type->name () : "&[*gdb*]");
 
          slice = rust_slice_type (new_name, value_type (result), usize);
 
 
                if (rust_empty_enum_p (type))
                  error (_("Cannot access field %d of empty enum %s"),
-                        field_number, TYPE_NAME (type));
+                        field_number, type->name ());
 
                int fieldno = rust_enum_variant (type);
                lhs = value_primitive_field (lhs, 0, fieldno, type);
                if (outer_type != NULL)
                  error(_("Cannot access field %d of variant %s::%s, "
                          "there are only %d fields"),
-                       field_number, TYPE_NAME (outer_type),
-                       rust_last_path_segment (TYPE_NAME (type)),
+                       field_number, outer_type->name (),
+                       rust_last_path_segment (type->name ()),
                        nfields);
                else
                  error(_("Cannot access field %d of %s, "
                          "there are only %d fields"),
-                       field_number, TYPE_NAME (type), nfields);
+                       field_number, type->name (), nfields);
              }
 
            /* Tuples are tuple structs too.  */
              {
                if (outer_type != NULL)
                  error(_("Variant %s::%s is not a tuple variant"),
-                       TYPE_NAME (outer_type),
-                       rust_last_path_segment (TYPE_NAME (type)));
+                       outer_type->name (),
+                       rust_last_path_segment (type->name ()));
                else
                  error(_("Attempting to access anonymous field %d "
                          "of %s, which is not a tuple, tuple struct, or "
                          "tuple-like variant"),
-                     field_number, TYPE_NAME (type));
+                     field_number, type->name ());
              }
 
            result = value_primitive_field (lhs, 0, field_number, type);
 
            if (rust_empty_enum_p (type))
              error (_("Cannot access field %s of empty enum %s"),
-                    field_name, TYPE_NAME (type));
+                    field_name, type->name ());
 
            int fieldno = rust_enum_variant (type);
            lhs = value_primitive_field (lhs, 0, fieldno, type);
            if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
                error (_("Attempting to access named field %s of tuple "
                         "variant %s::%s, which has only anonymous fields"),
-                      field_name, TYPE_NAME (outer_type),
-                      rust_last_path_segment (TYPE_NAME (type)));
+                      field_name, outer_type->name (),
+                      rust_last_path_segment (type->name ()));
 
            try
              {
            catch (const gdb_exception_error &except)
              {
                error (_("Could not find field %s of struct variant %s::%s"),
-                      field_name, TYPE_NAME (outer_type),
-                      rust_last_path_segment (TYPE_NAME (type)));
+                      field_name, outer_type->name (),
+                      rust_last_path_segment (type->name ()));
              }
          }
        else
 
          a base type which did not have its name defined when the
          derived class was output.  We fill in the derived class's
          base part member's name here in that case.  */
-      if (TYPE_NAME (SYMBOL_TYPE (sym)) != NULL)
+      if (SYMBOL_TYPE (sym)->name () != NULL)
        if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
             || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
            && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
            for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--)
              if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0)
                TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) =
-                 TYPE_NAME (TYPE_BASECLASS (SYMBOL_TYPE (sym), j));
+                 TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name ();
          }
 
-      if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
+      if (SYMBOL_TYPE (sym)->name () == NULL)
        {
          if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
               && strcmp (sym->linkage_name (), vtbl_ptr_name))
           SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
           SYMBOL_VALUE (struct_sym) = valu;
           SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
-          if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+          if (SYMBOL_TYPE (sym)->name () == 0)
            SYMBOL_TYPE (sym)->set_name
              (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
                         (char *) NULL));
       SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
-      if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+      if (SYMBOL_TYPE (sym)->name () == 0)
        SYMBOL_TYPE (sym)->set_name
          (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
                     (char *) NULL));
          SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
          SYMBOL_VALUE (typedef_sym) = valu;
          SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
-         if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+         if (SYMBOL_TYPE (sym)->name () == 0)
            SYMBOL_TYPE (sym)->set_name
              (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
                         (char *) NULL));
       switch (cpp_abbrev)
        {
        case 'f':               /* $vf -- a virtual function table pointer */
-         name = TYPE_NAME (context);
+         name = context->name ();
          if (name == NULL)
            {
              name = "";
          break;
 
        case 'b':               /* $vb -- a virtual bsomethingorother */
-         name = TYPE_NAME (context);
+         name = context->name ();
          if (name == NULL)
            {
              complaint (_("C++ abbreviated type name "
          field's name.  */
 
       newobj->field.type = read_type (pp, objfile);
-      newobj->field.name = TYPE_NAME (newobj->field.type);
+      newobj->field.name = newobj->field.type->name ();
 
       /* Skip trailing ';' and bump count of number of fields seen.  */
       if (**pp == ';')
              /* Virtual function table field not found.  */
              complaint (_("virtual function table pointer "
                           "not found when defining class `%s'"),
-                        TYPE_NAME (type));
+                        type->name ());
              return 0;
            }
          else
   const char *name = "";
   const char *kind = "";
 
-  if (TYPE_NAME (type))
+  if (type->name ())
     {
-      name = TYPE_NAME (type);
+      name = type->name ();
       switch (type->code ())
         {
         case TYPE_CODE_STRUCT: kind = "struct "; break;
 static void
 add_undefined_type (struct type *type, int typenums[2])
 {
-  if (TYPE_NAME (type) == NULL)
+  if (type->name () == NULL)
     add_undefined_type_noname (type, typenums);
   else
     add_undefined_type_1 (type);
                struct pending *ppt;
                int i;
                /* Name of the type, without "struct" or "union".  */
-               const char *type_name = TYPE_NAME (*type);
+               const char *type_name = (*type)->name ();
 
                if (type_name == NULL)
                  {
 
 
   if (SYMBOL_DOMAIN (symbol) == STRUCT_DOMAIN)
     {
-      if (TYPE_NAME (SYMBOL_TYPE (symbol)))
+      if (SYMBOL_TYPE (symbol)->name ())
        {
          LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
                         &type_print_raw_options);
 
   struct fn_field *method = &f[signature_id];
   const char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
   const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
-  const char *newname = TYPE_NAME (type);
+  const char *newname = type->name ();
 
   /* Does the form of physname indicate that it is the full mangled name
      of a constructor (not just the args)?  */
 
        {
          const char *name;
          
-         name = TYPE_NAME (ptr_target);
+         name = ptr_target->name ();
          if (name == NULL)
            error (_("Cannot perform pointer math on incomplete types, "
                   "try casting to a known type, or void *."));
        target_float_from_longest (x, *eff_type_x, value_as_long (arg1));
     }
   else
-    error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
-            TYPE_NAME (type2));
+    error (_("Don't know how to convert from %s to %s."), type1->name (),
+            type2->name ());
 
   /* Obtain value of arg2, converting from other types if necessary.  */
 
        target_float_from_longest (y, *eff_type_y, value_as_long (arg2));
     }
   else
-    error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
-            TYPE_NAME (type2));
+    error (_("Don't know how to convert from %s to %s."), type1->name (),
+            type2->name ());
 }
 
 /* A helper function that finds the type to use for a binary operation
 
               || t2->code () == TYPE_CODE_UNION)
              && !!"Precondition is that value is of STRUCT or UNION kind");
 
-  if (TYPE_NAME (t1) != NULL
-      && TYPE_NAME (t2) != NULL
-      && !strcmp (TYPE_NAME (t1), TYPE_NAME (t2)))
+  if (t1->name () != NULL
+      && t2->name () != NULL
+      && !strcmp (t1->name (), t2->name ()))
     return NULL;
 
   /* Upcasting: look in the type of the source to see if it contains the
      type of the target as a superclass.  If so, we'll need to
      offset the pointer rather than just change its type.  */
-  if (TYPE_NAME (t1) != NULL)
+  if (t1->name () != NULL)
     {
-      v = search_struct_field (TYPE_NAME (t1),
+      v = search_struct_field (t1->name (),
                               v2, t2, 1);
       if (v)
        return v;
   /* Downcasting: look in the type of the target to see if it contains the
      type of the source as a superclass.  If so, we'll need to
      offset the pointer rather than just change its type.  */
-  if (TYPE_NAME (t2) != NULL)
+  if (t2->name () != NULL)
     {
       /* Try downcasting using the run-time type of the value.  */
       int full, using_enc;
 
          /* We might be trying to cast to the outermost enclosing
             type, in which case search_struct_field won't work.  */
-         if (TYPE_NAME (real_type) != NULL
-             && !strcmp (TYPE_NAME (real_type), TYPE_NAME (t1)))
+         if (real_type->name () != NULL
+             && !strcmp (real_type->name (), t1->name ()))
            return v;
 
-         v = search_struct_field (TYPE_NAME (t2), v, real_type, 1);
+         v = search_struct_field (t2->name (), v, real_type, 1);
          if (v)
            return v;
        }
       /* Try downcasting using information from the destination type
         T2.  This wouldn't work properly for classes with virtual
         bases, but those were handled above.  */
-      v = search_struct_field (TYPE_NAME (t2),
+      v = search_struct_field (t2->name (),
                               value_zero (t1, not_lval), t1, 1);
       if (v)
        {
 
   if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
       && (code2 == TYPE_CODE_STRUCT || code2 == TYPE_CODE_UNION)
-      && TYPE_NAME (type) != 0)
+      && type->name () != 0)
     {
       struct value *v = value_cast_structs (to_type, arg2);
 
       obj = coerce_ref (obj);
       while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR)
        obj = coerce_ref (value_ind (obj));
-      obj_type_name = TYPE_NAME (value_type (obj));
+      obj_type_name = value_type (obj)->name ();
 
       /* First check whether this is a data member, e.g. a pointer to
         a function.  */
     }
 
   error (_("no constant named \"%s\" in enum \"%s\""),
-        name, TYPE_NAME (type));
+        name, type->name ());
 }
 
 /* C++: Given an aggregate type CURTYPE, and a member name NAME,
 
   if (retval == NULL)
     error (_("No symbol \"%s\" in namespace \"%s\"."), 
-          name, TYPE_NAME (curtype));
+          name, curtype->name ());
 
   return retval;
 }
                           const char *name, int want_address,
                           enum noside noside)
 {
-  const char *namespace_name = TYPE_NAME (curtype);
+  const char *namespace_name = curtype->name ();
   struct block_symbol sym;
   struct value *result;
 
     {
       warning (_("Couldn't retrieve complete object of RTTI "
                 "type %s; object may be in register(s)."), 
-              TYPE_NAME (real_type));
+              real_type->name ());
 
       return argp;
     }
 
 
   if (max_value_size > -1 && length > max_value_size)
     {
-      if (TYPE_NAME (type) != NULL)
+      if (type->name () != NULL)
        error (_("value of type `%s' requires %u bytes, which is more "
-                "than max-value-size"), TYPE_NAME (type), length);
+                "than max-value-size"), type->name (), length);
       else
        error (_("value requires %u bytes, which is more than "
                 "max-value-size"), length);