gdb: remove TYPE_NAME macro

Remove `TYPE_NAME`, changing all the call sites to use `type::name`
directly.  This is quite a big diff, but this was mostly done using sed
and coccinelle.  A few call sites were done by hand.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_NAME): Remove.  Change all cal sites to use
	type::name instead.
This commit is contained in:
Simon Marchi 2020-05-16 12:16:06 -04:00
parent d0e39ea27c
commit 7d93a1e0b6
46 changed files with 334 additions and 331 deletions

View file

@ -1,3 +1,8 @@
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> 2020-05-16 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <name, set_name>: New methods. * gdbtypes.h (struct type) <name, set_name>: New methods.

View file

@ -577,7 +577,7 @@ ada_get_field_index (const struct type *type, const char *field_name,
if (!maybe_missing) if (!maybe_missing)
error (_("Unable to find field %s in struct %s. Aborting"), error (_("Unable to find field %s in struct %s. Aborting"),
field_name, TYPE_NAME (struct_type)); field_name, struct_type->name ());
return -1; return -1;
} }
@ -1470,8 +1470,8 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
If our INDEX_DESC_TYPE was generated using the older encoding, If our INDEX_DESC_TYPE was generated using the older encoding,
the field type should be a meaningless integer type whose name the field type should be a meaningless integer type whose name
is not equal to the field name. */ is not equal to the field name. */
if (TYPE_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)) != NULL if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL
&& strcmp (TYPE_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)), && strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (),
TYPE_FIELD_NAME (index_desc_type, 0)) == 0) TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
return; return;
@ -3405,7 +3405,7 @@ See set/show multiple-symbol."));
SYMBOL_LINE (syms[i].symbol)); SYMBOL_LINE (syms[i].symbol));
} }
else if (is_enumeral 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); printf_filtered (("[%d] "), i + first_choice);
ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL, ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
@ -5158,7 +5158,7 @@ xget_renaming_scope (struct type *renaming_type)
So, to extract the scope, we search for the "___XR" extension, So, to extract the scope, we search for the "___XR" extension,
and then backtrack until we find the first "__". */ 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 *suffix = strstr (name, "___XR");
const char *last; const char *last;
@ -6506,7 +6506,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
if (type->code () != TYPE_CODE_PTR) if (type->code () != TYPE_CODE_PTR)
return 0; return 0;
name = TYPE_NAME (TYPE_TARGET_TYPE (type)); name = TYPE_TARGET_TYPE (type)->name ();
if (name == NULL) if (name == NULL)
return 0; return 0;
@ -6518,7 +6518,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
static int static int
ada_is_interface_tag (struct type *type) ada_is_interface_tag (struct type *type)
{ {
const char *name = TYPE_NAME (type); const char *name = type->name ();
if (name == NULL) if (name == NULL)
return 0; return 0;
@ -7834,7 +7834,7 @@ ada_prefer_type (struct type *type0, struct type *type1)
return 1; return 1;
else if (type0->code () == TYPE_CODE_VOID) else if (type0->code () == TYPE_CODE_VOID)
return 0; return 0;
else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL) else if (type1->name () == NULL && type0->name () != NULL)
return 1; return 1;
else if (ada_is_constrained_packed_array_type (type0)) else if (ada_is_constrained_packed_array_type (type0))
return 1; return 1;
@ -7843,8 +7843,8 @@ ada_prefer_type (struct type *type0, struct type *type1)
return 1; return 1;
else else
{ {
const char *type0_name = TYPE_NAME (type0); const char *type0_name = type0->name ();
const char *type1_name = TYPE_NAME (type1); const char *type1_name = type1->name ();
if (type0_name != NULL && strstr (type0_name, "___XR") != NULL if (type0_name != NULL && strstr (type0_name, "___XR") != NULL
&& (type1_name == NULL || strstr (type1_name, "___XR") == NULL)) && (type1_name == NULL || strstr (type1_name, "___XR") == NULL))
@ -7861,7 +7861,7 @@ ada_type_name (struct type *type)
{ {
if (type == NULL) if (type == NULL)
return NULL; return NULL;
return TYPE_NAME (type); return type->name ();
} }
/* Search the list of "descriptive" types associated to TYPE for a type /* Search the list of "descriptive" types associated to TYPE for a type
@ -8275,9 +8275,9 @@ ada_template_to_fixed_record_type_1 (struct type *type,
the current RTYPE length might be good enough for our purposes. */ the current RTYPE length might be good enough for our purposes. */
if (TYPE_LENGTH (type) <= 0) if (TYPE_LENGTH (type) <= 0)
{ {
if (TYPE_NAME (rtype)) if (rtype->name ())
warning (_("Invalid type size for `%s' detected: %s."), warning (_("Invalid type size for `%s' detected: %s."),
TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type))); rtype->name (), pulongest (TYPE_LENGTH (type)));
else else
warning (_("Invalid type size for <unnamed> detected: %s."), warning (_("Invalid type size for <unnamed> detected: %s."),
pulongest (TYPE_LENGTH (type))); pulongest (TYPE_LENGTH (type)));
@ -8563,10 +8563,10 @@ ada_is_redundant_range_encoding (struct type *range_type,
if (is_dynamic_type (range_type)) if (is_dynamic_type (range_type))
return 0; return 0;
if (TYPE_NAME (encoding_type) == NULL) if (encoding_type->name () == NULL)
return 0; return 0;
bounds_str = strstr (TYPE_NAME (encoding_type), "___XDLU_"); bounds_str = strstr (encoding_type->name (), "___XDLU_");
if (bounds_str == NULL) if (bounds_str == NULL)
return 0; return 0;
@ -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 /* 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 trying to get the type name of a value that has already been
printed (for instance, if the user did "print VAR; whatis $". */ 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) if (constrained_packed_array_p)
{ {
@ -9025,11 +9025,11 @@ ada_check_typedef (struct type *type)
type = check_typedef (type); type = check_typedef (type);
if (type == NULL || type->code () != TYPE_CODE_ENUM if (type == NULL || type->code () != TYPE_CODE_ENUM
|| !TYPE_STUB (type) || !TYPE_STUB (type)
|| TYPE_NAME (type) == NULL) || type->name () == NULL)
return type; return type;
else else
{ {
const char *name = TYPE_NAME (type); const char *name = type->name ();
struct type *type1 = ada_find_any_type (name); struct type *type1 = ada_find_any_type (name);
if (type1 == NULL) if (type1 == NULL)
@ -11424,8 +11424,7 @@ ada_is_gnat_encoded_fixed_point_type (struct type *type)
int int
ada_is_system_address_type (struct type *type) ada_is_system_address_type (struct type *type)
{ {
return (TYPE_NAME (type) return (type->name () && strcmp (type->name (), "system__address") == 0);
&& strcmp (TYPE_NAME (type), "system__address") == 0);
} }
/* Assuming that TYPE is the representation of an Ada fixed-point /* Assuming that TYPE is the representation of an Ada fixed-point
@ -11593,14 +11592,14 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
const char *subtype_info; const char *subtype_info;
gdb_assert (raw_type != NULL); 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) if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type); base_type = TYPE_TARGET_TYPE (raw_type);
else else
base_type = raw_type; base_type = raw_type;
name = TYPE_NAME (raw_type); name = raw_type->name ();
subtype_info = strstr (name, "___XD"); subtype_info = strstr (name, "___XD");
if (subtype_info == NULL) if (subtype_info == NULL)
{ {
@ -13075,7 +13074,7 @@ catch_assert_command (const char *arg_entry, int from_tty,
static int static int
ada_is_exception_sym (struct symbol *sym) 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 return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
&& SYMBOL_CLASS (sym) != LOC_BLOCK && SYMBOL_CLASS (sym) != LOC_BLOCK

View file

@ -180,8 +180,8 @@ print_range (struct type *type, struct ui_file *stream,
break; break;
default: default:
fprintf_filtered (stream, "%.*s", fprintf_filtered (stream, "%.*s",
ada_name_prefix_len (TYPE_NAME (type)), ada_name_prefix_len (type->name ()),
TYPE_NAME (type)); type->name ());
break; break;
} }
} }
@ -267,7 +267,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
const char *subtype_info; const char *subtype_info;
gdb_assert (raw_type != NULL); gdb_assert (raw_type != NULL);
name = TYPE_NAME (raw_type); name = raw_type->name ();
gdb_assert (name != NULL); gdb_assert (name != NULL);
if (raw_type->code () == TYPE_CODE_RANGE) if (raw_type->code () == TYPE_CODE_RANGE)

View file

@ -520,7 +520,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
type. Error out and give callers a chance to handle the failure type. Error out and give callers a chance to handle the failure
gracefully. */ gracefully. */
error (_("gen_fetch: Unsupported type code `%s'."), error (_("gen_fetch: Unsupported type code `%s'."),
TYPE_NAME (type)); type->name ());
} }
} }
@ -1533,7 +1533,7 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value,
if (!found) if (!found)
error (_("Couldn't find member named `%s' in struct/union/class `%s'"), error (_("Couldn't find member named `%s' in struct/union/class `%s'"),
field, TYPE_NAME (type)); field, type->name ());
} }
static int static int
@ -1629,7 +1629,7 @@ gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
if (!found) if (!found)
error (_("No symbol \"%s\" in namespace \"%s\"."), error (_("No symbol \"%s\" in namespace \"%s\"."),
name, TYPE_NAME (curtype)); name, curtype->name ());
return found; return found;
} }
@ -1644,7 +1644,7 @@ static int
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value, gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
const struct type *curtype, char *name) const struct type *curtype, char *name)
{ {
const char *namespace_name = TYPE_NAME (curtype); const char *namespace_name = curtype->name ();
struct block_symbol sym; struct block_symbol sym;
sym = cp_lookup_symbol_namespace (namespace_name, name, sym = cp_lookup_symbol_namespace (namespace_name, name,
@ -2354,9 +2354,9 @@ gen_expr_binop_rest (struct expression *exp,
if (type->code () != TYPE_CODE_ARRAY if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR) && type->code () != TYPE_CODE_PTR)
{ {
if (TYPE_NAME (type)) if (type->name ())
error (_("cannot subscript something of type `%s'"), error (_("cannot subscript something of type `%s'"),
TYPE_NAME (type)); type->name ());
else else
error (_("cannot subscript requested type")); error (_("cannot subscript requested type"));
} }

View file

@ -1431,13 +1431,13 @@ scalar_type:
0); } 0); }
| UNSIGNED type_name | UNSIGNED type_name
{ $$ = lookup_unsigned_typename (pstate->language (), { $$ = lookup_unsigned_typename (pstate->language (),
TYPE_NAME($2.type)); } $2.type->name ()); }
| UNSIGNED | UNSIGNED
{ $$ = lookup_unsigned_typename (pstate->language (), { $$ = lookup_unsigned_typename (pstate->language (),
"int"); } "int"); }
| SIGNED_KEYWORD type_name | SIGNED_KEYWORD type_name
{ $$ = lookup_signed_typename (pstate->language (), { $$ = lookup_signed_typename (pstate->language (),
TYPE_NAME($2.type)); } $2.type->name ()); }
| SIGNED_KEYWORD | SIGNED_KEYWORD
{ $$ = lookup_signed_typename (pstate->language (), { $$ = lookup_signed_typename (pstate->language (),
"int"); } "int"); }

