diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-05-23 17:39:54 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-05-23 17:39:54 -0400 |
commit | ceacbf6edf2c72aaa16280205a9bfc8513e9ed27 (patch) | |
tree | 0e801f13f8c4c59f584af1e1cd5c9e49b225c3ab /gdb/dwarf2 | |
parent | 26f16254544873f4d7450f6fbbc8f34bf3d2e359 (diff) | |
download | gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.zip gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.tar.gz gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.tar.bz2 |
gdb: remove TYPE_FIELD macro
Replace all uses of it by type::field.
Note that since type::field returns a reference to the field, some spots
are used to assign the whole field structure. See ctfread.c, function
attach_fields_to_type, for example. This is the same as was happening
with the macro, so I don't think it's a problem, but if anybody sees a
really nicer way to do this, now could be a good time to implement it.
gdb/ChangeLog:
* gdbtypes.h (TYPE_FIELD): Remove. Replace all uses with
type::field.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/read.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e6d0811..ec38441 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9364,7 +9364,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) type->set_code (TYPE_CODE_STRUCT); type->set_num_fields (3); /* Save the field we care about. */ - struct field saved_field = TYPE_FIELD (type, 0); + struct field saved_field = type->field (0); type->set_fields ((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field))); @@ -9372,11 +9372,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) TYPE_FIELD_TYPE (type, 0) = field_type; TYPE_FIELD_ARTIFICIAL (type, 0) = 1; TYPE_FIELD_NAME (type, 0) = "<<discriminant>>"; - SET_FIELD_BITPOS (TYPE_FIELD (type, 0), bit_offset); + SET_FIELD_BITPOS (type->field (0), bit_offset); /* The order of fields doesn't really matter, so put the real field at index 1 and the data-less field at index 2. */ - TYPE_FIELD (type, 1) = saved_field; + type->field (1) = saved_field; TYPE_FIELD_NAME (type, 1) = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ()); TYPE_FIELD_TYPE (type, 1)->set_name @@ -9392,7 +9392,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* NAME points into the original discriminant name, which already has the correct lifetime. */ TYPE_FIELD_NAME (type, 2) = name; - SET_FIELD_BITPOS (TYPE_FIELD (type, 2), 0); + SET_FIELD_BITPOS (type->field (2), 0); /* Indicate that this is a variant type. */ static discriminant_range ranges[1] = { { 0, 0 } }; @@ -9454,7 +9454,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) type->set_code (TYPE_CODE_STRUCT); /* Make space for the discriminant field. */ - struct field *disr_field = &TYPE_FIELD (disr_type, 0); + struct field *disr_field = &disr_type->field (0); field *new_fields = (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1) * sizeof (struct field))); @@ -9464,7 +9464,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) type->set_num_fields (type->num_fields () + 1); /* Install the discriminant at index 0 in the union. */ - TYPE_FIELD (type, 0) = *disr_field; + type->field (0) = *disr_field; TYPE_FIELD_ARTIFICIAL (type, 0) = 1; TYPE_FIELD_NAME (type, 0) = "<<discriminant>>"; @@ -14849,7 +14849,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, = ((i < fip->baseclasses.size ()) ? fip->baseclasses[i] : fip->fields[i - fip->baseclasses.size ()]); - TYPE_FIELD (type, i) = field.field; + type->field (i) = field.field; switch (field.accessibility) { case DW_ACCESS_private: |