aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-08-30 11:49:49 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-09-30 22:05:57 -0400
commit33d16dd987d16fe1eb289853e5a444192bb31d9e (patch)
tree06c5ec20fad9309ab4dace3b6c659fa518d272af /gdb/ada-lang.c
parentd3fd12dfc52cf4cbb910830e3ff60dca111f7468 (diff)
downloadgdb-33d16dd987d16fe1eb289853e5a444192bb31d9e.zip
gdb-33d16dd987d16fe1eb289853e5a444192bb31d9e.tar.gz
gdb-33d16dd987d16fe1eb289853e5a444192bb31d9e.tar.bz2
gdb: remove TYPE_FIELD_NAME and FIELD_NAME macros
Remove the `TYPE_FIELD_NAME` and `FIELD_NAME` macros, changing all the call sites to use field::name directly. Change-Id: I6900ae4e1ffab1396e24fb3298e94bf123826ca6
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index cb011a5..1a3ce36 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -468,7 +468,7 @@ ada_get_field_index (const struct type *type, const char *field_name,
struct type *struct_type = check_typedef ((struct type *) type);
for (fieldno = 0; fieldno < struct_type->num_fields (); fieldno++)
- if (field_name_match (TYPE_FIELD_NAME (struct_type, fieldno), field_name))
+ if (field_name_match (struct_type->field (fieldno).name (), field_name))
return fieldno;
if (!maybe_missing)
@@ -1375,13 +1375,13 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
is not equal to the field name. */
if (index_desc_type->field (0).type ()->name () != NULL
&& strcmp (index_desc_type->field (0).type ()->name (),
- TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
+ index_desc_type->field (0).name ()) == 0)
return;
/* Fixup each field of INDEX_DESC_TYPE. */
for (i = 0; i < index_desc_type->num_fields (); i++)
{
- const char *name = TYPE_FIELD_NAME (index_desc_type, i);
+ const char *name = index_desc_type->field (i).name ();
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
if (raw_type)
@@ -4644,16 +4644,16 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
suffix). */
for (i = 0; i < type1->num_fields (); i++)
{
- const char *name_1 = TYPE_FIELD_NAME (type1, i);
- const char *name_2 = TYPE_FIELD_NAME (type2, i);
+ const char *name_1 = type1->field (i).name ();
+ const char *name_2 = type2->field (i).name ();
int len_1 = strlen (name_1);
int len_2 = strlen (name_2);
- ada_remove_trailing_digits (TYPE_FIELD_NAME (type1, i), &len_1);
- ada_remove_trailing_digits (TYPE_FIELD_NAME (type2, i), &len_2);
+ ada_remove_trailing_digits (type1->field (i).name (), &len_1);
+ ada_remove_trailing_digits (type2->field (i).name (), &len_2);
if (len_1 != len_2
- || strncmp (TYPE_FIELD_NAME (type1, i),
- TYPE_FIELD_NAME (type2, i),
+ || strncmp (type1->field (i).name (),
+ type2->field (i).name (),
len_1) != 0)
return 0;
}
@@ -5972,7 +5972,7 @@ ada_is_ignored_field (struct type *type, int field_num)
/* Check the name of that field. */
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
/* Anonymous field names should not be printed.
brobecker/2007-02-20: I don't think this can actually happen
@@ -6331,7 +6331,7 @@ ada_parent_type (struct type *type)
int
ada_is_parent_field (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num);
+ const char *name = ada_check_typedef (type)->field (field_num).name ();
return (name != NULL
&& (startswith (name, "PARENT")
@@ -6347,7 +6347,7 @@ ada_is_parent_field (struct type *type, int field_num)
int
ada_is_wrapper_field (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
if (name != NULL && strcmp (name, "RETVAL") == 0)
{
@@ -6406,7 +6406,7 @@ ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
static int
ada_is_others_clause (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
return (name != NULL && name[0] == 'O');
}
@@ -6511,7 +6511,7 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
static int
ada_in_variant (LONGEST val, struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
int p;
p = 0;
@@ -6671,7 +6671,7 @@ find_struct_field (const char *name, struct type *type, int offset,
{
int bit_pos = TYPE_FIELD_BITPOS (type, i);
int fld_offset = offset + bit_pos / 8;
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name == NULL)
continue;
@@ -6781,7 +6781,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
type = ada_check_typedef (type);
for (i = 0; i < type->num_fields (); i += 1)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name == NULL)
continue;
@@ -6881,7 +6881,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
for (i = 0; i < type->num_fields (); i += 1)
{
- if (TYPE_FIELD_NAME (type, i) == NULL)
+ if (type->field (i).name () == NULL)
continue;
else if (ada_is_wrapper_field (type, i))
{
@@ -6974,7 +6974,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
for (i = 0; i < type->num_fields (); i += 1)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
struct type *t;
if (t_field_name == NULL)
@@ -7016,7 +7016,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
NOT wrapped in a struct, since the compiler sometimes
generates these for unchecked variant types. Revisit
if the compiler changes this practice. */
- const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
+ const char *v_field_name = field_type->field (j).name ();
if (v_field_name != NULL
&& field_name_match (v_field_name, name))
@@ -7182,7 +7182,7 @@ ada_coerce_ref (struct value *val0)
static unsigned int
field_alignment (struct type *type, int f)
{
- const char *name = TYPE_FIELD_NAME (type, f);
+ const char *name = type->field (f).name ();
int len;
int align_offset;
@@ -7425,7 +7425,7 @@ dynamic_template_type (struct type *type)
static int
is_dynamic_field (struct type *templ_type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (templ_type, field_num);
+ const char *name = templ_type->field (field_num).name ();
return name != NULL
&& templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
@@ -7601,7 +7601,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
ada_ensure_varsize_limit (field_type);
rtype->field (f).set_type (field_type);
- rtype->field (f).set_name (TYPE_FIELD_NAME (type, f));
+ rtype->field (f).set_name (type->field (f).name ());
/* The multiplication can potentially overflow. But because
the field length has been size-checked just above, and
assuming that the maximum size is a reasonable value,
@@ -7624,7 +7624,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
to distinguish between the two options. Stripping it
would prevent us from printing this field appropriately. */
rtype->field (f).set_type (type->field (f).type ());
- rtype->field (f).set_name (TYPE_FIELD_NAME (type, f));
+ rtype->field (f).set_name (type->field (f).name ());
if (TYPE_FIELD_BITSIZE (type, f) > 0)
fld_bit_len =
TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
@@ -7802,7 +7802,7 @@ template_to_static_fixed_type (struct type *type0)
TYPE_LENGTH (type) = 0;
}
type->field (f).set_type (new_type);
- type->field (f).set_name (TYPE_FIELD_NAME (type0, f));
+ type->field (f).set_name (type0->field (f).name ());
}
}
@@ -8691,7 +8691,7 @@ ada_is_aligner_type (struct type *type)
return (type->code () == TYPE_CODE_STRUCT
&& type->num_fields () == 1
- && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
+ && strcmp (type->field (0).name (), "F") == 0);
}
/* If there is an ___XVS-convention type parallel to SUBTYPE, return
@@ -8732,7 +8732,7 @@ ada_get_base_type (struct type *raw_type)
/* This is an older encoding form where the base type needs to be
looked up by name. We prefer the newer encoding because it is
more efficient. */
- raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
+ raw_real_type = ada_find_any_type (real_type_namer->field (0).name ());
if (raw_real_type == NULL)
return raw_type;
else
@@ -10229,7 +10229,7 @@ convert_char_literal (struct type *type, LONGEST val)
have a name like "pkg__QUxx". This is safe enough because we
already have the correct type, and because mangling means
there can't be clashes. */
- const char *ename = TYPE_FIELD_NAME (type, f);
+ const char *ename = type->field (f).name ();
size_t elen = strlen (ename);
if (elen >= len && strcmp (name, ename + elen - len) == 0)