View file

@ -84,7 +84,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
that would do the wrong thing. */ that would do the wrong thing. */
while (elttype) while (elttype)
{ {
const char *name = TYPE_NAME (elttype); const char *name = elttype->name ();
if (elttype->code () == TYPE_CODE_CHAR || !name) if (elttype->code () == TYPE_CODE_CHAR || !name)
{ {

View file

@ -129,7 +129,7 @@ c_print_type_1 (struct type *type,
if ((varstring != NULL && *varstring != '\0') if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets; /* Need a space if going to print stars or brackets;
but not if we will print just a type name. */ 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_PTR || code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD || code == TYPE_CODE_METHOD
|| (code == TYPE_CODE_ARRAY || (code == TYPE_CODE_ARRAY
@ -206,8 +206,8 @@ c_print_typedef (struct type *type,
type = check_typedef (type); type = check_typedef (type);
fprintf_filtered (stream, "typedef "); fprintf_filtered (stream, "typedef ");
type_print (type, "", stream, -1); type_print (type, "", stream, -1);
if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0 if ((SYMBOL_TYPE (new_symbol))->name () == 0
|| strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
new_symbol->linkage_name ()) != 0 new_symbol->linkage_name ()) != 0
|| SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF) || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF)
fprintf_filtered (stream, " %s", new_symbol->print_name ()); fprintf_filtered (stream, " %s", new_symbol->print_name ());
@ -256,7 +256,7 @@ cp_type_print_derivation_info (struct ui_file *stream,
? "public" : (TYPE_FIELD_PROTECTED (type, i) ? "public" : (TYPE_FIELD_PROTECTED (type, i)
? "protected" : "private"), ? "protected" : "private"),
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : ""); BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
name = TYPE_NAME (TYPE_BASECLASS (type, i)); name = TYPE_BASECLASS (type, i)->name ();
if (name) if (name)
print_name_maybe_canonical (name, flags, stream); print_name_maybe_canonical (name, flags, stream);
else else
@ -373,7 +373,7 @@ c_type_print_varspec_prefix (struct type *type,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -391,7 +391,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_MEMBERPTR: case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, language, flags, podata); stream, show, 0, 0, language, flags, podata);
name = TYPE_NAME (TYPE_SELF_TYPE (type)); name = TYPE_SELF_TYPE (type)->name ();
if (name) if (name)
print_name_maybe_canonical (name, flags, stream); print_name_maybe_canonical (name, flags, stream);
else else
@ -406,7 +406,7 @@ c_type_print_varspec_prefix (struct type *type,
stream, show, 0, 0, language, flags, stream, show, 0, 0, language, flags,
podata); podata);
fprintf_filtered (stream, "("); fprintf_filtered (stream, "(");
name = TYPE_NAME (TYPE_SELF_TYPE (type)); name = TYPE_SELF_TYPE (type)->name ();
if (name) if (name)
print_name_maybe_canonical (name, flags, stream); print_name_maybe_canonical (name, flags, stream);
else else
@ -762,7 +762,7 @@ c_type_print_varspec_suffix (struct type *type,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -1067,13 +1067,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
enum}" tag for unnamed struct/union/enum's, which we don't enum}" tag for unnamed struct/union/enum's, which we don't
want to print. */ want to print. */
if (TYPE_NAME (type) != NULL if (type->name () != NULL
&& !startswith (TYPE_NAME (type), "{unnamed")) && !startswith (type->name (), "{unnamed"))
{ {
/* When printing the tag name, we are still effectively /* When printing the tag name, we are still effectively
printing in the outer context, hence the use of FLAGS printing in the outer context, hence the use of FLAGS
here. */ here. */
print_name_maybe_canonical (TYPE_NAME (type), flags, stream); print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0) if (show > 0)
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
} }
@ -1082,10 +1082,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
{ {
/* If we just printed a tag name, no need to print anything /* If we just printed a tag name, no need to print anything
else. */ else. */
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
fprintf_filtered (stream, "{...}"); fprintf_filtered (stream, "{...}");
} }
else if (show > 0 || TYPE_NAME (type) == NULL) else if (show > 0 || type->name () == NULL)
{ {
struct type *basetype; struct type *basetype;
int vptr_fieldno; int vptr_fieldno;
@ -1247,7 +1247,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i); int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
const char *method_name = TYPE_FN_FIELDLIST_NAME (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, int is_constructor = name && strcmp (method_name,
name) == 0; name) == 0;
@ -1480,7 +1480,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
always just print the type name directly from the type. */ always just print the type name directly from the type. */
if (show <= 0 if (show <= 0
&& TYPE_NAME (type) != NULL) && type->name () != NULL)
{ {
c_type_print_modifier (type, stream, 0, 1, language); c_type_print_modifier (type, stream, 0, 1, language);
@ -1505,7 +1505,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "enum "); fprintf_filtered (stream, "enum ");
} }
print_name_maybe_canonical (TYPE_NAME (type), flags, stream); print_name_maybe_canonical (type->name (), flags, stream);
return; return;
} }
@ -1516,7 +1516,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_TYPEDEF: case TYPE_CODE_TYPEDEF:
/* If we get here, the typedef doesn't have a name, and we /* If we get here, the typedef doesn't have a name, and we
couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */ couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */
gdb_assert (TYPE_NAME (type) == NULL); gdb_assert (type->name () == NULL);
gdb_assert (TYPE_TARGET_TYPE (type) == NULL); gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
fprintf_styled (stream, metadata_style.style (), fprintf_styled (stream, metadata_style.style (),
_("<unnamed typedef>")); _("<unnamed typedef>"));
@ -1556,10 +1556,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
tag for unnamed struct/union/enum's, which we don't tag for unnamed struct/union/enum's, which we don't
want to print. */ want to print. */
if (TYPE_NAME (type) != NULL if (type->name () != NULL
&& !startswith (TYPE_NAME (type), "{unnamed")) && !startswith (type->name (), "{unnamed"))
{ {
print_name_maybe_canonical (TYPE_NAME (type), flags, stream); print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0) if (show > 0)
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
} }
@ -1569,10 +1569,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
{ {
/* If we just printed a tag name, no need to print anything /* If we just printed a tag name, no need to print anything
else. */ else. */
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
fprintf_filtered (stream, "{...}"); fprintf_filtered (stream, "{...}");
} }
else if (show > 0 || TYPE_NAME (type) == NULL) else if (show > 0 || type->name () == NULL)
{ {
LONGEST lastval = 0; LONGEST lastval = 0;
@ -1588,8 +1588,8 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
{ {
struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type)); struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_NAME (underlying) != NULL) if (underlying->name () != NULL)
fprintf_filtered (stream, ": %s ", TYPE_NAME (underlying)); fprintf_filtered (stream, ": %s ", underlying->name ());
} }
fprintf_filtered (stream, "{"); fprintf_filtered (stream, "{");
@ -1622,7 +1622,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
c_type_print_modifier (type, stream, 0, 1, language); c_type_print_modifier (type, stream, 0, 1, language);
fprintf_filtered (stream, "flag "); fprintf_filtered (stream, "flag ");
print_name_maybe_canonical (TYPE_NAME (type), flags, stream); print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0) if (show > 0)
{ {
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
@ -1684,7 +1684,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_NAMESPACE: case TYPE_CODE_NAMESPACE:
fputs_filtered ("namespace ", stream); fputs_filtered ("namespace ", stream);
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
break; break;
default: default:
@ -1692,10 +1692,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
as fundamental types. For these, just print whatever the as fundamental types. For these, just print whatever the
type name is, as recorded in the type itself. If there is no type name is, as recorded in the type itself. If there is no
type name, then complain. */ type name, then complain. */
if (TYPE_NAME (type) != NULL) if (type->name () != NULL)
{ {
c_type_print_modifier (type, stream, 0, 1, language); 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 else
{ {

View file

@ -78,7 +78,7 @@ c_textual_element_type (struct type *type, char format)
while (iter_type) while (iter_type)
{ {
/* Check the name of the 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; return 1;
if (iter_type->code () != TYPE_CODE_TYPEDEF) if (iter_type->code () != TYPE_CODE_TYPEDEF)
@ -521,11 +521,11 @@ c_value_print (struct value *val, struct ui_file *stream,
(Don't use c_textual_element_type here; quoted strings (Don't use c_textual_element_type here; quoted strings
are always exactly (char *), (wchar_t *), or the like. */ are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR if (original_type->code () == TYPE_CODE_PTR
&& TYPE_NAME (original_type) == NULL && original_type->name () == NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (original_type)) != NULL && TYPE_TARGET_TYPE (original_type)->name () != NULL
&& (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (original_type)), && (strcmp (TYPE_TARGET_TYPE (original_type)->name (),
"char") == 0 "char") == 0
|| textual_name (TYPE_NAME (TYPE_TARGET_TYPE (original_type))))) || textual_name (TYPE_TARGET_TYPE (original_type)->name ())))
{ {
/* Print nothing. */ /* Print nothing. */
} }
@ -598,14 +598,14 @@ c_value_print (struct value *val, struct ui_file *stream,
< TYPE_LENGTH (value_enclosing_type (val))))) < TYPE_LENGTH (value_enclosing_type (val)))))
val = value_cast (real_type, val); val = value_cast (real_type, val);
fprintf_filtered (stream, "(%s%s) ", fprintf_filtered (stream, "(%s%s) ",
TYPE_NAME (real_type), real_type->name (),
full ? "" : _(" [incomplete object]")); full ? "" : _(" [incomplete object]"));
} }
else if (type != check_typedef (value_enclosing_type (val))) else if (type != check_typedef (value_enclosing_type (val)))
{ {
/* No RTTI information, so let's do our best. */ /* No RTTI information, so let's do our best. */
fprintf_filtered (stream, "(%s ?) ", fprintf_filtered (stream, "(%s ?) ",
TYPE_NAME (value_enclosing_type (val))); value_enclosing_type (val)->name ());
val = value_cast (value_enclosing_type (val), val); val = value_cast (value_enclosing_type (val), val);
} }
} }

View file

