aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c45
-rw-r--r--gdb/ada-typeprint.c6
-rw-r--r--gdb/ax-gdb.c12
-rw-r--r--gdb/c-exp.y4
-rw-r--r--gdb/c-lang.c2
-rw-r--r--gdb/c-typeprint.c56
-rw-r--r--gdb/c-valprint.c14
-rw-r--r--gdb/c-varobj.c2
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/compile/compile-c-types.c4
-rw-r--r--gdb/compile/compile-cplus-types.c26
-rw-r--r--gdb/completer.c2
-rw-r--r--gdb/cp-namespace.c4
-rw-r--r--gdb/cp-support.c8
-rw-r--r--gdb/cp-valprint.c8
-rw-r--r--gdb/d-namespace.c2
-rw-r--r--gdb/dwarf2/read.c38
-rw-r--r--gdb/eval.c14
-rw-r--r--gdb/expprint.c2
-rw-r--r--gdb/f-typeprint.c24
-rw-r--r--gdb/gdbtypes.c64
-rw-r--r--gdb/gdbtypes.h5
-rw-r--r--gdb/gnu-v2-abi.c8
-rw-r--r--gdb/go-lang.c6
-rw-r--r--gdb/guile/scm-type.c6
-rw-r--r--gdb/infcall.c10
-rw-r--r--gdb/language.c4
-rw-r--r--gdb/linespec.c2
-rw-r--r--gdb/m2-lang.c4
-rw-r--r--gdb/m2-typeprint.c26
-rw-r--r--gdb/mdebugread.c10
-rw-r--r--gdb/opencl-lang.c2
-rw-r--r--gdb/p-exp.y2
-rw-r--r--gdb/p-typeprint.c36
-rw-r--r--gdb/p-valprint.c12
-rw-r--r--gdb/python/py-type.c10
-rw-r--r--gdb/regcache.c2
-rw-r--r--gdb/riscv-tdep.c4
-rw-r--r--gdb/rust-lang.c84
-rw-r--r--gdb/stabsread.c28
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.c2
-rw-r--r--gdb/valarith.c10
-rw-r--r--gdb/valops.c32
-rw-r--r--gdb/value.c4
46 files changed, 334 insertions, 331 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3f92a6d..aa42a7a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-05-16 Simon Marchi <simon.marchi@efficios.com>
+ * gdbtypes.h (TYPE_NAME): Remove. Change all cal sites to use
+ type::name instead.
+
+2020-05-16 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (struct type) <name, set_name>: New methods.
(TYPE_CODE): Use type::name. Change all call sites used to set
the name to use type::set_name instead.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9848824..825549d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -577,7 +577,7 @@ ada_get_field_index (const struct type *type, const char *field_name,
if (!maybe_missing)
error (_("Unable to find field %s in struct %s. Aborting"),
- field_name, TYPE_NAME (struct_type));
+ field_name, struct_type->name ());
return -1;
}
@@ -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,
the field type should be a meaningless integer type whose name
is not equal to the field name. */
- if (TYPE_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)) != NULL
- && strcmp (TYPE_NAME (TYPE_FIELD_TYPE (index_desc_type, 0)),
+ if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL
+ && strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (),
TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
return;
@@ -3405,7 +3405,7 @@ See set/show multiple-symbol."));
SYMBOL_LINE (syms[i].symbol));
}
else if (is_enumeral
- && TYPE_NAME (SYMBOL_TYPE (syms[i].symbol)) != NULL)
+ && SYMBOL_TYPE (syms[i].symbol)->name () != NULL)
{
printf_filtered (("[%d] "), i + first_choice);
ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
@@ -5158,7 +5158,7 @@ xget_renaming_scope (struct type *renaming_type)
So, to extract the scope, we search for the "___XR" extension,
and then backtrack until we find the first "__". */
- const char *name = TYPE_NAME (renaming_type);
+ const char *name = renaming_type->name ();
const char *suffix = strstr (name, "___XR");
const char *last;
@@ -6506,7 +6506,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
if (type->code () != TYPE_CODE_PTR)
return 0;
- name = TYPE_NAME (TYPE_TARGET_TYPE (type));
+ name = TYPE_TARGET_TYPE (type)->name ();
if (name == NULL)
return 0;
@@ -6518,7 +6518,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
static int
ada_is_interface_tag (struct type *type)
{
- const char *name = TYPE_NAME (type);
+ const char *name = type->name ();
if (name == NULL)
return 0;
@@ -7834,7 +7834,7 @@ ada_prefer_type (struct type *type0, struct type *type1)
return 1;
else if (type0->code () == TYPE_CODE_VOID)
return 0;
- else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL)
+ else if (type1->name () == NULL && type0->name () != NULL)
return 1;
else if (ada_is_constrained_packed_array_type (type0))
return 1;
@@ -7843,8 +7843,8 @@ ada_prefer_type (struct type *type0, struct type *type1)
return 1;
else
{
- const char *type0_name = TYPE_NAME (type0);
- const char *type1_name = TYPE_NAME (type1);
+ const char *type0_name = type0->name ();
+ const char *type1_name = type1->name ();
if (type0_name != NULL && strstr (type0_name, "___XR") != NULL
&& (type1_name == NULL || strstr (type1_name, "___XR") == NULL))
@@ -7861,7 +7861,7 @@ ada_type_name (struct type *type)
{
if (type == NULL)
return NULL;
- return TYPE_NAME (type);
+ return type->name ();
}
/* 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. */
if (TYPE_LENGTH (type) <= 0)
{
- if (TYPE_NAME (rtype))
+ if (rtype->name ())
warning (_("Invalid type size for `%s' detected: %s."),
- TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type)));
+ rtype->name (), pulongest (TYPE_LENGTH (type)));
else
warning (_("Invalid type size for <unnamed> detected: %s."),
pulongest (TYPE_LENGTH (type)));
@@ -8563,10 +8563,10 @@ ada_is_redundant_range_encoding (struct type *range_type,
if (is_dynamic_type (range_type))
return 0;
- if (TYPE_NAME (encoding_type) == NULL)
+ if (encoding_type->name () == NULL)
return 0;
- bounds_str = strstr (TYPE_NAME (encoding_type), "___XDLU_");
+ bounds_str = strstr (encoding_type->name (), "___XDLU_");
if (bounds_str == NULL)
return 0;
@@ -8734,7 +8734,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
/* We want to preserve the type name. This can be useful when
trying to get the type name of a value that has already been
printed (for instance, if the user did "print VAR; whatis $". */
- result->set_name (TYPE_NAME (type0));
+ result->set_name (type0->name ());
if (constrained_packed_array_p)
{
@@ -9025,11 +9025,11 @@ ada_check_typedef (struct type *type)
type = check_typedef (type);
if (type == NULL || type->code () != TYPE_CODE_ENUM
|| !TYPE_STUB (type)
- || TYPE_NAME (type) == NULL)
+ || type->name () == NULL)
return type;
else
{
- const char *name = TYPE_NAME (type);
+ const char *name = type->name ();
struct type *type1 = ada_find_any_type (name);
if (type1 == NULL)
@@ -11424,8 +11424,7 @@ ada_is_gnat_encoded_fixed_point_type (struct type *type)
int
ada_is_system_address_type (struct type *type)
{
- return (TYPE_NAME (type)
- && strcmp (TYPE_NAME (type), "system__address") == 0);
+ return (type->name () && strcmp (type->name (), "system__address") == 0);
}
/* Assuming that TYPE is the representation of an Ada fixed-point
@@ -11593,14 +11592,14 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
const char *subtype_info;
gdb_assert (raw_type != NULL);
- gdb_assert (TYPE_NAME (raw_type) != NULL);
+ gdb_assert (raw_type->name () != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type);
else
base_type = raw_type;
- name = TYPE_NAME (raw_type);
+ name = raw_type->name ();
subtype_info = strstr (name, "___XD");
if (subtype_info == NULL)
{
@@ -13075,7 +13074,7 @@ catch_assert_command (const char *arg_entry, int from_tty,
static int
ada_is_exception_sym (struct symbol *sym)
{
- const char *type_name = TYPE_NAME (SYMBOL_TYPE (sym));
+ const char *type_name = SYMBOL_TYPE (sym)->name ();
return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
&& SYMBOL_CLASS (sym) != LOC_BLOCK
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 1b976b1..076c0a6 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -180,8 +180,8 @@ print_range (struct type *type, struct ui_file *stream,
break;
default:
fprintf_filtered (stream, "%.*s",
- ada_name_prefix_len (TYPE_NAME (type)),
- TYPE_NAME (type));
+ ada_name_prefix_len (type->name ()),
+ type->name ());
break;
}
}
@@ -267,7 +267,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
const char *subtype_info;
gdb_assert (raw_type != NULL);
- name = TYPE_NAME (raw_type);
+ name = raw_type->name ();
gdb_assert (name != NULL);
if (raw_type->code () == TYPE_CODE_RANGE)
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 57ba210..0f389e4 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -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
gracefully. */
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)
error (_("Couldn't find member named `%s' in struct/union/class `%s'"),
- field, TYPE_NAME (type));
+ field, type->name ());
}
static int
@@ -1629,7 +1629,7 @@ gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
if (!found)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_NAME (curtype));
+ name, curtype->name ());
return found;
}
@@ -1644,7 +1644,7 @@ static int
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
const struct type *curtype, char *name)
{
- const char *namespace_name = TYPE_NAME (curtype);
+ const char *namespace_name = curtype->name ();
struct block_symbol sym;
sym = cp_lookup_symbol_namespace (namespace_name, name,
@@ -2354,9 +2354,9 @@ gen_expr_binop_rest (struct expression *exp,
if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR)
{
- if (TYPE_NAME (type))
+ if (type->name ())
error (_("cannot subscript something of type `%s'"),
- TYPE_NAME (type));
+ type->name ());
else
error (_("cannot subscript requested type"));
}
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e737c66..e7d0a0d 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1431,13 +1431,13 @@ scalar_type:
0); }
| UNSIGNED type_name
{ $$ = lookup_unsigned_typename (pstate->language (),
- TYPE_NAME($2.type)); }
+ $2.type->name ()); }
| UNSIGNED
{ $$ = lookup_unsigned_typename (pstate->language (),
"int"); }
| SIGNED_KEYWORD type_name
{ $$ = lookup_signed_typename (pstate->language (),
- TYPE_NAME($2.type)); }
+ $2.type->name ()); }
| SIGNED_KEYWORD
{ $$ = lookup_signed_typename (pstate->language (),
"int"); }
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 9d4064f..557482f 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -84,7 +84,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
that would do the wrong thing. */
while (elttype)
{
- const char *name = TYPE_NAME (elttype);
+ const char *name = elttype->name ();
if (elttype->code () == TYPE_CODE_CHAR || !name)
{
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 356e605..bbe12cc 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -129,7 +129,7 @@ c_print_type_1 (struct type *type,
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets;
but not if we will print just a type name. */
- || ((show > 0 || TYPE_NAME (type) == 0)
+ || ((show > 0 || type->name () == 0)
&& (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| (code == TYPE_CODE_ARRAY
@@ -206,8 +206,8 @@ c_print_typedef (struct type *type,
type = check_typedef (type);
fprintf_filtered (stream, "typedef ");
type_print (type, "", stream, -1);
- if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
- || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
+ if ((SYMBOL_TYPE (new_symbol))->name () == 0
+ || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
new_symbol->linkage_name ()) != 0
|| SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF)
fprintf_filtered (stream, " %s", new_symbol->print_name ());
@@ -256,7 +256,7 @@ cp_type_print_derivation_info (struct ui_file *stream,
? "public" : (TYPE_FIELD_PROTECTED (type, i)
? "protected" : "private"),
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
- name = TYPE_NAME (TYPE_BASECLASS (type, i));
+ name = TYPE_BASECLASS (type, i)->name ();
if (name)
print_name_maybe_canonical (name, flags, stream);
else
@@ -373,7 +373,7 @@ c_type_print_varspec_prefix (struct type *type,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
QUIT;
@@ -391,7 +391,7 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, language, flags, podata);
- name = TYPE_NAME (TYPE_SELF_TYPE (type));
+ name = TYPE_SELF_TYPE (type)->name ();
if (name)
print_name_maybe_canonical (name, flags, stream);
else
@@ -406,7 +406,7 @@ c_type_print_varspec_prefix (struct type *type,
stream, show, 0, 0, language, flags,
podata);
fprintf_filtered (stream, "(");
- name = TYPE_NAME (TYPE_SELF_TYPE (type));
+ name = TYPE_SELF_TYPE (type)->name ();
if (name)
print_name_maybe_canonical (name, flags, stream);
else
@@ -762,7 +762,7 @@ c_type_print_varspec_suffix (struct type *type,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
QUIT;
@@ -1067,13 +1067,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
enum}" tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (TYPE_NAME (type) != NULL
- && !startswith (TYPE_NAME (type), "{unnamed"))
+ if (type->name () != NULL
+ && !startswith (type->name (), "{unnamed"))
{
/* When printing the tag name, we are still effectively
printing in the outer context, hence the use of FLAGS
here. */
- print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -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
else. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_NAME (type) == NULL)
+ else if (show > 0 || type->name () == NULL)
{
struct type *basetype;
int vptr_fieldno;
@@ -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);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
- const char *name = TYPE_NAME (type);
+ const char *name = type->name ();
int is_constructor = name && strcmp (method_name,
name) == 0;
@@ -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. */
if (show <= 0
- && TYPE_NAME (type) != NULL)
+ && type->name () != NULL)
{
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 ");
}
- print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ print_name_maybe_canonical (type->name (), flags, stream);
return;
}
@@ -1516,7 +1516,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_TYPEDEF:
/* If we get here, the typedef doesn't have a name, and we
couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */
- gdb_assert (TYPE_NAME (type) == NULL);
+ gdb_assert (type->name () == NULL);
gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
fprintf_styled (stream, metadata_style.style (),
_("<unnamed typedef>"));
@@ -1556,10 +1556,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (TYPE_NAME (type) != NULL
- && !startswith (TYPE_NAME (type), "{unnamed"))
+ if (type->name () != NULL
+ && !startswith (type->name (), "{unnamed"))
{
- print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -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
else. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_NAME (type) == NULL)
+ else if (show > 0 || type->name () == NULL)
{
LONGEST lastval = 0;
@@ -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));
- if (TYPE_NAME (underlying) != NULL)
- fprintf_filtered (stream, ": %s ", TYPE_NAME (underlying));
+ if (underlying->name () != NULL)
+ fprintf_filtered (stream, ": %s ", underlying->name ());
}
fprintf_filtered (stream, "{");
@@ -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);
fprintf_filtered (stream, "flag ");
- print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0)
{
fputs_filtered (" ", stream);
@@ -1684,7 +1684,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_NAMESPACE:
fputs_filtered ("namespace ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
break;
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
type name is, as recorded in the type itself. If there is no
type name, then complain. */
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
c_type_print_modifier (type, stream, 0, 1, language);
- print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ print_name_maybe_canonical (type->name (), flags, stream);
}
else
{
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index d117248..7d5feb3 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -78,7 +78,7 @@ c_textual_element_type (struct type *type, char format)
while (iter_type)
{
/* Check the name of the type. */
- if (TYPE_NAME (iter_type) && textual_name (TYPE_NAME (iter_type)))
+ if (iter_type->name () && textual_name (iter_type->name ()))
return 1;
if (iter_type->code () != TYPE_CODE_TYPEDEF)
@@ -521,11 +521,11 @@ c_value_print (struct value *val, struct ui_file *stream,
(Don't use c_textual_element_type here; quoted strings
are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR
- && TYPE_NAME (original_type) == NULL
- && TYPE_NAME (TYPE_TARGET_TYPE (original_type)) != NULL
- && (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (original_type)),
+ && original_type->name () == NULL
+ && TYPE_TARGET_TYPE (original_type)->name () != NULL
+ && (strcmp (TYPE_TARGET_TYPE (original_type)->name (),
"char") == 0
- || textual_name (TYPE_NAME (TYPE_TARGET_TYPE (original_type)))))
+ || textual_name (TYPE_TARGET_TYPE (original_type)->name ())))
{
/* Print nothing. */
}
@@ -598,14 +598,14 @@ c_value_print (struct value *val, struct ui_file *stream,
< TYPE_LENGTH (value_enclosing_type (val)))))
val = value_cast (real_type, val);
fprintf_filtered (stream, "(%s%s) ",
- TYPE_NAME (real_type),
+ real_type->name (),
full ? "" : _(" [incomplete object]"));
}
else if (type != check_typedef (value_enclosing_type (val)))
{
/* No RTTI information, so let's do our best. */
fprintf_filtered (stream, "(%s ?) ",
- TYPE_NAME (value_enclosing_type (val)));
+ value_enclosing_type (val)->name ());
val = value_cast (value_enclosing_type (val), val);
}
}
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 156f622..51940b9 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -144,7 +144,7 @@ c_is_path_expr_parent (const struct varobj *var)
/* Anonymous unions and structs are also not path_expr parents. */
if ((type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)
- && TYPE_NAME (type) == NULL)
+ && type->name () == NULL)
{
const struct varobj *parent = var->parent;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index c08c9de..fc44e53 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1463,13 +1463,13 @@ patch_type (struct type *type, struct type *real_type)
TYPE_FIELDS (real_target),
field_size);
- if (TYPE_NAME (real_target))
+ if (real_target->name ())
{
/* The previous copy of TYPE_NAME is allocated by
process_coff_symbol. */
- if (TYPE_NAME (target))
- xfree ((char*) TYPE_NAME (target));
- target->set_name (xstrdup (TYPE_NAME (real_target)));
+ if (target->name ())
+ xfree ((char*) target->name ());
+ target->set_name (xstrdup (real_target->name ()));
}
}
@@ -1658,7 +1658,7 @@ process_coff_symbol (struct coff_symbol *cs,
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* If type has no name, give it one. */
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
{
if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
@@ -1715,7 +1715,7 @@ process_coff_symbol (struct coff_symbol *cs,
/* Some compilers try to be helpful by inventing "fake"
names for anonymous enums, structures, and unions, like
"~0fake" or ".0fake". Thanks, but no thanks... */
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
if (sym->linkage_name () != NULL
&& *sym->linkage_name () != '~'
&& *sym->linkage_name () != '.')
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index ed4a6e9..8f6ed05 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -201,7 +201,7 @@ convert_int (compile_c_instance *context, struct type *type)
}
return context->plugin ().int_type (TYPE_UNSIGNED (type),
TYPE_LENGTH (type),
- TYPE_NAME (type));
+ type->name ());
}
else
return context->plugin ().int_type_v0 (TYPE_UNSIGNED (type),
@@ -215,7 +215,7 @@ convert_float (compile_c_instance *context, struct type *type)
{
if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
return context->plugin ().float_type (TYPE_LENGTH (type),
- TYPE_NAME (type));
+ type->name ());
else
return context->plugin ().float_type_v0 (TYPE_LENGTH (type));
}
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 3dec3b2..523ab34 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -364,7 +364,7 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
}
else
{
- if (TYPE_NAME (type) == nullptr)
+ if (type->name () == nullptr)
{
/* Anonymous type */
@@ -383,8 +383,8 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
{
scope_component comp
= {
- decl_name (TYPE_NAME (type)).get (),
- lookup_symbol (TYPE_NAME (type), block (), VAR_DOMAIN, nullptr)
+ decl_name (type->name ()).get (),
+ lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
};
scope.push_back (comp);
}
@@ -515,13 +515,13 @@ compile_cplus_convert_typedef (compile_cplus_instance *instance,
struct type *type,
enum gcc_cp_symbol_kind nested_access)
{
- compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+ compile_scope scope = instance->new_scope (type->name (), type);
if (scope.nested_type () != GCC_TYPE_NONE)
return scope.nested_type ();
gdb::unique_xmalloc_ptr<char> name
- = compile_cplus_instance::decl_name (TYPE_NAME (type));
+ = compile_cplus_instance::decl_name (type->name ());
/* Make sure the scope for this type has been pushed. */
instance->enter_scope (std::move (scope));
@@ -807,10 +807,10 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
/* Get the decl name of this type. */
gdb::unique_xmalloc_ptr<char> name
- = compile_cplus_instance::decl_name (TYPE_NAME (type));
+ = compile_cplus_instance::decl_name (type->name ());
/* Create a new scope for TYPE. */
- compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+ compile_scope scope = instance->new_scope (type->name (), type);
if (scope.nested_type () != GCC_TYPE_NONE)
{
@@ -913,7 +913,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
bool scoped_enum_p = false;
/* Create a new scope for this type. */
- compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+ compile_scope scope = instance->new_scope (type->name (), type);
if (scope.nested_type () != GCC_TYPE_NONE)
{
@@ -923,7 +923,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
}
gdb::unique_xmalloc_ptr<char> name
- = compile_cplus_instance::decl_name (TYPE_NAME (type));
+ = compile_cplus_instance::decl_name (type->name ());
/* Push all scopes. */
instance->enter_scope (std::move (scope));
@@ -1022,7 +1022,7 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *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. */
@@ -1032,7 +1032,7 @@ compile_cplus_convert_float (compile_cplus_instance *instance,
struct type *type)
{
return instance->plugin ().get_float_type
- (TYPE_LENGTH (type), TYPE_NAME (type));
+ (TYPE_LENGTH (type), type->name ());
}
/* Convert the 'void' type to its gcc representation. */
@@ -1102,9 +1102,9 @@ static gcc_type
compile_cplus_convert_namespace (compile_cplus_instance *instance,
struct type *type)
{
- compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
+ compile_scope scope = instance->new_scope (type->name (), type);
gdb::unique_xmalloc_ptr<char> name
- = compile_cplus_instance::decl_name (TYPE_NAME (type));
+ = compile_cplus_instance::decl_name (type->name ());
/* Push scope. */
instance->enter_scope (std::move (scope));
diff --git a/gdb/completer.c b/gdb/completer.c
index 71e31cf..d03dc77 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1120,7 +1120,7 @@ add_struct_fields (struct type *type, completion_list &output,
{
if (!computed_type_name)
{
- type_name = TYPE_NAME (type);
+ type_name = type->name ();
computed_type_name = 1;
}
/* Omit constructors from the completion list. */
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 517a071..81fb2ef 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -224,7 +224,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
return {};
/* Look for symbol NAME in this class. */
@@ -918,7 +918,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
if (symbol_lookup_debug)
{
- const char *type_name = TYPE_NAME (saved_parent_type);
+ const char *type_name = saved_parent_type->name ();
fprintf_unfiltered (gdb_stdlog,
"cp_lookup_nested_symbol (%s, %s, %s, %s)\n",
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index bc9e8d4..1e54aae 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -207,11 +207,11 @@ inspect_type (struct demangle_parse_info *info,
If the symbol is typedef and its type name is the same
as the symbol's name, e.g., "typedef struct foo foo;". */
- if (TYPE_NAME (type) != nullptr
- && strcmp (TYPE_NAME (type), name) == 0)
+ if (type->name () != nullptr
+ && strcmp (type->name (), name) == 0)
return 0;
- is_anon = (TYPE_NAME (type) == NULL
+ is_anon = (type->name () == NULL
&& (type->code () == TYPE_CODE_ENUM
|| type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION));
@@ -1278,7 +1278,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
type = TYPE_TARGET_TYPE (type);
}
- type_name = TYPE_NAME (type);
+ type_name = type->name ();
if (type_name == NULL)
return;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 799bdb1..1fb7edd 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -61,7 +61,7 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
int
cp_is_vtbl_ptr_type (struct type *type)
{
- const char *type_name = TYPE_NAME (type);
+ const char *type_name = type->name ();
return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
}
@@ -207,7 +207,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
fputs_filtered ("members of ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (":", stream);
}
}
@@ -411,7 +411,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
LONGEST boffset = 0;
int skip = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = TYPE_NAME (baseclass);
+ const char *basename = baseclass->name ();
struct value *base_val = NULL;
if (BASETYPE_VIA_VIRTUAL (type, i))
@@ -708,7 +708,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
const char *name;
fputs_filtered (prefix, stream);
- name = TYPE_NAME (self_type);
+ name = self_type->name ();
if (name)
fputs_filtered (name, stream);
else
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index f15708b..f3053d6 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -131,7 +131,7 @@ d_lookup_symbol (const struct language_defn *langdef,
return {};
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
- classname = TYPE_NAME (type);
+ classname = type->name ();
nested = name;
}
else
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 2c81a4e..719051b 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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. */
TYPE_FIELD (type, 1) = saved_field;
TYPE_FIELD_NAME (type, 1)
- = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, 1)));
+ = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
TYPE_FIELD_TYPE (type, 1)->set_name
- (rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+ (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
TYPE_FIELD_NAME (type, 1)));
const char *dataless_name
- = rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+ = rust_fully_qualify (&objfile->objfile_obstack, type->name (),
name);
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
dataless_name);
@@ -9372,11 +9372,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
struct type *field_type = TYPE_FIELD_TYPE (type, 0);
const char *variant_name
- = rust_last_path_segment (TYPE_NAME (field_type));
+ = rust_last_path_segment (field_type->name ());
TYPE_FIELD_NAME (type, 0) = variant_name;
field_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack,
- TYPE_NAME (type), variant_name));
+ type->name (), variant_name));
}
else
{
@@ -9460,7 +9460,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
That name can be used to look up the correct
discriminant. */
const char *variant_name
- = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, i)));
+ = rust_last_path_segment (TYPE_FIELD_TYPE (type, i)->name ());
auto iter = discriminant_map.find (variant_name);
if (iter != discriminant_map.end ())
@@ -9479,7 +9479,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
TYPE_FIELD_NAME (type, i) = variant_name;
sub_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack,
- TYPE_NAME (type), variant_name));
+ type->name (), variant_name));
}
/* Indicate that this is a variant type. */
@@ -14494,7 +14494,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
handle_data_member_location (die, cu, fp);
FIELD_BITSIZE (*fp) = 0;
FIELD_TYPE (*fp) = die_type (die, cu);
- FIELD_NAME (*fp) = TYPE_NAME (fp->type);
+ FIELD_NAME (*fp) = fp->type->name ();
}
else
gdb_assert_not_reached ("missing case in dwarf2_add_field");
@@ -15703,7 +15703,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
if (i < TYPE_N_BASECLASSES (t))
complaint (_("virtual function table pointer "
"not found when defining class '%s'"),
- TYPE_NAME (type) ? TYPE_NAME (type) : "");
+ type->name () ? type->name () : "");
}
else
{
@@ -16497,7 +16497,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
std::vector<const char *> excludes;
add_using_directive (using_directives (cu),
- previous_prefix, TYPE_NAME (type), NULL,
+ previous_prefix, type->name (), NULL,
NULL, excludes, 0, &objfile->objfile_obstack);
}
}
@@ -17260,7 +17260,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
tt = nullptr;
- const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
+ const char *name = (tt == nullptr) ? nullptr : tt->name ();
return dwarf2_init_float_type (objfile, bits, name, name_hint, byte_order);
}
@@ -17328,7 +17328,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct obstack *obstack
= &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack;
- name = obconcat (obstack, "_Complex ", TYPE_NAME (type),
+ name = obconcat (obstack, "_Complex ", type->name (),
nullptr);
}
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
@@ -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
with this objfile, so we don't need to
duplicate it for the type. */
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name (sym->search_name ());
}
}
@@ -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.
Work around this problem here. */
if (cu->language == language_cplus
- && strcmp (TYPE_NAME (parent_type), "::") == 0)
+ && strcmp (parent_type->name (), "::") == 0)
return "";
/* We give a name to even anonymous namespaces. */
- return TYPE_NAME (parent_type);
+ return parent_type->name ();
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_module:
parent_type = read_type_die (parent, cu);
- if (TYPE_NAME (parent_type) != NULL)
- return TYPE_NAME (parent_type);
+ if (parent_type->name () != NULL)
+ return parent_type->name ();
else
/* An anonymous structure is only allowed non-static data
members; no typedefs, no member functions, et cetera.
@@ -21702,8 +21702,8 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
parent_type = read_type_die (parent, cu);
if (TYPE_DECLARED_CLASS (parent_type))
{
- if (TYPE_NAME (parent_type) != NULL)
- return TYPE_NAME (parent_type);
+ if (parent_type->name () != NULL)
+ return parent_type->name ();
return "";
}
/* Fall through. */
diff --git a/gdb/eval.c b/gdb/eval.c
index 7c45df0..ea08602 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -989,13 +989,13 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
function_name = NULL;
if (type->code () == TYPE_CODE_NAMESPACE)
{
- function = cp_lookup_symbol_namespace (TYPE_NAME (type),
+ function = cp_lookup_symbol_namespace (type->name (),
name,
get_selected_block (0),
VAR_DOMAIN).symbol;
if (function == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_NAME (type));
+ name, type->name ());
tem = 1;
/* arg2 is left as NULL on purpose. */
@@ -2327,9 +2327,9 @@ evaluate_subexp_standard (struct type *expect_type,
if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR)
{
- if (TYPE_NAME (type))
+ if (type->name ())
error (_("cannot subscript something of type `%s'"),
- TYPE_NAME (type));
+ type->name ());
else
error (_("cannot subscript requested type"));
}
@@ -2370,7 +2370,7 @@ evaluate_subexp_standard (struct type *expect_type,
else
{
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;
default:
- if (TYPE_NAME (type))
+ if (type->name ())
error (_("cannot subscript something of type `%s'"),
- TYPE_NAME (type));
+ type->name ());
else
error (_("cannot subscript requested type"));
}
diff --git a/gdb/expprint.c b/gdb/expprint.c
index a190d8c..026b775 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -87,7 +87,7 @@ print_subexp_standard (struct expression *exp, int *pos,
case OP_SCOPE:
myprec = PREC_PREFIX;
assoc = 0;
- fputs_filtered (TYPE_NAME (exp->elts[pc + 1].type), stream);
+ fputs_filtered (exp->elts[pc + 1].type->name (), stream);
fputs_filtered ("::", stream);
nargs = longest_to_int (exp->elts[pc + 2].longconst);
(*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1);
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 200896b..820ba5f 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -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
will print just a type name. */
|| ((show > 0
- || TYPE_NAME (type) == 0)
+ || type->name () == 0)
&& (code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY
@@ -114,7 +114,7 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
QUIT;
@@ -178,7 +178,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
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
just print the type name directly from the type. */
- if ((show <= 0) && (TYPE_NAME (type) != NULL))
+ if ((show <= 0) && (type->name () != NULL))
{
const char *prefix = "";
if (type->code () == TYPE_CODE_UNION)
prefix = "Type, C_Union :: ";
else if (type->code () == TYPE_CODE_STRUCT)
prefix = "Type ";
- fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type));
+ fprintfi_filtered (level, stream, "%s%s", prefix, type->name ());
return;
}
@@ -376,7 +376,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
{
gdbarch *gdbarch = get_type_arch (type);
struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
- fprintfi_filtered (level, stream, "%s", TYPE_NAME (void_type));
+ fprintfi_filtered (level, stream, "%s", void_type->name ());
}
break;
@@ -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
C-oriented, we must change these to "character" from "char". */
- if (strcmp (TYPE_NAME (type), "char") == 0)
+ if (strcmp (type->name (), "char") == 0)
fprintfi_filtered (level, stream, "character");
else
goto default_case;
@@ -424,7 +424,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fprintfi_filtered (level, stream, "Type, C_Union :: ");
else
fprintfi_filtered (level, stream, "Type ");
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
/* According to the definition,
we only print structure elements in case show > 0. */
if (show > 0)
@@ -442,12 +442,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fputs_filtered ("\n", stream);
}
fprintfi_filtered (level, stream, "End Type ");
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
}
break;
case TYPE_CODE_MODULE:
- fprintfi_filtered (level, stream, "module %s", TYPE_NAME (type));
+ fprintfi_filtered (level, stream, "module %s", type->name ());
break;
default_case:
@@ -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
the type name is, as recorded in the type itself. If there
is no type name, then complain. */
- if (TYPE_NAME (type) != NULL)
- fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
+ if (type->name () != NULL)
+ fprintfi_filtered (level, stream, "%s", type->name ());
else
error (_("Invalid type code (%d) in symbol table."), type->code ());
break;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 10c44dd..68d4c0c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1572,11 +1572,11 @@ type_name_or_error (struct type *type)
type = check_typedef (type);
- name = TYPE_NAME (type);
+ name = type->name ();
if (name != NULL)
return name;
- name = TYPE_NAME (saved_type);
+ name = saved_type->name ();
objfile = TYPE_OBJFILE (saved_type);
error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
name ? name : "<anonymous>",
@@ -1706,11 +1706,11 @@ lookup_template_type (const char *name, struct type *type,
{
struct symbol *sym;
char *nam = (char *)
- alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4);
+ alloca (strlen (name) + strlen (type->name ()) + 4);
strcpy (nam, name);
strcat (nam, "<");
- strcat (nam, TYPE_NAME (type));
+ strcat (nam, type->name ());
strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol;
@@ -2213,7 +2213,7 @@ resolve_dynamic_array_or_string (struct type *type,
if the DWARF info is not correct. Issue a warning,
and assume no byte/bit stride (leave bit_stride = 0). */
warning (_("cannot determine array stride for type %s"),
- TYPE_NAME (type) ? TYPE_NAME (type) : "<no name>");
+ type->name () ? type->name () : "<no name>");
}
}
else
@@ -2764,7 +2764,7 @@ check_typedef (struct type *type)
if (currently_reading_symtab)
return make_qualified_type (type, instance_flags, NULL);
- name = TYPE_NAME (type);
+ name = type->name ();
/* FIXME: shouldn't we look in STRUCT_DOMAIN and/or
VAR_DOMAIN as appropriate? */
if (name == NULL)
@@ -2817,7 +2817,7 @@ check_typedef (struct type *type)
&& opaque_type_resolution
&& !currently_reading_symtab)
{
- const char *name = TYPE_NAME (type);
+ const char *name = type->name ();
struct type *newtype;
if (name == NULL)
@@ -2851,7 +2851,7 @@ check_typedef (struct type *type)
types. */
else if (TYPE_STUB (type) && !currently_reading_symtab)
{
- const char *name = TYPE_NAME (type);
+ const char *name = type->name ();
/* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
as appropriate? */
struct symbol *sym;
@@ -3297,10 +3297,10 @@ init_complex_type (const char *name, struct type *target_type)
{
char *new_name
= (char *) TYPE_ALLOC (target_type,
- strlen (TYPE_NAME (target_type))
+ strlen (target_type->name ())
+ strlen ("_Complex ") + 1);
strcpy (new_name, "_Complex ");
- strcat (new_name, TYPE_NAME (target_type));
+ strcat (new_name, target_type->name ());
name = new_name;
}
@@ -3575,8 +3575,8 @@ int
class_types_same_p (const struct type *a, const struct type *b)
{
return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
- || (TYPE_NAME (a) && TYPE_NAME (b)
- && !strcmp (TYPE_NAME (a), TYPE_NAME (b))));
+ || (a->name () && b->name ()
+ && !strcmp (a->name (), b->name ())));
}
/* If BASE is an ancestor of DCLASS return the distance between them.
@@ -3929,8 +3929,8 @@ types_equal (struct type *a, struct type *b)
stubs. The types won't point to the same address, but they
really are the same. */
- if (TYPE_NAME (a) && TYPE_NAME (b)
- && strcmp (TYPE_NAME (a), TYPE_NAME (b)) == 0)
+ if (a->name () && b->name ()
+ && strcmp (a->name (), b->name ()) == 0)
return true;
/* Check if identical after resolving typedefs. */
@@ -4011,9 +4011,9 @@ check_types_equal (struct type *type1, struct type *type2,
|| TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2))
return false;
- if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
+ if (!compare_maybe_null_strings (type1->name (), type2->name ()))
return false;
- if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
+ if (!compare_maybe_null_strings (type1->name (), type2->name ()))
return false;
if (type1->code () == TYPE_CODE_RANGE)
@@ -4290,12 +4290,12 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
{
/* unsigned int -> unsigned int, or
unsigned long -> unsigned long */
- if (integer_types_same_name_p (TYPE_NAME (parm),
- TYPE_NAME (arg)))
+ if (integer_types_same_name_p (parm->name (),
+ arg->name ()))
return EXACT_MATCH_BADNESS;
- else if (integer_types_same_name_p (TYPE_NAME (arg),
+ else if (integer_types_same_name_p (arg->name (),
"int")
- && integer_types_same_name_p (TYPE_NAME (parm),
+ && integer_types_same_name_p (parm->name (),
"long"))
/* unsigned int -> unsigned long */
return INTEGER_PROMOTION_BADNESS;
@@ -4305,9 +4305,9 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
}
else
{
- if (integer_types_same_name_p (TYPE_NAME (arg),
+ if (integer_types_same_name_p (arg->name (),
"long")
- && integer_types_same_name_p (TYPE_NAME (parm),
+ && integer_types_same_name_p (parm->name (),
"int"))
/* signed long -> unsigned int */
return INTEGER_CONVERSION_BADNESS;
@@ -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))
{
- if (integer_types_same_name_p (TYPE_NAME (parm),
- TYPE_NAME (arg)))
+ if (integer_types_same_name_p (parm->name (),
+ arg->name ()))
return EXACT_MATCH_BADNESS;
- else if (integer_types_same_name_p (TYPE_NAME (arg),
+ else if (integer_types_same_name_p (arg->name (),
"int")
- && integer_types_same_name_p (TYPE_NAME (parm),
+ && integer_types_same_name_p (parm->name (),
"long"))
return INTEGER_PROMOTION_BADNESS;
else
@@ -4629,8 +4629,8 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
/* Debugging only. */
fprintf_filtered (gdb_stderr,
"------ Arg is %s [%d], parm is %s [%d]\n",
- TYPE_NAME (arg), arg->code (),
- TYPE_NAME (parm), parm->code ());
+ arg->name (), arg->code (),
+ parm->name (), parm->code ());
/* x -> y means arg of type x being supplied for parameter of type y. */
@@ -4905,8 +4905,8 @@ recursive_dump_type (struct type *type, int spaces)
gdb_print_host_address (type, gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces, "name '%s' (",
- TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
- gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
+ type->name () ? type->name () : "<NULL>");
+ gdb_print_host_address (type->name (), gdb_stdout);
printf_filtered (")\n");
printfi_filtered (spaces, "code 0x%x ", type->code ());
switch (type->code ())
@@ -5289,8 +5289,8 @@ copy_type_recursive (struct objfile *objfile,
TYPE_OBJFILE_OWNED (new_type) = 0;
TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
- if (TYPE_NAME (type))
- new_type->set_name (xstrdup (TYPE_NAME (type)));
+ if (type->name ())
+ new_type->set_name (xstrdup (type->name ()));
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index aeed06b..ba8e6f8 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1416,7 +1416,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
-#define TYPE_NAME(thistype) ((thistype)->name ())
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
@@ -1703,13 +1702,13 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
if the type has no name. */
#define TYPE_SAFE_NAME(type) \
- (TYPE_NAME (type) ? TYPE_NAME (type) : _("<unnamed type>"))
+ (type->name () != nullptr ? type->name () : _("<unnamed type>"))
/* * A helper macro that returns the name of an error type. If the
type has a name, it is used; otherwise, a default is used. */
#define TYPE_ERROR_NAME(type) \
- (TYPE_NAME (type) ? TYPE_NAME (type) : _("<error type>"))
+ (type->name () ? type->name () : _("<error type>"))
/* Given TYPE, return its floatformat. */
const struct floatformat *floatformat_from_type (const struct type *type);
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index bf438a8..d4cf6b9 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -325,10 +325,10 @@ vb_match (struct type *type, int index, struct type *basetype)
if (TYPE_TARGET_TYPE (fieldtype) == basetype)
return 1;
- if (TYPE_NAME (basetype) != NULL
- && TYPE_NAME (TYPE_TARGET_TYPE (fieldtype)) != NULL
- && strcmp (TYPE_NAME (basetype),
- TYPE_NAME (TYPE_TARGET_TYPE (fieldtype))) == 0)
+ if (basetype->name () != NULL
+ && TYPE_TARGET_TYPE (fieldtype)->name () != NULL
+ && strcmp (basetype->name (),
+ TYPE_TARGET_TYPE (fieldtype)->name ()) == 0)
return 1;
return 0;
}
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 373c12d..366ac36 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -92,7 +92,7 @@ gccgo_string_p (struct type *type)
if (target_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (target_type) == 1
- && strcmp (TYPE_NAME (target_type), "uint8") == 0)
+ && strcmp (target_type->name (), "uint8") == 0)
return 1;
}
}
@@ -107,8 +107,8 @@ static int
sixg_string_p (struct type *type)
{
if (TYPE_NFIELDS (type) == 2
- && TYPE_NAME (type) != NULL
- && strcmp (TYPE_NAME (type), "string") == 0)
+ && type->name () != NULL
+ && strcmp (type->name (), "string") == 0)
return 1;
return 0;
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 521f484..6ea6a31 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -580,7 +580,7 @@ gdbscm_type_tag (SCM self)
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM)
- tagname = TYPE_NAME (type);
+ tagname = type->name ();
if (tagname == nullptr)
return SCM_BOOL_F;
@@ -597,9 +597,9 @@ gdbscm_type_name (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- if (!TYPE_NAME (type))
+ if (!type->name ())
return SCM_BOOL_F;
- return gdbscm_scm_from_c_string (TYPE_NAME (type));
+ return gdbscm_scm_from_c_string (type->name ());
}
/* (type-print-name <gdb:type>) -> string
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 818b6cb..8da843a 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1062,11 +1062,11 @@ call_function_by_hand_dummy (struct value *function,
auto info = language_pass_by_reference (param_type);
if (!info.copy_constructible)
error (_("expression cannot be evaluated because the type '%s' "
- "is not copy constructible"), TYPE_NAME (param_type));
+ "is not copy constructible"), param_type->name ());
if (!info.destructible)
error (_("expression cannot be evaluated because the type '%s' "
- "is not destructible"), TYPE_NAME (param_type));
+ "is not destructible"), param_type->name ());
if (info.trivially_copyable)
continue;
@@ -1091,14 +1091,14 @@ call_function_by_hand_dummy (struct value *function,
value *copy_ctor;
value *cctor_args[2] = { clone_ptr, original_arg };
find_overload_match (gdb::make_array_view (cctor_args, 2),
- TYPE_NAME (param_type), METHOD,
+ param_type->name (), METHOD,
&clone_ptr, nullptr, &copy_ctor, nullptr,
nullptr, 0, EVAL_NORMAL);
if (copy_ctor == nullptr)
error (_("expression cannot be evaluated because a copy "
"constructor for the type '%s' could not be found "
- "(maybe inlined?)"), TYPE_NAME (param_type));
+ "(maybe inlined?)"), param_type->name ());
call_function_by_hand (copy_ctor, default_return_type,
gdb::make_array_view (cctor_args, 2));
@@ -1130,7 +1130,7 @@ call_function_by_hand_dummy (struct value *function,
if (dtor_name == nullptr)
error (_("expression cannot be evaluated because a destructor "
"for the type '%s' could not be found "
- "(maybe inlined?)"), TYPE_NAME (param_type));
+ "(maybe inlined?)"), param_type->name ());
value *dtor
= find_function_in_inferior (dtor_name, 0);
diff --git a/gdb/language.c b/gdb/language.c
index 3dc22a7..732a697 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -999,7 +999,7 @@ language_lookup_primitive_type_1 (const struct language_arch_info *lai,
for (p = lai->primitive_type_vector; (*p) != NULL; p++)
{
- if (strcmp (TYPE_NAME (*p), name) == 0)
+ if (strcmp ((*p)->name (), name) == 0)
return p;
}
return NULL;
@@ -1037,7 +1037,7 @@ language_alloc_type_symbol (enum language lang, struct type *type)
gdbarch = TYPE_OWNER (type).gdbarch;
symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
- symbol->m_name = TYPE_NAME (type);
+ symbol->m_name = type->name ();
symbol->set_language (lang, nullptr);
symbol->owner.arch = gdbarch;
SYMBOL_OBJFILE_OWNED (symbol) = 0;
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 1e70cdb..c59c30e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1222,7 +1222,7 @@ find_methods (struct type *t, enum language t_lang, const char *name,
std::vector<struct type *> *superclasses)
{
int ibase;
- const char *class_name = TYPE_NAME (t);
+ const char *class_name = t->name ();
/* Ignore this class if it doesn't have a name. This is ugly, but
unless we figure out how to get the physname without the name of
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 7f0255b..5912670 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -271,9 +271,9 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
else
if (type->code () != TYPE_CODE_ARRAY)
{
- if (TYPE_NAME (type))
+ if (type->name ())
error (_("cannot subscript something of type `%s'"),
- TYPE_NAME (type));
+ type->name ());
else
error (_("cannot subscript requested type"));
}
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 1f1300c..9922299 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -163,8 +163,8 @@ m2_print_typedef (struct type *type, struct symbol *new_symbol,
{
type = check_typedef (type);
fprintf_filtered (stream, "TYPE ");
- if (!TYPE_NAME (SYMBOL_TYPE (new_symbol))
- || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
+ if (!SYMBOL_TYPE (new_symbol)->name ()
+ || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
new_symbol->linkage_name ()) != 0)
fprintf_filtered (stream, "%s = ", new_symbol->print_name ());
else
@@ -178,8 +178,8 @@ m2_print_typedef (struct type *type, struct symbol *new_symbol,
void
m2_type_name (struct type *type, struct ui_file *stream)
{
- if (TYPE_NAME (type) != NULL)
- fputs_filtered (TYPE_NAME (type), stream);
+ if (type->name () != NULL)
+ fputs_filtered (type->name (), stream);
}
/* m2_range - displays a Modula-2 subrange type. */
@@ -211,9 +211,9 @@ static void
m2_typedef (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags)
{
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (" = ", stream);
}
m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
@@ -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 (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
if (show == 0)
return 1;
fputs_filtered (" = ", stream);
@@ -530,11 +530,11 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags)
{
/* Print the tag if it exists. */
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- if (!startswith (TYPE_NAME (type), "$$"))
+ if (!startswith (type->name (), "$$"))
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
if (show > 0)
fprintf_filtered (stream, " = ");
}
@@ -595,10 +595,10 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
fprintf_filtered (stream, "(...)");
}
- else if (show > 0 || TYPE_NAME (type) == NULL)
+ else if (show > 0 || type->name () == NULL)
{
fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index cd08d26..9ad9c66 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -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);
/* Incomplete definitions of structs should not get a name. */
- if (TYPE_NAME (SYMBOL_TYPE (s)) == NULL
+ if (SYMBOL_TYPE (s)->name () == NULL
&& (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0
|| (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
&& SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
@@ -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. */
if (name[0] == '.' || name[0] == '\0')
tp->set_name (NULL);
- else if (TYPE_NAME (tp) == NULL
- || strcmp (TYPE_NAME (tp), name) != 0)
+ else if (tp->name () == NULL
+ || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name));
}
@@ -1711,8 +1711,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
bad_tag_guess_complaint (sym_name);
tp->set_code (type_code);
}
- if (TYPE_NAME (tp) == NULL
- || strcmp (TYPE_NAME (tp), name) != 0)
+ if (tp->name () == NULL
+ || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name));
}
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index d686c6e..ae95d77 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1008,7 +1008,7 @@ opencl_print_type (struct type *type, const char *varstring,
{
type = check_typedef (type);
if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
- && TYPE_NAME (type) != NULL)
+ && type->name () != NULL)
show = 0;
}
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index e332fe9..6403e41 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -669,7 +669,7 @@ qualified_name: typebase COLONCOLON name
if (type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION)
error (_("`%s' is not defined as an aggregate type."),
- TYPE_NAME (type));
+ type->name ());
write_exp_elt_opcode (pstate, OP_SCOPE);
write_exp_elt_type (pstate, type);
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 4d6eb26..05e28a4 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -140,7 +140,7 @@ pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
fprintf_filtered (stream, "%s%s ",
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
- name = TYPE_NAME (TYPE_BASECLASS (type, i));
+ name = TYPE_BASECLASS (type, i)->name ();
fprintf_filtered (stream, "%s", name ? name : "(null)");
}
if (i > 0)
@@ -211,7 +211,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
QUIT;
@@ -377,7 +377,7 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (type == 0)
return;
- if (TYPE_NAME (type) && show <= 0)
+ if (type->name () && show <= 0)
return;
QUIT;
@@ -479,7 +479,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if ((type->code () == TYPE_CODE_PTR)
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID))
{
- fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer",
+ fputs_filtered (type->name () ? type->name () : "pointer",
stream);
return;
}
@@ -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. */
if (show <= 0
- && TYPE_NAME (type) != NULL)
+ && type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
return;
}
@@ -523,9 +523,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
only after args !! */
break;
case TYPE_CODE_STRUCT:
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (" = ", stream);
}
if (HAVE_CPLUS_STRUCT (type))
@@ -539,9 +539,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
goto struct_union;
case TYPE_CODE_UNION:
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (" = ", stream);
}
fprintf_filtered (stream, "case <?> of ");
@@ -551,10 +551,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_NAME (type) == NULL)
+ else if (show > 0 || type->name () == NULL)
{
pascal_type_print_derivation_info (stream, type);
@@ -739,9 +739,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
case TYPE_CODE_ENUM:
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -752,10 +752,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
fprintf_filtered (stream, "(...)");
}
- else if (show > 0 || TYPE_NAME (type) == NULL)
+ else if (show > 0 || type->name () == NULL)
{
fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type);
@@ -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
the type name is, as recorded in the type itself. If there
is no type name, then complain. */
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
}
else
{
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 8172e04..44dcbf9 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -423,9 +423,9 @@ pascal_value_print (struct value *val, struct ui_file *stream,
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR
- && TYPE_NAME (type) == NULL
- && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
- && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
+ && type->name () == NULL
+ && TYPE_TARGET_TYPE (type)->name () != NULL
+ && strcmp (TYPE_TARGET_TYPE (type)->name (), "char") == 0)
{
/* Print nothing. */
}
@@ -469,7 +469,7 @@ const char pascal_vtbl_ptr_name[] =
int
pascal_object_is_vtbl_ptr_type (struct type *type)
{
- const char *type_name = TYPE_NAME (type);
+ const char *type_name = type->name ();
return (type_name != NULL
&& strcmp (type_name, pascal_vtbl_ptr_name) == 0);
@@ -564,7 +564,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
fputs_filtered ("members of ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (": ", stream);
}
}
@@ -710,7 +710,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
{
LONGEST boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = TYPE_NAME (baseclass);
+ const char *basename = baseclass->name ();
int skip = 0;
if (BASETYPE_VIA_VIRTUAL (type, i))
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index e62ff57..4b57e16 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -393,9 +393,9 @@ typy_get_name (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
Py_RETURN_NONE;
- return PyString_FromString (TYPE_NAME (type));
+ return PyString_FromString (type->name ());
}
/* Return the type's tag, or None. */
@@ -408,7 +408,7 @@ typy_get_tag (PyObject *self, void *closure)
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM)
- tagname = TYPE_NAME (type);
+ tagname = type->name ();
if (tagname == nullptr)
Py_RETURN_NONE;
@@ -875,7 +875,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
std::string err;
struct type *argtype;
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
{
PyErr_SetString (PyExc_RuntimeError, _("Null type name."));
return NULL;
@@ -884,7 +884,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
try
{
/* Note -- this is not thread-safe. */
- info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
+ info = cp_demangled_name_to_comp (type->name (), &err);
}
catch (const gdb_exception &except)
{
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 417d61c..6a4359d 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1392,7 +1392,7 @@ register_dump::dump (ui_file *file)
{
static const char blt[] = "builtin_type";
- t = TYPE_NAME (register_type (m_gdbarch, regnum));
+ t = register_type (m_gdbarch, regnum)->name ();
if (t == NULL)
{
if (!footnote_register_type_name_null)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index e4edd7c..dae6520 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -576,8 +576,8 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum)
if (flen == 8
&& type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == flen
- && (strcmp (TYPE_NAME (type), "builtin_type_ieee_double") == 0
- || strcmp (TYPE_NAME (type), "double") == 0))
+ && (strcmp (type->name (), "builtin_type_ieee_double") == 0
+ || strcmp (type->name (), "double") == 0))
type = riscv_fpreg_d_type (gdbarch);
}
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 3fa550d..2c76762 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -110,8 +110,8 @@ rust_tuple_type_p (struct type *type)
nothing else in the debuginfo to distinguish a tuple from a
struct. */
return (type->code () == TYPE_CODE_STRUCT
- && TYPE_NAME (type) != NULL
- && TYPE_NAME (type)[0] == '(');
+ && type->name () != NULL
+ && type->name ()[0] == '(');
}
/* Return true if all non-static fields of a structlike type are in a
@@ -158,9 +158,9 @@ static bool
rust_slice_type_p (struct type *type)
{
return (type->code () == TYPE_CODE_STRUCT
- && TYPE_NAME (type) != NULL
- && (strncmp (TYPE_NAME (type), "&[", 2) == 0
- || strcmp (TYPE_NAME (type), "&str") == 0));
+ && type->name () != NULL
+ && (strncmp (type->name (), "&[", 2) == 0
+ || strcmp (type->name (), "&str") == 0));
}
/* Return true if TYPE is a range type, otherwise false. */
@@ -172,8 +172,8 @@ rust_range_type_p (struct type *type)
if (type->code () != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (type) > 2
- || TYPE_NAME (type) == NULL
- || strstr (TYPE_NAME (type), "::Range") == NULL)
+ || type->name () == NULL
+ || strstr (type->name (), "::Range") == NULL)
return false;
if (TYPE_NFIELDS (type) == 0)
@@ -202,8 +202,8 @@ rust_range_type_p (struct type *type)
static bool
rust_inclusive_range_type_p (struct type *type)
{
- return (strstr (TYPE_NAME (type), "::RangeInclusive") != NULL
- || strstr (TYPE_NAME (type), "::RangeToInclusive") != NULL);
+ return (strstr (type->name (), "::RangeInclusive") != NULL
+ || strstr (type->name (), "::RangeToInclusive") != NULL);
}
/* Return true if TYPE seems to be the type "u8", otherwise false. */
@@ -243,7 +243,7 @@ rust_is_string_type_p (struct type *type)
|| (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type)
&& rust_slice_type_p (type)
- && strcmp (TYPE_NAME (type), "&str") == 0));
+ && strcmp (type->name (), "&str") == 0));
}
/* If VALUE represents a trait object pointer, return the underlying
@@ -379,7 +379,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
int first_field;
struct type *type = check_typedef (value_type (val));
- if (rust_slice_type_p (type) && strcmp (TYPE_NAME (type), "&str") == 0)
+ if (rust_slice_type_p (type) && strcmp (type->name (), "&str") == 0)
{
/* If what we are printing here is actually a string within a
structure then VAL will be the original parent value, while TYPE
@@ -399,13 +399,13 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
if (!is_tuple)
{
- if (TYPE_NAME (type) != NULL)
- fprintf_filtered (stream, "%s", TYPE_NAME (type));
+ if (type->name () != NULL)
+ fprintf_filtered (stream, "%s", type->name ());
if (TYPE_NFIELDS (type) == 0)
return;
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
fputs_filtered (" ", stream);
}
@@ -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. */
fprintf_filtered (stream, _("%s {%p[<No data fields>%p]}"),
- TYPE_NAME (type),
+ type->name (),
metadata_style.style ().ptr (), nullptr);
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);
- fprintf_filtered (stream, "%s", TYPE_NAME (variant_type));
+ fprintf_filtered (stream, "%s", variant_type->name ());
if (nfields == 0)
{
/* In case of a nullary variant like 'None', just output
@@ -599,7 +599,7 @@ rust_value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_INT:
/* Recognize the unit type. */
if (TYPE_UNSIGNED (type) && TYPE_LENGTH (type) == 0
- && TYPE_NAME (type) != NULL && strcmp (TYPE_NAME (type), "()") == 0)
+ && type->name () != NULL && strcmp (type->name (), "()") == 0)
{
fputs_filtered ("()", stream);
break;
@@ -676,7 +676,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
/* Print a tuple type simply. */
if (rust_tuple_type_p (type))
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
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
rest of the code ends up looking only at the variant part. */
- const char *tagname = TYPE_NAME (type);
+ const char *tagname = type->name ();
bool is_tuple_struct = rust_tuple_struct_type_p (type);
bool is_tuple = rust_tuple_type_p (type);
bool is_enum = rust_enum_p (type);
@@ -824,14 +824,14 @@ rust_internal_print_type (struct type *type, const char *varstring,
{
QUIT;
if (show <= 0
- && TYPE_NAME (type) != NULL)
+ && type->name () != NULL)
{
/* Rust calls the unit type "void" in its debuginfo,
but we don't want to print it as that. */
if (type->code () == TYPE_CODE_VOID)
fputs_filtered ("()", stream);
else
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
return;
}
@@ -903,11 +903,11 @@ rust_internal_print_type (struct type *type, const char *varstring,
int len = 0;
fputs_filtered ("enum ", stream);
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fputs_filtered (type->name (), stream);
fputs_filtered (" ", stream);
- len = strlen (TYPE_NAME (type));
+ len = strlen (type->name ());
}
fputs_filtered ("{\n", stream);
@@ -918,7 +918,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT;
if (len > 0
- && strncmp (name, TYPE_NAME (type), len) == 0
+ && strncmp (name, type->name (), len) == 0
&& name[len] == ':'
&& name[len + 1] == ':')
name += len + 2;
@@ -933,8 +933,8 @@ rust_internal_print_type (struct type *type, const char *varstring,
case TYPE_CODE_PTR:
{
- if (TYPE_NAME (type) != nullptr)
- fputs_filtered (TYPE_NAME (type), stream);
+ if (type->name () != nullptr)
+ fputs_filtered (type->name (), stream);
else
{
/* We currently can't distinguish between pointers and
@@ -1160,10 +1160,10 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
&& type->code () != TYPE_CODE_ENUM)
|| rust_tuple_type_p (type))
error (_("Method calls only supported on struct or enum types"));
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
error (_("Method call on nameless type"));
- std::string name = std::string (TYPE_NAME (type)) + "::" + method;
+ std::string name = std::string (type->name ()) + "::" + method;
block = get_selected_block (0);
sym = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL);
@@ -1465,7 +1465,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
"usize");
const char *new_name = ((type != nullptr
&& rust_slice_type_p (type))
- ? TYPE_NAME (type) : "&[*gdb*]");
+ ? type->name () : "&[*gdb*]");
slice = rust_slice_type (new_name, value_type (result), usize);
@@ -1667,7 +1667,7 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (rust_empty_enum_p (type))
error (_("Cannot access field %d of empty enum %s"),
- field_number, TYPE_NAME (type));
+ field_number, type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
@@ -1683,13 +1683,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (outer_type != NULL)
error(_("Cannot access field %d of variant %s::%s, "
"there are only %d fields"),
- field_number, TYPE_NAME (outer_type),
- rust_last_path_segment (TYPE_NAME (type)),
+ field_number, outer_type->name (),
+ rust_last_path_segment (type->name ()),
nfields);
else
error(_("Cannot access field %d of %s, "
"there are only %d fields"),
- field_number, TYPE_NAME (type), nfields);
+ field_number, type->name (), nfields);
}
/* Tuples are tuple structs too. */
@@ -1697,13 +1697,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
{
if (outer_type != NULL)
error(_("Variant %s::%s is not a tuple variant"),
- TYPE_NAME (outer_type),
- rust_last_path_segment (TYPE_NAME (type)));
+ outer_type->name (),
+ rust_last_path_segment (type->name ()));
else
error(_("Attempting to access anonymous field %d "
"of %s, which is not a tuple, tuple struct, or "
"tuple-like variant"),
- field_number, TYPE_NAME (type));
+ field_number, type->name ());
}
result = value_primitive_field (lhs, 0, field_number, type);
@@ -1735,7 +1735,7 @@ tuple structs, and tuple-like enum variants"));
if (rust_empty_enum_p (type))
error (_("Cannot access field %s of empty enum %s"),
- field_name, TYPE_NAME (type));
+ field_name, type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
@@ -1745,8 +1745,8 @@ tuple structs, and tuple-like enum variants"));
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
error (_("Attempting to access named field %s of tuple "
"variant %s::%s, which has only anonymous fields"),
- field_name, TYPE_NAME (outer_type),
- rust_last_path_segment (TYPE_NAME (type)));
+ field_name, outer_type->name (),
+ rust_last_path_segment (type->name ()));
try
{
@@ -1756,8 +1756,8 @@ tuple structs, and tuple-like enum variants"));
catch (const gdb_exception_error &except)
{
error (_("Could not find field %s of struct variant %s::%s"),
- field_name, TYPE_NAME (outer_type),
- rust_last_path_segment (TYPE_NAME (type)));
+ field_name, outer_type->name (),
+ rust_last_path_segment (type->name ()));
}
}
else
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 12e164c..a632856 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -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
derived class was output. We fill in the derived class's
base part member's name here in that case. */
- if (TYPE_NAME (SYMBOL_TYPE (sym)) != NULL)
+ if (SYMBOL_TYPE (sym)->name () != NULL)
if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
&& TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
@@ -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--)
if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0)
TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) =
- TYPE_NAME (TYPE_BASECLASS (SYMBOL_TYPE (sym), j));
+ TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name ();
}
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
+ if (SYMBOL_TYPE (sym)->name () == NULL)
{
if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
&& strcmp (sym->linkage_name (), vtbl_ptr_name))
@@ -1311,7 +1311,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (struct_sym) = valu;
SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
@@ -1338,7 +1338,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
@@ -1353,7 +1353,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (typedef_sym) = valu;
SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
@@ -2748,7 +2748,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
switch (cpp_abbrev)
{
case 'f': /* $vf -- a virtual function table pointer */
- name = TYPE_NAME (context);
+ name = context->name ();
if (name == NULL)
{
name = "";
@@ -2758,7 +2758,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
break;
case 'b': /* $vb -- a virtual bsomethingorother */
- name = TYPE_NAME (context);
+ name = context->name ();
if (name == NULL)
{
complaint (_("C++ abbreviated type name "
@@ -3161,7 +3161,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
field's name. */
newobj->field.type = read_type (pp, objfile);
- newobj->field.name = TYPE_NAME (newobj->field.type);
+ newobj->field.name = newobj->field.type->name ();
/* Skip trailing ';' and bump count of number of fields seen. */
if (**pp == ';')
@@ -3248,7 +3248,7 @@ read_tilde_fields (struct stab_field_info *fip, const char **pp,
/* Virtual function table field not found. */
complaint (_("virtual function table pointer "
"not found when defining class `%s'"),
- TYPE_NAME (type));
+ type->name ());
return 0;
}
else
@@ -3377,9 +3377,9 @@ complain_about_struct_wipeout (struct type *type)
const char *name = "";
const char *kind = "";
- if (TYPE_NAME (type))
+ if (type->name ())
{
- name = TYPE_NAME (type);
+ name = type->name ();
switch (type->code ())
{
case TYPE_CODE_STRUCT: kind = "struct "; break;
@@ -4408,7 +4408,7 @@ add_undefined_type_1 (struct type *type)
static void
add_undefined_type (struct type *type, int typenums[2])
{
- if (TYPE_NAME (type) == NULL)
+ if (type->name () == NULL)
add_undefined_type_noname (type, typenums);
else
add_undefined_type_1 (type);
@@ -4493,7 +4493,7 @@ cleanup_undefined_types_1 (void)
struct pending *ppt;
int i;
/* Name of the type, without "struct" or "union". */
- const char *type_name = TYPE_NAME (*type);
+ const char *type_name = (*type)->name ();
if (type_name == NULL)
{
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index ebbedef..fc56cfa 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -556,7 +556,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
if (SYMBOL_DOMAIN (symbol) == STRUCT_DOMAIN)
{
- if (TYPE_NAME (SYMBOL_TYPE (symbol)))
+ if (SYMBOL_TYPE (symbol)->name ())
{
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
&type_print_raw_options);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1a5de4d..20d73bb 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -595,7 +595,7 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
struct fn_field *method = &f[signature_id];
const char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
- const char *newname = TYPE_NAME (type);
+ const char *newname = type->name ();
/* Does the form of physname indicate that it is the full mangled name
of a constructor (not just the args)? */
diff --git a/gdb/valarith.c b/gdb/valarith.c
index f1e1d6e..82e63a3 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -60,7 +60,7 @@ find_size_for_pointer_math (struct type *ptr_type)
{
const char *name;
- name = TYPE_NAME (ptr_target);
+ name = ptr_target->name ();
if (name == NULL)
error (_("Cannot perform pointer math on incomplete types, "
"try casting to a known type, or void *."));
@@ -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));
}
else
- error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
- TYPE_NAME (type2));
+ error (_("Don't know how to convert from %s to %s."), type1->name (),
+ type2->name ());
/* Obtain value of arg2, converting from other types if necessary. */
@@ -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));
}
else
- error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
- TYPE_NAME (type2));
+ error (_("Don't know how to convert from %s to %s."), type1->name (),
+ type2->name ());
}
/* A helper function that finds the type to use for a binary operation
diff --git a/gdb/valops.c b/gdb/valops.c
index 5e29482..40c8f34 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -222,17 +222,17 @@ value_cast_structs (struct type *type, struct value *v2)
|| t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind");
- if (TYPE_NAME (t1) != NULL
- && TYPE_NAME (t2) != NULL
- && !strcmp (TYPE_NAME (t1), TYPE_NAME (t2)))
+ if (t1->name () != NULL
+ && t2->name () != NULL
+ && !strcmp (t1->name (), t2->name ()))
return NULL;
/* Upcasting: look in the type of the source to see if it contains the
type of the target as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */
- if (TYPE_NAME (t1) != NULL)
+ if (t1->name () != NULL)
{
- v = search_struct_field (TYPE_NAME (t1),
+ v = search_struct_field (t1->name (),
v2, t2, 1);
if (v)
return v;
@@ -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
type of the source as a superclass. If so, we'll need to
offset the pointer rather than just change its type. */
- if (TYPE_NAME (t2) != NULL)
+ if (t2->name () != NULL)
{
/* Try downcasting using the run-time type of the value. */
int full, using_enc;
@@ -257,11 +257,11 @@ value_cast_structs (struct type *type, struct value *v2)
/* We might be trying to cast to the outermost enclosing
type, in which case search_struct_field won't work. */
- if (TYPE_NAME (real_type) != NULL
- && !strcmp (TYPE_NAME (real_type), TYPE_NAME (t1)))
+ if (real_type->name () != NULL
+ && !strcmp (real_type->name (), t1->name ()))
return v;
- v = search_struct_field (TYPE_NAME (t2), v, real_type, 1);
+ v = search_struct_field (t2->name (), v, real_type, 1);
if (v)
return v;
}
@@ -269,7 +269,7 @@ value_cast_structs (struct type *type, struct value *v2)
/* Try downcasting using information from the destination type
T2. This wouldn't work properly for classes with virtual
bases, but those were handled above. */
- v = search_struct_field (TYPE_NAME (t2),
+ v = search_struct_field (t2->name (),
value_zero (t1, not_lval), t1, 1);
if (v)
{
@@ -443,7 +443,7 @@ value_cast (struct type *type, struct value *arg2)
if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
&& (code2 == TYPE_CODE_STRUCT || code2 == TYPE_CODE_UNION)
- && TYPE_NAME (type) != 0)
+ && type->name () != 0)
{
struct value *v = value_cast_structs (to_type, arg2);
@@ -2479,7 +2479,7 @@ find_overload_match (gdb::array_view<value *> args,
obj = coerce_ref (obj);
while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR)
obj = coerce_ref (value_ind (obj));
- obj_type_name = TYPE_NAME (value_type (obj));
+ obj_type_name = value_type (obj)->name ();
/* First check whether this is a data member, e.g. a pointer to
a function. */
@@ -3141,7 +3141,7 @@ enum_constant_from_type (struct type *type, const char *name)
}
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,
@@ -3528,7 +3528,7 @@ value_namespace_elt (const struct type *curtype,
if (retval == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_NAME (curtype));
+ name, curtype->name ());
return retval;
}
@@ -3544,7 +3544,7 @@ value_maybe_namespace_elt (const struct type *curtype,
const char *name, int want_address,
enum noside noside)
{
- const char *namespace_name = TYPE_NAME (curtype);
+ const char *namespace_name = curtype->name ();
struct block_symbol sym;
struct value *result;
@@ -3684,7 +3684,7 @@ value_full_object (struct value *argp,
{
warning (_("Couldn't retrieve complete object of RTTI "
"type %s; object may be in register(s)."),
- TYPE_NAME (real_type));
+ real_type->name ());
return argp;
}
diff --git a/gdb/value.c b/gdb/value.c
index df14232..cb86050 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1001,9 +1001,9 @@ check_type_length_before_alloc (const struct type *type)
if (max_value_size > -1 && length > max_value_size)
{
- if (TYPE_NAME (type) != NULL)
+ if (type->name () != NULL)
error (_("value of type `%s' requires %u bytes, which is more "
- "than max-value-size"), TYPE_NAME (type), length);
+ "than max-value-size"), type->name (), length);
else
error (_("value requires %u bytes, which is more than "
"max-value-size"), length);