From d3fd12dfc52cf4cbb910830e3ff60dca111f7468 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 30 Aug 2021 11:49:48 -0400 Subject: gdb: add field::name / field::set_name Add the `name` and `set_name` methods on `struct field`, in order to remove `FIELD_NAME` and `TYPE_FIELD_NAME` macros. In this patch, the macros are changed to use `field::name`, so all the call sites that are used to set the field's name are changed to use `field::set_name`. The next patch will remove the macros completely. Note that because of the name clash between the existing field named `name` and the new method, I renamed the field `m_name`. It is not private per-se, because we can't make `struct field` a non-POD yet, but it should be considered private anyway (not accessed outside `struct field`). Change-Id: If16ddbca4e0c39d0ff9da420bb5cdebe5b9b0896 --- gdb/ada-lang.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a00fa14..cb011a5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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); - TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); + rtype->field (f).set_name (TYPE_FIELD_NAME (type, f)); /* 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 ()); - TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); + rtype->field (f).set_name (TYPE_FIELD_NAME (type, f)); if (TYPE_FIELD_BITSIZE (type, f) > 0) fld_bit_len = TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f); @@ -7686,7 +7686,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, else { rtype->field (variant_field).set_type (branch_type); - TYPE_FIELD_NAME (rtype, variant_field) = "S"; + rtype->field (variant_field).set_name ("S"); fld_bit_len = TYPE_LENGTH (rtype->field (variant_field).type ()) * TARGET_CHAR_BIT; @@ -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_NAME (type, f) = TYPE_FIELD_NAME (type0, f); + type->field (f).set_name (TYPE_FIELD_NAME (type0, f)); } } @@ -7871,7 +7871,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, else { rtype->field (variant_field).set_type (branch_type); - TYPE_FIELD_NAME (rtype, variant_field) = "S"; + rtype->field (variant_field).set_name ("S"); TYPE_FIELD_BITSIZE (rtype, variant_field) = 0; TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type); } -- cgit v1.1