@ -144,7 +144,7 @@ c_is_path_expr_parent (const struct varobj *var)
/* Anonymous unions and structs are also not path_expr parents. */ /* Anonymous unions and structs are also not path_expr parents. */
if ((type->code () == TYPE_CODE_STRUCT if ((type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION) || type->code () == TYPE_CODE_UNION)
&& TYPE_NAME (type) == NULL) && type->name () == NULL)
{ {
const struct varobj *parent = var->parent; const struct varobj *parent = var->parent;

View file

@ -1463,13 +1463,13 @@ patch_type (struct type *type, struct type *real_type)
TYPE_FIELDS (real_target), TYPE_FIELDS (real_target),
field_size); field_size);
if (TYPE_NAME (real_target)) if (real_target->name ())
{ {
/* The previous copy of TYPE_NAME is allocated by /* The previous copy of TYPE_NAME is allocated by
process_coff_symbol. */ process_coff_symbol. */
if (TYPE_NAME (target)) if (target->name ())
xfree ((char*) TYPE_NAME (target)); xfree ((char*) target->name ());
target->set_name (xstrdup (TYPE_NAME (real_target))); target->set_name (xstrdup (real_target->name ()));
} }
} }
@ -1658,7 +1658,7 @@ process_coff_symbol (struct coff_symbol *cs,
SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* If type has no name, give it one. */ /* 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 if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC) || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
@ -1715,7 +1715,7 @@ process_coff_symbol (struct coff_symbol *cs,
/* Some compilers try to be helpful by inventing "fake" /* Some compilers try to be helpful by inventing "fake"
names for anonymous enums, structures, and unions, like names for anonymous enums, structures, and unions, like
"~0fake" or ".0fake". Thanks, but no thanks... */ "~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 if (sym->linkage_name () != NULL
&& *sym->linkage_name () != '~' && *sym->linkage_name () != '~'
&& *sym->linkage_name () != '.') && *sym->linkage_name () != '.')

View file

@ -201,7 +201,7 @@ convert_int (compile_c_instance *context, struct type *type)
} }
return context->plugin ().int_type (TYPE_UNSIGNED (type), return context->plugin ().int_type (TYPE_UNSIGNED (type),
TYPE_LENGTH (type), TYPE_LENGTH (type),
TYPE_NAME (type)); type->name ());
} }
else else
return context->plugin ().int_type_v0 (TYPE_UNSIGNED (type), return context->plugin ().int_type_v0 (TYPE_UNSIGNED (type),
@ -215,7 +215,7 @@ convert_float (compile_c_instance *context, struct type *type)
{ {
if (context->plugin ().version () >= GCC_C_FE_VERSION_1) if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
return context->plugin ().float_type (TYPE_LENGTH (type), return context->plugin ().float_type (TYPE_LENGTH (type),
TYPE_NAME (type)); type->name ());
else else
return context->plugin ().float_type_v0 (TYPE_LENGTH (type)); return context->plugin ().float_type_v0 (TYPE_LENGTH (type));
} }

View file

@ -364,7 +364,7 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
} }
else else
{ {
if (TYPE_NAME (type) == nullptr) if (type->name () == nullptr)
{ {
/* Anonymous type */ /* Anonymous type */
@ -383,8 +383,8 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
{ {
scope_component comp scope_component comp
= { = {
decl_name (TYPE_NAME (type)).get (), decl_name (type->name ()).get (),
lookup_symbol (TYPE_NAME (type), block (), VAR_DOMAIN, nullptr) lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
}; };
scope.push_back (comp); scope.push_back (comp);
} }
@ -515,13 +515,13 @@ compile_cplus_convert_typedef (compile_cplus_instance *instance,
struct type *type, struct type *type,
enum gcc_cp_symbol_kind nested_access) 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) if (scope.nested_type () != GCC_TYPE_NONE)
return scope.nested_type (); return scope.nested_type ();
gdb::unique_xmalloc_ptr<char> name 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. */ /* Make sure the scope for this type has been pushed. */
instance->enter_scope (std::move (scope)); instance->enter_scope (std::move (scope));
@ -807,10 +807,10 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
/* Get the decl name of this type. */ /* Get the decl name of this type. */
gdb::unique_xmalloc_ptr<char> name 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. */ /* 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) if (scope.nested_type () != GCC_TYPE_NONE)
{ {
@ -913,7 +913,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
bool scoped_enum_p = false; bool scoped_enum_p = false;
/* Create a new scope for this type. */ /* 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) if (scope.nested_type () != GCC_TYPE_NONE)
{ {
@ -923,7 +923,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
} }
gdb::unique_xmalloc_ptr<char> name gdb::unique_xmalloc_ptr<char> name
= compile_cplus_instance::decl_name (TYPE_NAME (type)); = compile_cplus_instance::decl_name (type->name ());
/* Push all scopes. */ /* Push all scopes. */
instance->enter_scope (std::move (scope)); instance->enter_scope (std::move (scope));
@ -1022,7 +1022,7 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type)
} }
return instance->plugin ().get_int_type 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. */ /* Convert a floating-point type to its gcc representation. */
@ -1032,7 +1032,7 @@ compile_cplus_convert_float (compile_cplus_instance *instance,
struct type *type) struct type *type)
{ {
return instance->plugin ().get_float_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. */ /* Convert the 'void' type to its gcc representation. */
@ -1102,9 +1102,9 @@ static gcc_type
compile_cplus_convert_namespace (compile_cplus_instance *instance, compile_cplus_convert_namespace (compile_cplus_instance *instance,
struct type *type) 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 gdb::unique_xmalloc_ptr<char> name
= compile_cplus_instance::decl_name (TYPE_NAME (type)); = compile_cplus_instance::decl_name (type->name ());
/* Push scope. */ /* Push scope. */
instance->enter_scope (std::move (scope)); instance->enter_scope (std::move (scope));

View file

@ -1120,7 +1120,7 @@ add_struct_fields (struct type *type, completion_list &output,
{ {
if (!computed_type_name) if (!computed_type_name)
{ {
type_name = TYPE_NAME (type); type_name = type->name ();
computed_type_name = 1; computed_type_name = 1;
} }
/* Omit constructors from the completion list. */ /* Omit constructors from the completion list. */

View file

@ -224,7 +224,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
/* If TYPE_NAME is NULL, abandon trying to find this symbol. /* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++, This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */ which outputs no name for the container class. */
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
return {}; return {};
/* Look for symbol NAME in this class. */ /* Look for symbol NAME in this class. */
@ -918,7 +918,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
if (symbol_lookup_debug) 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, fprintf_unfiltered (gdb_stdlog,
"cp_lookup_nested_symbol (%s, %s, %s, %s)\n", "cp_lookup_nested_symbol (%s, %s, %s, %s)\n",

View file

@ -207,11 +207,11 @@ inspect_type (struct demangle_parse_info *info,
If the symbol is typedef and its type name is the same If the symbol is typedef and its type name is the same
as the symbol's name, e.g., "typedef struct foo foo;". */ as the symbol's name, e.g., "typedef struct foo foo;". */
if (TYPE_NAME (type) != nullptr if (type->name () != nullptr
&& strcmp (TYPE_NAME (type), name) == 0) && strcmp (type->name (), name) == 0)
return 0; return 0;
is_anon = (TYPE_NAME (type) == NULL is_anon = (type->name () == NULL
&& (type->code () == TYPE_CODE_ENUM && (type->code () == TYPE_CODE_ENUM
|| type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)); || type->code () == TYPE_CODE_UNION));
@ -1278,7 +1278,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
type = TYPE_TARGET_TYPE (type); type = TYPE_TARGET_TYPE (type);
} }
type_name = TYPE_NAME (type); type_name = type->name ();
if (type_name == NULL) if (type_name == NULL)
return; return;

View file

@ -61,7 +61,7 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
int int
cp_is_vtbl_ptr_type (struct type *type) 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)); return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
} }
@ -207,7 +207,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "\n"); fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream); print_spaces_filtered (2 + 2 * recurse, stream);
fputs_filtered ("members of ", stream); fputs_filtered ("members of ", stream);
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
fputs_filtered (":", stream); fputs_filtered (":", stream);
} }
} }
@ -411,7 +411,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
LONGEST boffset = 0; LONGEST boffset = 0;
int skip = 0; int skip = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); 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; struct value *base_val = NULL;
if (BASETYPE_VIA_VIRTUAL (type, i)) if (BASETYPE_VIA_VIRTUAL (type, i))
@ -708,7 +708,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
const char *name; const char *name;
fputs_filtered (prefix, stream); fputs_filtered (prefix, stream);
name = TYPE_NAME (self_type); name = self_type->name ();
if (name) if (name)
fputs_filtered (name, stream); fputs_filtered (name, stream);
else else

View file

@ -131,7 +131,7 @@ d_lookup_symbol (const struct language_defn *langdef,
return {}; return {};
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol))); type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
classname = TYPE_NAME (type); classname = type->name ();
nested = name; nested = name;
} }
else else

View file

