gdb: remove FIELD_TYPE macro
Remove the `FIELD_TYPE` macro, changing all the call sites to use `field::type` directly. gdb/ChangeLog: * gdbtypes.h (FIELD_TYPE): Remove. Change all call sites to use field::type instead. Change-Id: I7673fedaa276e485189c87991a9043495da22ef5
This commit is contained in:
parent
5d14b6e5d6
commit
b6cdac4b80
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
* gdbtypes.h (struct field) <type, set_type>: New methods.
|
* gdbtypes.h (struct field) <type, set_type>: New methods.
|
||||||
|
|
|
@ -9605,7 +9605,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
|
||||||
|
|
||||||
/* We need a way to find the correct discriminant given a
|
/* We need a way to find the correct discriminant given a
|
||||||
variant name. For convenience we build a map here. */
|
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;
|
std::unordered_map<std::string, ULONGEST> discriminant_map;
|
||||||
for (int i = 0; i < enum_type->num_fields (); ++i)
|
for (int i = 0; i < enum_type->num_fields (); ++i)
|
||||||
{
|
{
|
||||||
|
@ -14867,8 +14867,7 @@ create_one_variant_part (variant_part &result,
|
||||||
{
|
{
|
||||||
result.discriminant_index = iter->second;
|
result.discriminant_index = iter->second;
|
||||||
result.is_unsigned
|
result.is_unsigned
|
||||||
= TYPE_UNSIGNED (FIELD_TYPE
|
= TYPE_UNSIGNED (fi->fields[result.discriminant_index].field.type ());
|
||||||
(fi->fields[result.discriminant_index].field));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t n = builder.variants.size ();
|
size_t n = builder.variants.size ();
|
||||||
|
|
|
@ -1802,7 +1802,7 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
|
||||||
{
|
{
|
||||||
struct_elt elt = lookup_struct_elt (type, name, noerr);
|
struct_elt elt = lookup_struct_elt (type, name, noerr);
|
||||||
if (elt.field != NULL)
|
if (elt.field != NULL)
|
||||||
return FIELD_TYPE (*elt.field);
|
return elt.field->type ();
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -4085,7 +4085,7 @@ check_types_equal (struct type *type1, struct type *type2,
|
||||||
FIELD_LOC_KIND (*field1));
|
FIELD_LOC_KIND (*field1));
|
||||||
}
|
}
|
||||||
|
|
||||||
worklist->emplace_back (FIELD_TYPE (*field1), FIELD_TYPE (*field2));
|
worklist->emplace_back (field1->type (), field2->type ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5673,7 +5673,7 @@ append_composite_type_field_aligned (struct type *t, const char *name,
|
||||||
{
|
{
|
||||||
SET_FIELD_BITPOS (f[0],
|
SET_FIELD_BITPOS (f[0],
|
||||||
(FIELD_BITPOS (f[-1])
|
(FIELD_BITPOS (f[-1])
|
||||||
+ (TYPE_LENGTH (FIELD_TYPE (f[-1]))
|
+ (TYPE_LENGTH (f[-1].type ())
|
||||||
* TARGET_CHAR_BIT)));
|
* TARGET_CHAR_BIT)));
|
||||||
|
|
||||||
if (alignment)
|
if (alignment)
|
||||||
|
|
|
@ -1610,7 +1610,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||||
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
||||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
||||||
|
|
||||||
#define FIELD_TYPE(thisfld) ((thisfld).type ())
|
|
||||||
#define FIELD_NAME(thisfld) ((thisfld).name)
|
#define FIELD_NAME(thisfld) ((thisfld).name)
|
||||||
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
||||||
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
||||||
|
@ -1638,7 +1637,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||||
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
|
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
|
||||||
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
|
#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_NAME(thistype, n) FIELD_NAME((thistype)->field (n))
|
||||||
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((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))
|
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
|
||||||
|
|
|
@ -137,28 +137,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
|
||||||
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
|
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
|
||||||
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
|
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* ptrdiff_t offset_to_top; */
|
/* ptrdiff_t offset_to_top; */
|
||||||
FIELD_NAME (*field) = "offset_to_top";
|
FIELD_NAME (*field) = "offset_to_top";
|
||||||
field->set_type (ptrdiff_type);
|
field->set_type (ptrdiff_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* void *type_info; */
|
/* void *type_info; */
|
||||||
FIELD_NAME (*field) = "type_info";
|
FIELD_NAME (*field) = "type_info";
|
||||||
field->set_type (void_ptr_type);
|
field->set_type (void_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* void (*virtual_functions[0]) (); */
|
/* void (*virtual_functions[0]) (); */
|
||||||
FIELD_NAME (*field) = "virtual_functions";
|
FIELD_NAME (*field) = "virtual_functions";
|
||||||
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
|
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* We assumed in the allocation above that there were four fields. */
|
/* We assumed in the allocation above that there were four fields. */
|
||||||
|
@ -1041,14 +1041,14 @@ build_std_type_info_type (struct gdbarch *arch)
|
||||||
FIELD_NAME (*field) = "_vptr.type_info";
|
FIELD_NAME (*field) = "_vptr.type_info";
|
||||||
field->set_type (void_ptr_type);
|
field->set_type (void_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* The name. */
|
/* The name. */
|
||||||
FIELD_NAME (*field) = "__name";
|
FIELD_NAME (*field) = "__name";
|
||||||
field->set_type (char_ptr_type);
|
field->set_type (char_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (field->type ());
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
gdb_assert (field == (field_list + 2));
|
gdb_assert (field == (field_list + 2));
|
||||||
|
|
|
@ -1147,8 +1147,8 @@ gdbscm_field_type (SCM self)
|
||||||
struct field *field = tyscm_field_smob_to_field (f_smob);
|
struct field *field = tyscm_field_smob_to_field (f_smob);
|
||||||
|
|
||||||
/* A field can have a NULL type in some situations. */
|
/* A field can have a NULL type in some situations. */
|
||||||
if (FIELD_TYPE (*field))
|
if (field->type ())
|
||||||
return tyscm_scm_from_type (FIELD_TYPE (*field));
|
return tyscm_scm_from_type (field->type ());
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1652,7 +1652,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size)
|
||||||
continue;
|
continue;
|
||||||
if (inner != NULL)
|
if (inner != NULL)
|
||||||
return type;
|
return type;
|
||||||
inner = FIELD_TYPE (f);
|
inner = f.type ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inner == NULL)
|
if (inner == NULL)
|
||||||
|
|
|
@ -2917,7 +2917,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
|
||||||
Note that forward refs cannot be packed,
|
Note that forward refs cannot be packed,
|
||||||
and treat enums as if they had the width of ints. */
|
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
|
if (field_type->code () != TYPE_CODE_INT
|
||||||
&& field_type->code () != TYPE_CODE_RANGE
|
&& field_type->code () != TYPE_CODE_RANGE
|
||||||
|
|
Loading…
Reference in New Issue