aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-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/rust-lang.c
parentd3fd12dfc52cf4cbb910830e3ff60dca111f7468 (diff)
downloadfsf-binutils-gdb-33d16dd987d16fe1eb289853e5a444192bb31d9e.zip
fsf-binutils-gdb-33d16dd987d16fe1eb289853e5a444192bb31d9e.tar.gz
fsf-binutils-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/rust-lang.c')
-rw-r--r--gdb/rust-lang.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index f3e346e..79284be 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -135,7 +135,7 @@ rust_underscore_fields (struct type *type)
char buf[20];
xsnprintf (buf, sizeof (buf), "__%d", field_number);
- if (strcmp (buf, TYPE_FIELD_NAME (type, i)) != 0)
+ if (strcmp (buf, type->field (i).name ()) != 0)
return false;
field_number++;
}
@@ -182,7 +182,7 @@ rust_range_type_p (struct type *type)
return true;
i = 0;
- if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
+ if (strcmp (type->field (0).name (), "start") == 0)
{
if (type->num_fields () == 1)
return true;
@@ -194,7 +194,7 @@ rust_range_type_p (struct type *type)
return false;
}
- return strcmp (TYPE_FIELD_NAME (type, i), "end") == 0;
+ return strcmp (type->field (i).name (), "end") == 0;
}
/* Return true if TYPE is an inclusive range type, otherwise false.
@@ -244,9 +244,9 @@ rust_get_trait_object_pointer (struct value *value)
int vtable_field = 0;
for (int i = 0; i < 2; ++i)
{
- if (strcmp (TYPE_FIELD_NAME (type, i), "vtable") == 0)
+ if (strcmp (type->field (i).name (), "vtable") == 0)
vtable_field = i;
- else if (strcmp (TYPE_FIELD_NAME (type, i), "pointer") != 0)
+ else if (strcmp (type->field (i).name (), "pointer") != 0)
return NULL;
}
@@ -381,7 +381,7 @@ rust_language::val_print_struct
if (!is_tuple && !is_tuple_struct)
{
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
fputs_filtered (": ", stream);
}
@@ -463,7 +463,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
if (!is_tuple)
fprintf_filtered (stream, "%ps: ",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (variant_type, j)));
+ variant_type->field (j).name ()));
common_val_print (value_field (val, j), stream, recurse + 1, &opts,
this);
@@ -708,12 +708,12 @@ rust_print_struct_def (struct type *type, const char *varstring,
if (!for_rust_enum || flags->print_offsets)
print_spaces_filtered (level + 2, stream);
if (is_enum)
- fputs_styled (TYPE_FIELD_NAME (type, i), variable_name_style.style (),
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
stream);
else if (!is_tuple_struct)
fprintf_filtered (stream, "%ps: ",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (type, i)));
+ type->field (i).name ()));
rust_internal_print_type (type->field (i).type (), NULL,
stream, (is_enum ? show : show - 1),
@@ -840,7 +840,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
for (int i = 0; i < type->num_fields (); ++i)
{
- const char *name = TYPE_FIELD_NAME (type, i);
+ const char *name = type->field (i).name ();
QUIT;
@@ -1071,14 +1071,14 @@ rust_compute_range (struct type *type, struct value *range,
return;
i = 0;
- if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
+ if (strcmp (type->field (0).name (), "start") == 0)
{
*kind = RANGE_HIGH_BOUND_DEFAULT;
*low = value_as_long (value_field (range, 0));
++i;
}
if (type->num_fields () > i
- && strcmp (TYPE_FIELD_NAME (type, i), "end") == 0)
+ && strcmp (type->field (i).name (), "end") == 0)
{
*kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
@@ -1125,7 +1125,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
{
for (int i = 0; i < type->num_fields (); ++i)
{
- if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0)
+ if (strcmp (type->field (i).name (), "data_ptr") == 0)
{
base_type = TYPE_TARGET_TYPE (type->field (i).type ());
break;