@ -9342,13 +9342,13 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
field at index 1 and the data-less field at index 2. */ field at index 1 and the data-less field at index 2. */
TYPE_FIELD (type, 1) = saved_field; TYPE_FIELD (type, 1) = saved_field;
TYPE_FIELD_NAME (type, 1) 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 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))); TYPE_FIELD_NAME (type, 1)));
const char *dataless_name const char *dataless_name
= rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type), = rust_fully_qualify (&objfile->objfile_obstack, type->name (),
name); name);
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0, struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
dataless_name); dataless_name);
@ -9372,11 +9372,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
struct type *field_type = TYPE_FIELD_TYPE (type, 0); struct type *field_type = TYPE_FIELD_TYPE (type, 0);
const char *variant_name 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; TYPE_FIELD_NAME (type, 0) = variant_name;
field_type->set_name field_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack, (rust_fully_qualify (&objfile->objfile_obstack,
TYPE_NAME (type), variant_name)); type->name (), variant_name));
} }
else else
{ {
@ -9460,7 +9460,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
That name can be used to look up the correct That name can be used to look up the correct
discriminant. */ discriminant. */
const char *variant_name 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); auto iter = discriminant_map.find (variant_name);
if (iter != discriminant_map.end ()) if (iter != discriminant_map.end ())
@ -9479,7 +9479,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
TYPE_FIELD_NAME (type, i) = variant_name; TYPE_FIELD_NAME (type, i) = variant_name;
sub_type->set_name sub_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack, (rust_fully_qualify (&objfile->objfile_obstack,
TYPE_NAME (type), variant_name)); type->name (), variant_name));
} }
/* Indicate that this is a variant type. */ /* Indicate that this is a variant type. */
@ -14494,7 +14494,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
handle_data_member_location (die, cu, fp); handle_data_member_location (die, cu, fp);
FIELD_BITSIZE (*fp) = 0; FIELD_BITSIZE (*fp) = 0;
FIELD_TYPE (*fp) = die_type (die, cu); FIELD_TYPE (*fp) = die_type (die, cu);
FIELD_NAME (*fp) = TYPE_NAME (fp->type); FIELD_NAME (*fp) = fp->type->name ();
} }
else else
gdb_assert_not_reached ("missing case in dwarf2_add_field"); gdb_assert_not_reached ("missing case in dwarf2_add_field");
@ -15703,7 +15703,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
if (i < TYPE_N_BASECLASSES (t)) if (i < TYPE_N_BASECLASSES (t))
complaint (_("virtual function table pointer " complaint (_("virtual function table pointer "
"not found when defining class '%s'"), "not found when defining class '%s'"),
TYPE_NAME (type) ? TYPE_NAME (type) : ""); type->name () ? type->name () : "");
} }
else else
{ {
@ -16497,7 +16497,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
std::vector<const char *> excludes; std::vector<const char *> excludes;
add_using_directive (using_directives (cu), add_using_directive (using_directives (cu),
previous_prefix, TYPE_NAME (type), NULL, previous_prefix, type->name (), NULL,
NULL, excludes, 0, &objfile->objfile_obstack); NULL, excludes, 0, &objfile->objfile_obstack);
} }
} }
@ -17260,7 +17260,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits) if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
tt = nullptr; 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); return dwarf2_init_float_type (objfile, bits, name, name_hint, byte_order);
} }
@ -17328,7 +17328,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct obstack *obstack struct obstack *obstack
= &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack; = &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack;
name = obconcat (obstack, "_Complex ", TYPE_NAME (type), name = obconcat (obstack, "_Complex ", type->name (),
nullptr); nullptr);
} }
type = init_type (objfile, TYPE_CODE_ERROR, bits, name); type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
@ -20904,7 +20904,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* The symbol's name is already allocated along /* The symbol's name is already allocated along
with this objfile, so we don't need to with this objfile, so we don't need to
duplicate it for the type. */ 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 ()); SYMBOL_TYPE (sym)->set_name (sym->search_name ());
} }
} }
@ -21656,18 +21656,18 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
DW_TAG_namespace DIEs with a name of "::" for the global namespace. DW_TAG_namespace DIEs with a name of "::" for the global namespace.
Work around this problem here. */ Work around this problem here. */
if (cu->language == language_cplus if (cu->language == language_cplus
&& strcmp (TYPE_NAME (parent_type), "::") == 0) && strcmp (parent_type->name (), "::") == 0)
return ""; return "";
/* We give a name to even anonymous namespaces. */ /* 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_class_type:
case DW_TAG_interface_type: case DW_TAG_interface_type:
case DW_TAG_structure_type: case DW_TAG_structure_type:
case DW_TAG_union_type: case DW_TAG_union_type:
case DW_TAG_module: case DW_TAG_module:
parent_type = read_type_die (parent, cu); parent_type = read_type_die (parent, cu);
if (TYPE_NAME (parent_type) != NULL) if (parent_type->name () != NULL)
return TYPE_NAME (parent_type); return parent_type->name ();
else else
/* An anonymous structure is only allowed non-static data /* An anonymous structure is only allowed non-static data
members; no typedefs, no member functions, et cetera. members; no typedefs, no member functions, et cetera.
@ -21702,8 +21702,8 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
parent_type = read_type_die (parent, cu); parent_type = read_type_die (parent, cu);
if (TYPE_DECLARED_CLASS (parent_type)) if (TYPE_DECLARED_CLASS (parent_type))
{ {
if (TYPE_NAME (parent_type) != NULL) if (parent_type->name () != NULL)
return TYPE_NAME (parent_type); return parent_type->name ();
return ""; return "";
} }
/* Fall through. */ /* Fall through. */

View file

@ -989,13 +989,13 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
function_name = NULL; function_name = NULL;
if (type->code () == TYPE_CODE_NAMESPACE) if (type->code () == TYPE_CODE_NAMESPACE)
{ {
function = cp_lookup_symbol_namespace (TYPE_NAME (type), function = cp_lookup_symbol_namespace (type->name (),
name, name,
get_selected_block (0), get_selected_block (0),
VAR_DOMAIN).symbol; VAR_DOMAIN).symbol;
if (function == NULL) if (function == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."), error (_("No symbol \"%s\" in namespace \"%s\"."),
name, TYPE_NAME (type)); name, type->name ());
tem = 1; tem = 1;
/* arg2 is left as NULL on purpose. */ /* arg2 is left as NULL on purpose. */
@ -2327,9 +2327,9 @@ evaluate_subexp_standard (struct type *expect_type,
if (type->code () != TYPE_CODE_ARRAY if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR) && type->code () != TYPE_CODE_PTR)
{ {
if (TYPE_NAME (type)) if (type->name ())
error (_("cannot subscript something of type `%s'"), error (_("cannot subscript something of type `%s'"),
TYPE_NAME (type)); type->name ());
else else
error (_("cannot subscript requested type")); error (_("cannot subscript requested type"));
} }
@ -2370,7 +2370,7 @@ evaluate_subexp_standard (struct type *expect_type,
else else
{ {
error (_("cannot subscript something of type `%s'"), error (_("cannot subscript something of type `%s'"),
TYPE_NAME (value_type (arg1))); value_type (arg1)->name ());
} }
} }
@ -2392,9 +2392,9 @@ evaluate_subexp_standard (struct type *expect_type,
break; break;
default: default:
if (TYPE_NAME (type)) if (type->name ())
error (_("cannot subscript something of type `%s'"), error (_("cannot subscript something of type `%s'"),
TYPE_NAME (type)); type->name ());
else else
error (_("cannot subscript requested type")); error (_("cannot subscript requested type"));
} }

View file

@ -87,7 +87,7 @@ print_subexp_standard (struct expression *exp, int *pos,
case OP_SCOPE: case OP_SCOPE:
myprec = PREC_PREFIX; myprec = PREC_PREFIX;
assoc = 0; assoc = 0;
fputs_filtered (TYPE_NAME (exp->elts[pc + 1].type), stream); fputs_filtered (exp->elts[pc + 1].type->name (), stream);
fputs_filtered ("::", stream); fputs_filtered ("::", stream);
nargs = longest_to_int (exp->elts[pc + 2].longconst); nargs = longest_to_int (exp->elts[pc + 2].longconst);
(*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1); (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);

View file

@ -70,7 +70,7 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
/* Need a space if going to print stars or brackets; but not if we /* Need a space if going to print stars or brackets; but not if we
will print just a type name. */ will print just a type name. */
|| ((show > 0 || ((show > 0
|| TYPE_NAME (type) == 0) || type->name () == 0)
&& (code == TYPE_CODE_FUNC && (code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD || code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY || code == TYPE_CODE_ARRAY
@ -114,7 +114,7 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -178,7 +178,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -332,14 +332,14 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
/* When SHOW is zero or less, and there is a valid type name, then always /* When SHOW is zero or less, and there is a valid type name, then always
just print the type name directly from the type. */ 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 = ""; const char *prefix = "";
if (type->code () == TYPE_CODE_UNION) if (type->code () == TYPE_CODE_UNION)
prefix = "Type, C_Union :: "; prefix = "Type, C_Union :: ";
else if (type->code () == TYPE_CODE_STRUCT) else if (type->code () == TYPE_CODE_STRUCT)
prefix = "Type "; prefix = "Type ";
fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type)); fprintfi_filtered (level, stream, "%s%s", prefix, type->name ());
return; return;
} }
@ -376,7 +376,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
{ {
gdbarch *gdbarch = get_type_arch (type); gdbarch *gdbarch = get_type_arch (type);
struct type *void_type = builtin_f_type (gdbarch)->builtin_void; 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; break;
@ -399,7 +399,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
through as TYPE_CODE_INT since dbxstclass.h is so through as TYPE_CODE_INT since dbxstclass.h is so
C-oriented, we must change these to "character" from "char". */ 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"); fprintfi_filtered (level, stream, "character");
else else
goto default_case; goto default_case;
@ -424,7 +424,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fprintfi_filtered (level, stream, "Type, C_Union :: "); fprintfi_filtered (level, stream, "Type, C_Union :: ");
else else
fprintfi_filtered (level, stream, "Type "); fprintfi_filtered (level, stream, "Type ");
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
/* According to the definition, /* According to the definition,
we only print structure elements in case show > 0. */ we only print structure elements in case show > 0. */
if (show > 0) if (show > 0)
@ -442,12 +442,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fputs_filtered ("\n", stream); fputs_filtered ("\n", stream);
} }
fprintfi_filtered (level, stream, "End Type "); fprintfi_filtered (level, stream, "End Type ");
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
} }
break; break;
case TYPE_CODE_MODULE: case TYPE_CODE_MODULE:
fprintfi_filtered (level, stream, "module %s", TYPE_NAME (type)); fprintfi_filtered (level, stream, "module %s", type->name ());
break; break;
default_case: default_case:
@ -456,8 +456,8 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
such as fundamental types. For these, just print whatever such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there the type name is, as recorded in the type itself. If there
is no type name, then complain. */ is no type name, then complain. */
if (TYPE_NAME (type) != NULL) if (type->name () != NULL)
fprintfi_filtered (level, stream, "%s", TYPE_NAME (type)); fprintfi_filtered (level, stream, "%s", type->name ());
else else
error (_("Invalid type code (%d) in symbol table."), type->code ()); error (_("Invalid type code (%d) in symbol table."), type->code ());
break; break;

View file

