+2020-06-08 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (FIELD_TYPE): Remove. Change all call sites
+ to use field::type instead.
+
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct field) <type, set_type>: New methods.
/* We need a way to find the correct discriminant given a
variant name. For convenience we build a map here. */
- struct type *enum_type = FIELD_TYPE (*disr_field);
+ struct type *enum_type = disr_field->type ();
std::unordered_map<std::string, ULONGEST> discriminant_map;
for (int i = 0; i < enum_type->num_fields (); ++i)
{
{
result.discriminant_index = iter->second;
result.is_unsigned
- = TYPE_UNSIGNED (FIELD_TYPE
- (fi->fields[result.discriminant_index].field));
+ = TYPE_UNSIGNED (fi->fields[result.discriminant_index].field.type ());
}
size_t n = builder.variants.size ();
{
struct_elt elt = lookup_struct_elt (type, name, noerr);
if (elt.field != NULL)
- return FIELD_TYPE (*elt.field);
+ return elt.field->type ();
else
return NULL;
}
FIELD_LOC_KIND (*field1));
}
- worklist->emplace_back (FIELD_TYPE (*field1), FIELD_TYPE (*field2));
+ worklist->emplace_back (field1->type (), field2->type ());
}
}
{
SET_FIELD_BITPOS (f[0],
(FIELD_BITPOS (f[-1])
- + (TYPE_LENGTH (FIELD_TYPE (f[-1]))
+ + (TYPE_LENGTH (f[-1].type ())
* TARGET_CHAR_BIT)));
if (alignment)
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define FIELD_TYPE(thisfld) ((thisfld).type ())
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
-#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE((thistype)->field (n))
+#define TYPE_FIELD_TYPE(thistype, n) ((thistype)->field (n).type ())
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME((thistype)->field (n))
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
/* ptrdiff_t offset_to_top; */
FIELD_NAME (*field) = "offset_to_top";
field->set_type (ptrdiff_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
/* void *type_info; */
FIELD_NAME (*field) = "type_info";
field->set_type (void_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
/* void (*virtual_functions[0]) (); */
FIELD_NAME (*field) = "virtual_functions";
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
/* We assumed in the allocation above that there were four fields. */
FIELD_NAME (*field) = "_vptr.type_info";
field->set_type (void_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
/* The name. */
FIELD_NAME (*field) = "__name";
field->set_type (char_ptr_type);
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
- offset += TYPE_LENGTH (FIELD_TYPE (*field));
+ offset += TYPE_LENGTH (field->type ());
field++;
gdb_assert (field == (field_list + 2));
struct field *field = tyscm_field_smob_to_field (f_smob);
/* A field can have a NULL type in some situations. */
- if (FIELD_TYPE (*field))
- return tyscm_scm_from_type (FIELD_TYPE (*field));
+ if (field->type ())
+ return tyscm_scm_from_type (field->type ());
return SCM_BOOL_F;
}
continue;
if (inner != NULL)
return type;
- inner = FIELD_TYPE (f);
+ inner = f.type ();
}
if (inner == NULL)
Note that forward refs cannot be packed,
and treat enums as if they had the width of ints. */
- struct type *field_type = check_typedef (FIELD_TYPE (fip->list->field));
+ struct type *field_type = check_typedef (fip->list->field.type ());
if (field_type->code () != TYPE_CODE_INT
&& field_type->code () != TYPE_CODE_RANGE