aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2/read.c5
-rw-r--r--gdb/gdbtypes.c6
-rw-r--r--gdb/gdbtypes.h3
-rw-r--r--gdb/gnu-v3-abi.c12
-rw-r--r--gdb/guile/scm-type.c4
-rw-r--r--gdb/s390-tdep.c2
-rw-r--r--gdb/stabsread.c2
8 files changed, 21 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7d3bcfc..c658014 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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.
Rename `type` field to...
<m_type>: ... this. Change references throughout to use type or
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 52feff0..f44e4ee 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9605,7 +9605,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* 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)
{
@@ -14867,8 +14867,7 @@ create_one_variant_part (variant_part &result,
{
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 ();
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 58aae9f..a94fe8d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -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);
if (elt.field != NULL)
- return FIELD_TYPE (*elt.field);
+ return elt.field->type ();
else
return NULL;
}
@@ -4085,7 +4085,7 @@ check_types_equal (struct type *type1, struct type *type2,
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],
(FIELD_BITPOS (f[-1])
- + (TYPE_LENGTH (FIELD_TYPE (f[-1]))
+ + (TYPE_LENGTH (f[-1].type ())
* TARGET_CHAR_BIT)));
if (alignment)
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index af55875..d1132d3 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1610,7 +1610,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
(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)
@@ -1638,7 +1637,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#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))
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 8209d1b..8aa3e68 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -137,28 +137,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
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. */
@@ -1041,14 +1041,14 @@ build_std_type_info_type (struct gdbarch *arch)
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));
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index a6a6b77..a36f0ba 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1147,8 +1147,8 @@ gdbscm_field_type (SCM self)
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;
}
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index a7f71f8..0ee7a37 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1652,7 +1652,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size)
continue;
if (inner != NULL)
return type;
- inner = FIELD_TYPE (f);
+ inner = f.type ();
}
if (inner == NULL)
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 6d581ba..bb8ab83 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2917,7 +2917,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
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