@ -1572,11 +1572,11 @@ type_name_or_error (struct type *type)
type = check_typedef (type); type = check_typedef (type);
name = TYPE_NAME (type); name = type->name ();
if (name != NULL) if (name != NULL)
return name; return name;
name = TYPE_NAME (saved_type); name = saved_type->name ();
objfile = TYPE_OBJFILE (saved_type); objfile = TYPE_OBJFILE (saved_type);
error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"), error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
name ? name : "<anonymous>", name ? name : "<anonymous>",
@ -1706,11 +1706,11 @@ lookup_template_type (const char *name, struct type *type,
{ {
struct symbol *sym; struct symbol *sym;
char *nam = (char *) char *nam = (char *)
alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4); alloca (strlen (name) + strlen (type->name ()) + 4);
strcpy (nam, name); strcpy (nam, name);
strcat (nam, "<"); strcat (nam, "<");
strcat (nam, TYPE_NAME (type)); strcat (nam, type->name ());
strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */ strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol; sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol;
@ -2213,7 +2213,7 @@ resolve_dynamic_array_or_string (struct type *type,
if the DWARF info is not correct. Issue a warning, if the DWARF info is not correct. Issue a warning,
and assume no byte/bit stride (leave bit_stride = 0). */ and assume no byte/bit stride (leave bit_stride = 0). */
warning (_("cannot determine array stride for type %s"), warning (_("cannot determine array stride for type %s"),
TYPE_NAME (type) ? TYPE_NAME (type) : "<no name>"); type->name () ? type->name () : "<no name>");
} }
} }
else else
@ -2764,7 +2764,7 @@ check_typedef (struct type *type)
if (currently_reading_symtab) if (currently_reading_symtab)
return make_qualified_type (type, instance_flags, NULL); 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 /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or
VAR_DOMAIN as appropriate? */ VAR_DOMAIN as appropriate? */
if (name == NULL) if (name == NULL)
@ -2817,7 +2817,7 @@ check_typedef (struct type *type)
&& opaque_type_resolution && opaque_type_resolution
&& !currently_reading_symtab) && !currently_reading_symtab)
{ {
const char *name = TYPE_NAME (type); const char *name = type->name ();
struct type *newtype; struct type *newtype;
if (name == NULL) if (name == NULL)
@ -2851,7 +2851,7 @@ check_typedef (struct type *type)
types. */ types. */
else if (TYPE_STUB (type) && !currently_reading_symtab) 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 /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
as appropriate? */ as appropriate? */
struct symbol *sym; struct symbol *sym;
@ -3297,10 +3297,10 @@ init_complex_type (const char *name, struct type *target_type)
{ {
char *new_name char *new_name
= (char *) TYPE_ALLOC (target_type, = (char *) TYPE_ALLOC (target_type,
strlen (TYPE_NAME (target_type)) strlen (target_type->name ())
+ strlen ("_Complex ") + 1); + strlen ("_Complex ") + 1);
strcpy (new_name, "_Complex "); strcpy (new_name, "_Complex ");
strcat (new_name, TYPE_NAME (target_type)); strcat (new_name, target_type->name ());
name = new_name; name = new_name;
} }
@ -3575,8 +3575,8 @@ int
class_types_same_p (const struct type *a, const struct type *b) class_types_same_p (const struct type *a, const struct type *b)
{ {
return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b) return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
|| (TYPE_NAME (a) && TYPE_NAME (b) || (a->name () && b->name ()
&& !strcmp (TYPE_NAME (a), TYPE_NAME (b)))); && !strcmp (a->name (), b->name ())));
} }
/* If BASE is an ancestor of DCLASS return the distance between them. /* If BASE is an ancestor of DCLASS return the distance between them.
@ -3929,8 +3929,8 @@ types_equal (struct type *a, struct type *b)
stubs. The types won't point to the same address, but they stubs. The types won't point to the same address, but they
really are the same. */ really are the same. */
if (TYPE_NAME (a) && TYPE_NAME (b) if (a->name () && b->name ()
&& strcmp (TYPE_NAME (a), TYPE_NAME (b)) == 0) && strcmp (a->name (), b->name ()) == 0)
return true; return true;
/* Check if identical after resolving typedefs. */ /* Check if identical after resolving typedefs. */
@ -4011,9 +4011,9 @@ check_types_equal (struct type *type1, struct type *type2,
|| TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2)) || TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2))
return false; return false;
if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2))) if (!compare_maybe_null_strings (type1->name (), type2->name ()))
return false; return false;
if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2))) if (!compare_maybe_null_strings (type1->name (), type2->name ()))
return false; return false;
if (type1->code () == TYPE_CODE_RANGE) if (type1->code () == TYPE_CODE_RANGE)
@ -4290,12 +4290,12 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
{ {
/* unsigned int -> unsigned int, or /* unsigned int -> unsigned int, or
unsigned long -> unsigned long */ unsigned long -> unsigned long */
if (integer_types_same_name_p (TYPE_NAME (parm), if (integer_types_same_name_p (parm->name (),
TYPE_NAME (arg))) arg->name ()))
return EXACT_MATCH_BADNESS; return EXACT_MATCH_BADNESS;
else if (integer_types_same_name_p (TYPE_NAME (arg), else if (integer_types_same_name_p (arg->name (),
"int") "int")
&& integer_types_same_name_p (TYPE_NAME (parm), && integer_types_same_name_p (parm->name (),
"long")) "long"))
/* unsigned int -> unsigned long */ /* unsigned int -> unsigned long */
return INTEGER_PROMOTION_BADNESS; return INTEGER_PROMOTION_BADNESS;
@ -4305,9 +4305,9 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
} }
else else
{ {
if (integer_types_same_name_p (TYPE_NAME (arg), if (integer_types_same_name_p (arg->name (),
"long") "long")
&& integer_types_same_name_p (TYPE_NAME (parm), && integer_types_same_name_p (parm->name (),
"int")) "int"))
/* signed long -> unsigned int */ /* signed long -> unsigned int */
return INTEGER_CONVERSION_BADNESS; return INTEGER_CONVERSION_BADNESS;
@ -4318,12 +4318,12 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
} }
else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg)) else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
{ {
if (integer_types_same_name_p (TYPE_NAME (parm), if (integer_types_same_name_p (parm->name (),
TYPE_NAME (arg))) arg->name ()))
return EXACT_MATCH_BADNESS; return EXACT_MATCH_BADNESS;
else if (integer_types_same_name_p (TYPE_NAME (arg), else if (integer_types_same_name_p (arg->name (),
"int") "int")
&& integer_types_same_name_p (TYPE_NAME (parm), && integer_types_same_name_p (parm->name (),
"long")) "long"))
return INTEGER_PROMOTION_BADNESS; return INTEGER_PROMOTION_BADNESS;
else else
@ -4629,8 +4629,8 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
/* Debugging only. */ /* Debugging only. */
fprintf_filtered (gdb_stderr, fprintf_filtered (gdb_stderr,
"------ Arg is %s [%d], parm is %s [%d]\n", "------ Arg is %s [%d], parm is %s [%d]\n",
TYPE_NAME (arg), arg->code (), arg->name (), arg->code (),
TYPE_NAME (parm), parm->code ()); parm->name (), parm->code ());
/* x -> y means arg of type x being supplied for parameter of type y. */ /* x -> y means arg of type x being supplied for parameter of type y. */
@ -4905,8 +4905,8 @@ recursive_dump_type (struct type *type, int spaces)
gdb_print_host_address (type, gdb_stdout); gdb_print_host_address (type, gdb_stdout);
printf_filtered ("\n"); printf_filtered ("\n");
printfi_filtered (spaces, "name '%s' (", printfi_filtered (spaces, "name '%s' (",
TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>"); type->name () ? type->name () : "<NULL>");
gdb_print_host_address (TYPE_NAME (type), gdb_stdout); gdb_print_host_address (type->name (), gdb_stdout);
printf_filtered (")\n"); printf_filtered (")\n");
printfi_filtered (spaces, "code 0x%x ", type->code ()); printfi_filtered (spaces, "code 0x%x ", type->code ());
switch (type->code ()) switch (type->code ())
@ -5289,8 +5289,8 @@ copy_type_recursive (struct objfile *objfile,
TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OBJFILE_OWNED (new_type) = 0;
TYPE_OWNER (new_type).gdbarch = get_type_arch (type); TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
if (TYPE_NAME (type)) if (type->name ())
new_type->set_name (xstrdup (TYPE_NAME (type))); new_type->set_name (xstrdup (type->name ()));
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type);

View file

@ -1416,7 +1416,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags #define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type #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_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
@ -1703,13 +1702,13 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
if the type has no name. */ if the type has no name. */
#define TYPE_SAFE_NAME(type) \ #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 /* * 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. */ type has a name, it is used; otherwise, a default is used. */
#define TYPE_ERROR_NAME(type) \ #define TYPE_ERROR_NAME(type) \
(TYPE_NAME (type) ? TYPE_NAME (type) : _("<error type>")) (type->name () ? type->name () : _("<error type>"))
/* Given TYPE, return its floatformat. */ /* Given TYPE, return its floatformat. */
const struct floatformat *floatformat_from_type (const struct type *type); const struct floatformat *floatformat_from_type (const struct type *type);

View file

@ -325,10 +325,10 @@ vb_match (struct type *type, int index, struct type *basetype)
if (TYPE_TARGET_TYPE (fieldtype) == basetype) if (TYPE_TARGET_TYPE (fieldtype) == basetype)
return 1; return 1;
if (TYPE_NAME (basetype) != NULL if (basetype->name () != NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (fieldtype)) != NULL && TYPE_TARGET_TYPE (fieldtype)->name () != NULL
&& strcmp (TYPE_NAME (basetype), && strcmp (basetype->name (),
TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))) == 0) TYPE_TARGET_TYPE (fieldtype)->name ()) == 0)
return 1; return 1;
return 0; return 0;
} }

View file

@ -92,7 +92,7 @@ gccgo_string_p (struct type *type)
if (target_type->code () == TYPE_CODE_INT if (target_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (target_type) == 1 && TYPE_LENGTH (target_type) == 1
&& strcmp (TYPE_NAME (target_type), "uint8") == 0) && strcmp (target_type->name (), "uint8") == 0)
return 1; return 1;
} }
} }
@ -107,8 +107,8 @@ static int
sixg_string_p (struct type *type) sixg_string_p (struct type *type)
{ {
if (TYPE_NFIELDS (type) == 2 if (TYPE_NFIELDS (type) == 2
&& TYPE_NAME (type) != NULL && type->name () != NULL
&& strcmp (TYPE_NAME (type), "string") == 0) && strcmp (type->name (), "string") == 0)
return 1; return 1;
return 0; return 0;

View file

@ -580,7 +580,7 @@ gdbscm_type_tag (SCM self)
if (type->code () == TYPE_CODE_STRUCT if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM) || type->code () == TYPE_CODE_ENUM)
tagname = TYPE_NAME (type); tagname = type->name ();
if (tagname == nullptr) if (tagname == nullptr)
return SCM_BOOL_F; return SCM_BOOL_F;
@ -597,9 +597,9 @@ gdbscm_type_name (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type; struct type *type = t_smob->type;
if (!TYPE_NAME (type)) if (!type->name ())
return SCM_BOOL_F; 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 /* (type-print-name <gdb:type>) -> string

View file

@ -1062,11 +1062,11 @@ call_function_by_hand_dummy (struct value *function,
auto info = language_pass_by_reference (param_type); auto info = language_pass_by_reference (param_type);
if (!info.copy_constructible) if (!info.copy_constructible)
error (_("expression cannot be evaluated because the type '%s' " 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) if (!info.destructible)
error (_("expression cannot be evaluated because the type '%s' " 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) if (info.trivially_copyable)
continue; continue;
@ -1091,14 +1091,14 @@ call_function_by_hand_dummy (struct value *function,
value *copy_ctor; value *copy_ctor;
value *cctor_args[2] = { clone_ptr, original_arg }; value *cctor_args[2] = { clone_ptr, original_arg };
find_overload_match (gdb::make_array_view (cctor_args, 2), find_overload_match (gdb::make_array_view (cctor_args, 2),
TYPE_NAME (param_type), METHOD, param_type->name (), METHOD,
&clone_ptr, nullptr, &copy_ctor, nullptr, &clone_ptr, nullptr, &copy_ctor, nullptr,
nullptr, 0, EVAL_NORMAL); nullptr, 0, EVAL_NORMAL);
if (copy_ctor == nullptr) if (copy_ctor == nullptr)
error (_("expression cannot be evaluated because a copy " error (_("expression cannot be evaluated because a copy "
"constructor for the type '%s' could not be found " "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, call_function_by_hand (copy_ctor, default_return_type,
gdb::make_array_view (cctor_args, 2)); gdb::make_array_view (cctor_args, 2));
@ -1130,7 +1130,7 @@ call_function_by_hand_dummy (struct value *function,
if (dtor_name == nullptr) if (dtor_name == nullptr)
error (_("expression cannot be evaluated because a destructor " error (_("expression cannot be evaluated because a destructor "
"for the type '%s' could not be found " "for the type '%s' could not be found "
"(maybe inlined?)"), TYPE_NAME (param_type)); "(maybe inlined?)"), param_type->name ());
value *dtor value *dtor
= find_function_in_inferior (dtor_name, 0); = find_function_in_inferior (dtor_name, 0);

View file

@ -999,7 +999,7 @@ language_lookup_primitive_type_1 (const struct language_arch_info *lai,
for (p = lai->primitive_type_vector; (*p) != NULL; p++) 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 p;
} }
return NULL; return NULL;
@ -1037,7 +1037,7 @@ language_alloc_type_symbol (enum language lang, struct type *type)
gdbarch = TYPE_OWNER (type).gdbarch; gdbarch = TYPE_OWNER (type).gdbarch;
symbol = new (gdbarch_obstack (gdbarch)) struct symbol (); symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
symbol->m_name = TYPE_NAME (type); symbol->m_name = type->name ();
symbol->set_language (lang, nullptr); symbol->set_language (lang, nullptr);
symbol->owner.arch = gdbarch; symbol->owner.arch = gdbarch;
SYMBOL_OBJFILE_OWNED (symbol) = 0; SYMBOL_OBJFILE_OWNED (symbol) = 0;

View file

@ -1222,7 +1222,7 @@ find_methods (struct type *t, enum language t_lang, const char *name,
std::vector<struct type *> *superclasses) std::vector<struct type *> *superclasses)
{ {
int ibase; 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 /* 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 unless we figure out how to get the physname without the name of

View file

@ -271,9 +271,9 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
else else
if (type->code () != TYPE_CODE_ARRAY) if (type->code () != TYPE_CODE_ARRAY)
{ {
if (TYPE_NAME (type)) if (type->name ())
error (_("cannot subscript something of type `%s'"), error (_("cannot subscript something of type `%s'"),
TYPE_NAME (type)); type->name ());
else else
error (_("cannot subscript requested type")); error (_("cannot subscript requested type"));
} }

View file

@ -163,8 +163,8 @@ m2_print_typedef (struct type *type, struct symbol *new_symbol,
{ {
type = check_typedef (type); type = check_typedef (type);
fprintf_filtered (stream, "TYPE "); fprintf_filtered (stream, "TYPE ");
if (!TYPE_NAME (SYMBOL_TYPE (new_symbol)) if (!SYMBOL_TYPE (new_symbol)->name ()
|| strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
new_symbol->linkage_name ()) != 0) new_symbol->linkage_name ()) != 0)
fprintf_filtered (stream, "%s = ", new_symbol->print_name ()); fprintf_filtered (stream, "%s = ", new_symbol->print_name ());
else else
@ -178,8 +178,8 @@ m2_print_typedef (struct type *type, struct symbol *new_symbol,
void void
m2_type_name (struct type *type, struct ui_file *stream) m2_type_name (struct type *type, struct ui_file *stream)
{ {
if (TYPE_NAME (type) != NULL) if (type->name () != NULL)
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
} }
/* m2_range - displays a Modula-2 subrange type. */ /* m2_range - displays a Modula-2 subrange type. */
@ -211,9 +211,9 @@ static void
m2_typedef (struct type *type, struct ui_file *stream, int show, m2_typedef (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags) 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); fputs_filtered (" = ", stream);
} }
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
@ -440,9 +440,9 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
if (m2_is_long_set (type)) 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) if (show == 0)
return 1; return 1;
fputs_filtered (" = ", stream); fputs_filtered (" = ", stream);
@ -530,11 +530,11 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags) int level, const struct type_print_options *flags)
{ {
/* Print the tag if it exists. */ /* 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) if (show > 0)
fprintf_filtered (stream, " = "); fprintf_filtered (stream, " = ");
} }
@ -595,10 +595,10 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
if (show < 0) if (show < 0)
{ {
/* If we just printed a tag name, no need to print anything else. */ /* 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, "(...)"); fprintf_filtered (stream, "(...)");
} }
else if (show > 0 || TYPE_NAME (type) == NULL) else if (show > 0 || type->name () == NULL)
{ {
fprintf_filtered (stream, "("); fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type); len = TYPE_NFIELDS (type);

View file

@ -1296,7 +1296,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
add_symbol (s, top_stack->cur_st, top_stack->cur_block); add_symbol (s, top_stack->cur_st, top_stack->cur_block);
/* Incomplete definitions of structs should not get a name. */ /* 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 && (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0
|| (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
&& SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION))) && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
@ -1675,8 +1675,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
(.Fxx or .xxfake or empty) for unnamed struct/union/enums. */ (.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
if (name[0] == '.' || name[0] == '\0') if (name[0] == '.' || name[0] == '\0')
tp->set_name (NULL); tp->set_name (NULL);
else if (TYPE_NAME (tp) == NULL else if (tp->name () == NULL
|| strcmp (TYPE_NAME (tp), name) != 0) || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack, tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name)); name));
} }
@ -1711,8 +1711,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
bad_tag_guess_complaint (sym_name); bad_tag_guess_complaint (sym_name);
tp->set_code (type_code); tp->set_code (type_code);
} }
if (TYPE_NAME (tp) == NULL if (tp->name () == NULL
|| strcmp (TYPE_NAME (tp), name) != 0) || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack, tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name)); name));
} }

View file

@ -1008,7 +1008,7 @@ opencl_print_type (struct type *type, const char *varstring,
{ {
type = check_typedef (type); type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& TYPE_NAME (type) != NULL) && type->name () != NULL)
show = 0; show = 0;
} }

View file

@ -669,7 +669,7 @@ qualified_name: typebase COLONCOLON name
if (type->code () != TYPE_CODE_STRUCT if (type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION) && type->code () != TYPE_CODE_UNION)
error (_("`%s' is not defined as an aggregate type."), error (_("`%s' is not defined as an aggregate type."),
TYPE_NAME (type)); type->name ());
write_exp_elt_opcode (pstate, OP_SCOPE); write_exp_elt_opcode (pstate, OP_SCOPE);
write_exp_elt_type (pstate, type); write_exp_elt_type (pstate, type);

View file

@ -140,7 +140,7 @@ pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
fprintf_filtered (stream, "%s%s ", fprintf_filtered (stream, "%s%s ",
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private", BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : ""); 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)"); fprintf_filtered (stream, "%s", name ? name : "(null)");
} }
if (i > 0) if (i > 0)
@ -211,7 +211,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -377,7 +377,7 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (type == 0) if (type == 0)
return; return;
if (TYPE_NAME (type) && show <= 0) if (type->name () && show <= 0)
return; return;
QUIT; QUIT;
@ -479,7 +479,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if ((type->code () == TYPE_CODE_PTR) if ((type->code () == TYPE_CODE_PTR)
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)) && (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); stream);
return; return;
} }
@ -487,9 +487,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
just print the type name directly from the type. */ just print the type name directly from the type. */
if (show <= 0 if (show <= 0
&& TYPE_NAME (type) != NULL) && type->name () != NULL)
{ {
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
return; return;
} }
@ -523,9 +523,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
only after args !! */ only after args !! */
break; break;
case TYPE_CODE_STRUCT: 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); fputs_filtered (" = ", stream);
} }
if (HAVE_CPLUS_STRUCT (type)) if (HAVE_CPLUS_STRUCT (type))
@ -539,9 +539,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
goto struct_union; goto struct_union;
case TYPE_CODE_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); fputs_filtered (" = ", stream);
} }
fprintf_filtered (stream, "case <?> of "); fprintf_filtered (stream, "case <?> of ");
@ -551,10 +551,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0) if (show < 0)
{ {
/* If we just printed a tag name, no need to print anything else. */ /* 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, "{...}"); 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); pascal_type_print_derivation_info (stream, type);
@ -739,9 +739,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
break; break;
case TYPE_CODE_ENUM: 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) if (show > 0)
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
} }
@ -752,10 +752,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0) if (show < 0)
{ {
/* If we just printed a tag name, no need to print anything else. */ /* 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, "(...)"); fprintf_filtered (stream, "(...)");
} }
else if (show > 0 || TYPE_NAME (type) == NULL) else if (show > 0 || type->name () == NULL)
{ {
fprintf_filtered (stream, "("); fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type); len = TYPE_NFIELDS (type);
@ -818,9 +818,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
such as fundamental types. For these, just print whatever such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there the type name is, as recorded in the type itself. If there
is no type name, then complain. */ 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 else
{ {

View file

@ -423,9 +423,9 @@ pascal_value_print (struct value *val, struct ui_file *stream,
/* Hack: remove (char *) for char strings. Their /* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */ type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR if (type->code () == TYPE_CODE_PTR
&& TYPE_NAME (type) == NULL && type->name () == NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL && TYPE_TARGET_TYPE (type)->name () != NULL
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0) && strcmp (TYPE_TARGET_TYPE (type)->name (), "char") == 0)
{ {
/* Print nothing. */ /* Print nothing. */
} }
@ -469,7 +469,7 @@ const char pascal_vtbl_ptr_name[] =
int int
pascal_object_is_vtbl_ptr_type (struct type *type) 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 return (type_name != NULL
&& strcmp (type_name, pascal_vtbl_ptr_name) == 0); && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
@ -564,7 +564,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "\n"); fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream); print_spaces_filtered (2 + 2 * recurse, stream);
fputs_filtered ("members of ", stream); fputs_filtered ("members of ", stream);
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
fputs_filtered (": ", stream); fputs_filtered (": ", stream);
} }
} }
@ -710,7 +710,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
{ {
LONGEST boffset = 0; LONGEST boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
const char *basename = TYPE_NAME (baseclass); const char *basename = baseclass->name ();
int skip = 0; int skip = 0;
if (BASETYPE_VIA_VIRTUAL (type, i)) if (BASETYPE_VIA_VIRTUAL (type, i))

View file

@ -393,9 +393,9 @@ typy_get_name (PyObject *self, void *closure)
{ {
struct type *type = ((type_object *) self)->type; struct type *type = ((type_object *) self)->type;
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
Py_RETURN_NONE; Py_RETURN_NONE;
return PyString_FromString (TYPE_NAME (type)); return PyString_FromString (type->name ());
} }
/* Return the type's tag, or None. */ /* Return the type's tag, or None. */
@ -408,7 +408,7 @@ typy_get_tag (PyObject *self, void *closure)
if (type->code () == TYPE_CODE_STRUCT if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM) || type->code () == TYPE_CODE_ENUM)
tagname = TYPE_NAME (type); tagname = type->name ();
if (tagname == nullptr) if (tagname == nullptr)
Py_RETURN_NONE; Py_RETURN_NONE;
@ -875,7 +875,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
std::string err; std::string err;
struct type *argtype; struct type *argtype;
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
{ {
PyErr_SetString (PyExc_RuntimeError, _("Null type name.")); PyErr_SetString (PyExc_RuntimeError, _("Null type name."));
return NULL; return NULL;
@ -884,7 +884,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
try try
{ {
/* Note -- this is not thread-safe. */ /* 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) catch (const gdb_exception &except)
{ {

View file

@ -1392,7 +1392,7 @@ register_dump::dump (ui_file *file)
{ {
static const char blt[] = "builtin_type"; 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 (t == NULL)
{ {
if (!footnote_register_type_name_null) if (!footnote_register_type_name_null)

View file

@ -576,8 +576,8 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum)
if (flen == 8 if (flen == 8
&& type->code () == TYPE_CODE_FLT && type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == flen && TYPE_LENGTH (type) == flen
&& (strcmp (TYPE_NAME (type), "builtin_type_ieee_double") == 0 && (strcmp (type->name (), "builtin_type_ieee_double") == 0
|| strcmp (TYPE_NAME (type), "double") == 0)) || strcmp (type->name (), "double") == 0))
type = riscv_fpreg_d_type (gdbarch); type = riscv_fpreg_d_type (gdbarch);
} }

View file

@ -110,8 +110,8 @@ rust_tuple_type_p (struct type *type)
nothing else in the debuginfo to distinguish a tuple from a nothing else in the debuginfo to distinguish a tuple from a
struct. */ struct. */
return (type->code () == TYPE_CODE_STRUCT return (type->code () == TYPE_CODE_STRUCT
&& TYPE_NAME (type) != NULL && type->name () != NULL
&& TYPE_NAME (type)[0] == '('); && type->name ()[0] == '(');
} }
/* Return true if all non-static fields of a structlike type are in a /* Return true if all non-static fields of a structlike type are in a
@ -158,9 +158,9 @@ static bool
rust_slice_type_p (struct type *type) rust_slice_type_p (struct type *type)
{ {
return (type->code () == TYPE_CODE_STRUCT return (type->code () == TYPE_CODE_STRUCT
&& TYPE_NAME (type) != NULL && type->name () != NULL
&& (strncmp (TYPE_NAME (type), "&[", 2) == 0 && (strncmp (type->name (), "&[", 2) == 0
|| strcmp (TYPE_NAME (type), "&str") == 0)); || strcmp (type->name (), "&str") == 0));
} }
/* Return true if TYPE is a range type, otherwise false. */ /* Return true if TYPE is a range type, otherwise false. */
@ -172,8 +172,8 @@ rust_range_type_p (struct type *type)
if (type->code () != TYPE_CODE_STRUCT if (type->code () != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (type) > 2 || TYPE_NFIELDS (type) > 2
|| TYPE_NAME (type) == NULL || type->name () == NULL
|| strstr (TYPE_NAME (type), "::Range") == NULL) || strstr (type->name (), "::Range") == NULL)
return false; return false;
if (TYPE_NFIELDS (type) == 0) if (TYPE_NFIELDS (type) == 0)
@ -202,8 +202,8 @@ rust_range_type_p (struct type *type)
static bool static bool
rust_inclusive_range_type_p (struct type *type) rust_inclusive_range_type_p (struct type *type)
{ {
return (strstr (TYPE_NAME (type), "::RangeInclusive") != NULL return (strstr (type->name (), "::RangeInclusive") != NULL
|| strstr (TYPE_NAME (type), "::RangeToInclusive") != NULL); || strstr (type->name (), "::RangeToInclusive") != NULL);
} }
/* Return true if TYPE seems to be the type "u8", otherwise false. */ /* Return true if TYPE seems to be the type "u8", otherwise false. */
@ -243,7 +243,7 @@ rust_is_string_type_p (struct type *type)
|| (type->code () == TYPE_CODE_STRUCT || (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type) && !rust_enum_p (type)
&& rust_slice_type_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 /* If VALUE represents a trait object pointer, return the underlying
@ -379,7 +379,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
int first_field; int first_field;
struct type *type = check_typedef (value_type (val)); 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 /* If what we are printing here is actually a string within a
structure then VAL will be the original parent value, while TYPE structure then VAL will be the original parent value, while TYPE
@ -399,13 +399,13 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
if (!is_tuple) if (!is_tuple)
{ {
if (TYPE_NAME (type) != NULL) if (type->name () != NULL)
fprintf_filtered (stream, "%s", TYPE_NAME (type)); fprintf_filtered (stream, "%s", type->name ());
if (TYPE_NFIELDS (type) == 0) if (TYPE_NFIELDS (type) == 0)
return; return;
if (TYPE_NAME (type) != NULL) if (type->name () != NULL)
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
} }
@ -479,7 +479,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
{ {
/* Print the enum type name here to be more clear. */ /* Print the enum type name here to be more clear. */
fprintf_filtered (stream, _("%s {%p[<No data fields>%p]}"), fprintf_filtered (stream, _("%s {%p[<No data fields>%p]}"),
TYPE_NAME (type), type->name (),
metadata_style.style ().ptr (), nullptr); metadata_style.style ().ptr (), nullptr);
return; return;
} }
@ -492,7 +492,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
bool is_tuple = rust_tuple_struct_type_p (variant_type); 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) if (nfields == 0)
{ {
/* In case of a nullary variant like 'None', just output /* In case of a nullary variant like 'None', just output
@ -599,7 +599,7 @@ rust_value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_INT: case TYPE_CODE_INT:
/* Recognize the unit type. */ /* Recognize the unit type. */
if (TYPE_UNSIGNED (type) && TYPE_LENGTH (type) == 0 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); fputs_filtered ("()", stream);
break; break;
@ -676,7 +676,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
/* Print a tuple type simply. */ /* Print a tuple type simply. */
if (rust_tuple_type_p (type)) if (rust_tuple_type_p (type))
{ {
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
return; return;
} }
@ -693,7 +693,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
/* Compute properties of TYPE here because, in the enum case, the /* Compute properties of TYPE here because, in the enum case, the
rest of the code ends up looking only at the variant part. */ 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_struct = rust_tuple_struct_type_p (type);
bool is_tuple = rust_tuple_type_p (type); bool is_tuple = rust_tuple_type_p (type);
bool is_enum = rust_enum_p (type); bool is_enum = rust_enum_p (type);
@ -824,14 +824,14 @@ rust_internal_print_type (struct type *type, const char *varstring,
{ {
QUIT; QUIT;
if (show <= 0 if (show <= 0
&& TYPE_NAME (type) != NULL) && type->name () != NULL)
{ {
/* Rust calls the unit type "void" in its debuginfo, /* Rust calls the unit type "void" in its debuginfo,
but we don't want to print it as that. */ but we don't want to print it as that. */
if (type->code () == TYPE_CODE_VOID) if (type->code () == TYPE_CODE_VOID)
fputs_filtered ("()", stream); fputs_filtered ("()", stream);
else else
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
return; return;
} }
@ -903,11 +903,11 @@ rust_internal_print_type (struct type *type, const char *varstring,
int len = 0; int len = 0;
fputs_filtered ("enum ", stream); 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); fputs_filtered (" ", stream);
len = strlen (TYPE_NAME (type)); len = strlen (type->name ());
} }
fputs_filtered ("{\n", stream); fputs_filtered ("{\n", stream);
@ -918,7 +918,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT; QUIT;
if (len > 0 if (len > 0
&& strncmp (name, TYPE_NAME (type), len) == 0 && strncmp (name, type->name (), len) == 0
&& name[len] == ':' && name[len] == ':'
&& name[len + 1] == ':') && name[len + 1] == ':')
name += len + 2; name += len + 2;
@ -933,8 +933,8 @@ rust_internal_print_type (struct type *type, const char *varstring,
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
{ {
if (TYPE_NAME (type) != nullptr) if (type->name () != nullptr)
fputs_filtered (TYPE_NAME (type), stream); fputs_filtered (type->name (), stream);
else else
{ {
/* We currently can't distinguish between pointers and /* We currently can't distinguish between pointers and
@ -1160,10 +1160,10 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
&& type->code () != TYPE_CODE_ENUM) && type->code () != TYPE_CODE_ENUM)
|| rust_tuple_type_p (type)) || rust_tuple_type_p (type))
error (_("Method calls only supported on struct or enum types")); 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")); 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); block = get_selected_block (0);
sym = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL); sym = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL);
@ -1465,7 +1465,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
"usize"); "usize");
const char *new_name = ((type != nullptr const char *new_name = ((type != nullptr
&& rust_slice_type_p (type)) && rust_slice_type_p (type))
? TYPE_NAME (type) : "&[*gdb*]"); ? type->name () : "&[*gdb*]");
slice = rust_slice_type (new_name, value_type (result), usize); slice = rust_slice_type (new_name, value_type (result), usize);
@ -1667,7 +1667,7 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (rust_empty_enum_p (type)) if (rust_empty_enum_p (type))
error (_("Cannot access field %d of empty enum %s"), error (_("Cannot access field %d of empty enum %s"),
field_number, TYPE_NAME (type)); field_number, type->name ());
int fieldno = rust_enum_variant (type); int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type); lhs = value_primitive_field (lhs, 0, fieldno, type);
@ -1683,13 +1683,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (outer_type != NULL) if (outer_type != NULL)
error(_("Cannot access field %d of variant %s::%s, " error(_("Cannot access field %d of variant %s::%s, "
"there are only %d fields"), "there are only %d fields"),
field_number, TYPE_NAME (outer_type), field_number, outer_type->name (),
rust_last_path_segment (TYPE_NAME (type)), rust_last_path_segment (type->name ()),
nfields); nfields);
else else
error(_("Cannot access field %d of %s, " error(_("Cannot access field %d of %s, "
"there are only %d fields"), "there are only %d fields"),
field_number, TYPE_NAME (type), nfields); field_number, type->name (), nfields);
} }
/* Tuples are tuple structs too. */ /* Tuples are tuple structs too. */
@ -1697,13 +1697,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
{ {
if (outer_type != NULL) if (outer_type != NULL)
error(_("Variant %s::%s is not a tuple variant"), error(_("Variant %s::%s is not a tuple variant"),
TYPE_NAME (outer_type), outer_type->name (),
rust_last_path_segment (TYPE_NAME (type))); rust_last_path_segment (type->name ()));
else else
error(_("Attempting to access anonymous field %d " error(_("Attempting to access anonymous field %d "
"of %s, which is not a tuple, tuple struct, or " "of %s, which is not a tuple, tuple struct, or "
"tuple-like variant"), "tuple-like variant"),
field_number, TYPE_NAME (type)); field_number, type->name ());
} }
result = value_primitive_field (lhs, 0, field_number, type); result = value_primitive_field (lhs, 0, field_number, type);
@ -1735,7 +1735,7 @@ tuple structs, and tuple-like enum variants"));
if (rust_empty_enum_p (type)) if (rust_empty_enum_p (type))
error (_("Cannot access field %s of empty enum %s"), error (_("Cannot access field %s of empty enum %s"),
field_name, TYPE_NAME (type)); field_name, type->name ());
int fieldno = rust_enum_variant (type); int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type); lhs = value_primitive_field (lhs, 0, fieldno, type);
@ -1745,8 +1745,8 @@ tuple structs, and tuple-like enum variants"));
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type)) if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
error (_("Attempting to access named field %s of tuple " error (_("Attempting to access named field %s of tuple "
"variant %s::%s, which has only anonymous fields"), "variant %s::%s, which has only anonymous fields"),
field_name, TYPE_NAME (outer_type), field_name, outer_type->name (),
rust_last_path_segment (TYPE_NAME (type))); rust_last_path_segment (type->name ()));
try try
{ {
@ -1756,8 +1756,8 @@ tuple structs, and tuple-like enum variants"));
catch (const gdb_exception_error &except) catch (const gdb_exception_error &except)
{ {
error (_("Could not find field %s of struct variant %s::%s"), error (_("Could not find field %s of struct variant %s::%s"),
field_name, TYPE_NAME (outer_type), field_name, outer_type->name (),
rust_last_path_segment (TYPE_NAME (type))); rust_last_path_segment (type->name ()));
} }
} }
else else

View file

@ -1238,7 +1238,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
a base type which did not have its name defined when the a base type which did not have its name defined when the
derived class was output. We fill in the derived class's derived class was output. We fill in the derived class's
base part member's name here in that case. */ 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 if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION) || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
&& TYPE_N_BASECLASSES (SYMBOL_TYPE (sym))) && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
@ -1248,10 +1248,10 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--) for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--)
if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0) if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0)
TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) = 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 if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
&& strcmp (sym->linkage_name (), vtbl_ptr_name)) && strcmp (sym->linkage_name (), vtbl_ptr_name))
@ -1311,7 +1311,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF; SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (struct_sym) = valu; SYMBOL_VALUE (struct_sym) = valu;
SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (), (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL)); (char *) NULL));
@ -1338,7 +1338,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_VALUE (sym) = valu; SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (), (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL)); (char *) NULL));
@ -1353,7 +1353,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF; SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (typedef_sym) = valu; SYMBOL_VALUE (typedef_sym) = valu;
SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (), (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL)); (char *) NULL));
@ -2748,7 +2748,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
switch (cpp_abbrev) switch (cpp_abbrev)
{ {
case 'f': /* $vf -- a virtual function table pointer */ case 'f': /* $vf -- a virtual function table pointer */
name = TYPE_NAME (context); name = context->name ();
if (name == NULL) if (name == NULL)
{ {
name = ""; name = "";
@ -2758,7 +2758,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
break; break;
case 'b': /* $vb -- a virtual bsomethingorother */ case 'b': /* $vb -- a virtual bsomethingorother */
name = TYPE_NAME (context); name = context->name ();
if (name == NULL) if (name == NULL)
{ {
complaint (_("C++ abbreviated type name " complaint (_("C++ abbreviated type name "
@ -3161,7 +3161,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
field's name. */ field's name. */
newobj->field.type = read_type (pp, objfile); 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. */ /* Skip trailing ';' and bump count of number of fields seen. */
if (**pp == ';') if (**pp == ';')
@ -3248,7 +3248,7 @@ read_tilde_fields (struct stab_field_info *fip, const char **pp,
/* Virtual function table field not found. */ /* Virtual function table field not found. */
complaint (_("virtual function table pointer " complaint (_("virtual function table pointer "
"not found when defining class `%s'"), "not found when defining class `%s'"),
TYPE_NAME (type)); type->name ());
return 0; return 0;
} }
else else
@ -3377,9 +3377,9 @@ complain_about_struct_wipeout (struct type *type)
const char *name = ""; const char *name = "";
const char *kind = ""; const char *kind = "";
if (TYPE_NAME (type)) if (type->name ())
{ {
name = TYPE_NAME (type); name = type->name ();
switch (type->code ()) switch (type->code ())
{ {
case TYPE_CODE_STRUCT: kind = "struct "; break; case TYPE_CODE_STRUCT: kind = "struct "; break;
@ -4408,7 +4408,7 @@ add_undefined_type_1 (struct type *type)
static void static void
add_undefined_type (struct type *type, int typenums[2]) add_undefined_type (struct type *type, int typenums[2])
{ {
if (TYPE_NAME (type) == NULL) if (type->name () == NULL)
add_undefined_type_noname (type, typenums); add_undefined_type_noname (type, typenums);
else else
add_undefined_type_1 (type); add_undefined_type_1 (type);
@ -4493,7 +4493,7 @@ cleanup_undefined_types_1 (void)
struct pending *ppt; struct pending *ppt;
int i; int i;
/* Name of the type, without "struct" or "union". */ /* 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 (type_name == NULL)
{ {

View file

@ -556,7 +556,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
if (SYMBOL_DOMAIN (symbol) == STRUCT_DOMAIN) 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, LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
&type_print_raw_options); &type_print_raw_options);

View file

@ -595,7 +595,7 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
struct fn_field *method = &f[signature_id]; struct fn_field *method = &f[signature_id];
const char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id); const char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_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 /* Does the form of physname indicate that it is the full mangled name
of a constructor (not just the args)? */ of a constructor (not just the args)? */

View file

@ -60,7 +60,7 @@ find_size_for_pointer_math (struct type *ptr_type)
{ {
const char *name; const char *name;
name = TYPE_NAME (ptr_target); name = ptr_target->name ();
if (name == NULL) if (name == NULL)
error (_("Cannot perform pointer math on incomplete types, " error (_("Cannot perform pointer math on incomplete types, "
"try casting to a known type, or void *.")); "try casting to a known type, or void *."));
@ -888,8 +888,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
target_float_from_longest (x, *eff_type_x, value_as_long (arg1)); target_float_from_longest (x, *eff_type_x, value_as_long (arg1));
} }
else else
error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1), error (_("Don't know how to convert from %s to %s."), type1->name (),
TYPE_NAME (type2)); type2->name ());
/* Obtain value of arg2, converting from other types if necessary. */ /* Obtain value of arg2, converting from other types if necessary. */
@ -907,8 +907,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
target_float_from_longest (y, *eff_type_y, value_as_long (arg2)); target_float_from_longest (y, *eff_type_y, value_as_long (arg2));
} }
else else
error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1), error (_("Don't know how to convert from %s to %s."), type1->name (),
TYPE_NAME (type2)); type2->name ());
} }
/* A helper function that finds the type to use for a binary operation /* A helper function that finds the type to use for a binary operation

View file

@ -222,17 +222,17 @@ value_cast_structs (struct type *type, struct value *v2)
|| t2->code () == TYPE_CODE_UNION) || t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind"); && !!"Precondition is that value is of STRUCT or UNION kind");
if (TYPE_NAME (t1) != NULL if (t1->name () != NULL
&& TYPE_NAME (t2) != NULL && t2->name () != NULL
&& !strcmp (TYPE_NAME (t1), TYPE_NAME (t2))) && !strcmp (t1->name (), t2->name ()))
return NULL; return NULL;
/* Upcasting: look in the type of the source to see if it contains the /* 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 type of the target as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */ 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); v2, t2, 1);
if (v) if (v)
return v; return v;
@ -241,7 +241,7 @@ value_cast_structs (struct type *type, struct value *v2)
/* Downcasting: look in the type of the target to see if it contains the /* 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 type of the source as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */ 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. */ /* Try downcasting using the run-time type of the value. */
int full, using_enc; int full, using_enc;
@ -257,11 +257,11 @@ value_cast_structs (struct type *type, struct value *v2)
/* We might be trying to cast to the outermost enclosing /* We might be trying to cast to the outermost enclosing
type, in which case search_struct_field won't work. */ type, in which case search_struct_field won't work. */
if (TYPE_NAME (real_type) != NULL if (real_type->name () != NULL
&& !strcmp (TYPE_NAME (real_type), TYPE_NAME (t1))) && !strcmp (real_type->name (), t1->name ()))
return v; 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) if (v)
return v; return v;
} }
@ -269,7 +269,7 @@ value_cast_structs (struct type *type, struct value *v2)
/* Try downcasting using information from the destination type /* Try downcasting using information from the destination type
T2. This wouldn't work properly for classes with virtual T2. This wouldn't work properly for classes with virtual
bases, but those were handled above. */ 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); value_zero (t1, not_lval), t1, 1);
if (v) if (v)
{ {
@ -443,7 +443,7 @@ value_cast (struct type *type, struct value *arg2)
if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION) if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
&& (code2 == TYPE_CODE_STRUCT || code2 == 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); struct value *v = value_cast_structs (to_type, arg2);
@ -2479,7 +2479,7 @@ find_overload_match (gdb::array_view<value *> args,
obj = coerce_ref (obj); obj = coerce_ref (obj);
while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR) while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR)
obj = coerce_ref (value_ind (obj)); 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 /* First check whether this is a data member, e.g. a pointer to
a function. */ a function. */
@ -3141,7 +3141,7 @@ enum_constant_from_type (struct type *type, const char *name)
} }
error (_("no constant named \"%s\" in enum \"%s\""), 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, /* C++: Given an aggregate type CURTYPE, and a member name NAME,
@ -3528,7 +3528,7 @@ value_namespace_elt (const struct type *curtype,
if (retval == NULL) if (retval == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."), error (_("No symbol \"%s\" in namespace \"%s\"."),
name, TYPE_NAME (curtype)); name, curtype->name ());
return retval; return retval;
} }
@ -3544,7 +3544,7 @@ value_maybe_namespace_elt (const struct type *curtype,
const char *name, int want_address, const char *name, int want_address,
enum noside noside) enum noside noside)
{ {
const char *namespace_name = TYPE_NAME (curtype); const char *namespace_name = curtype->name ();
struct block_symbol sym; struct block_symbol sym;
struct value *result; struct value *result;
@ -3684,7 +3684,7 @@ value_full_object (struct value *argp,
{ {
warning (_("Couldn't retrieve complete object of RTTI " warning (_("Couldn't retrieve complete object of RTTI "
"type %s; object may be in register(s)."), "type %s; object may be in register(s)."),
TYPE_NAME (real_type)); real_type->name ());
return argp; return argp;
} }

View file

@ -1001,9 +1001,9 @@ check_type_length_before_alloc (const struct type *type)
if (max_value_size > -1 && length > max_value_size) 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 " 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 else
error (_("value requires %u bytes, which is more than " error (_("value requires %u bytes, which is more than "
"max-value-size"), length); "max-value-size"), length);