From: Simon Marchi Date: Sun, 26 Sep 2021 20:34:28 +0000 (-0400) Subject: gdb: remove TYPE_FIELD_LOC_KIND X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ad53ea10c14445d6074814bbdfe46bd787038cb;p=binutils-gdb.git gdb: remove TYPE_FIELD_LOC_KIND Remove TYPE_FIELD_LOC_KIND, replace its uses with type::field + field::loc_kind. Change-Id: Ib124a26365df82ac1d23df7962d954192913bd90 --- diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index e07ee3ab696..29d1bab8114 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -1438,7 +1438,7 @@ static void gen_static_field (struct agent_expr *ax, struct axs_value *value, struct type *type, int fieldno) { - if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR) + if (type->field (fieldno).loc_kind () == FIELD_LOC_KIND_PHYSADDR) { ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); value->kind = axs_lvalue_memory; diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 8871de17f78..ef73aaabf0f 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -599,7 +599,7 @@ compile_cplus_convert_struct_or_union_members { CORE_ADDR physaddr; - switch (TYPE_FIELD_LOC_KIND (type, i)) + switch (type->field (i).loc_kind ()) { case FIELD_LOC_KIND_PHYSADDR: { @@ -939,7 +939,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type, gdb::unique_xmalloc_ptr fname = compile_cplus_instance::decl_name (type->field (i).name ()); - if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_ENUMVAL + if (type->field (i).loc_kind () != FIELD_LOC_KIND_ENUMVAL || fname == nullptr) continue; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 71efd1c616e..5e5c7ccfdb8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9065,7 +9065,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) name = tail; if (*name != '$' || index >= field_type->num_fields () - || (TYPE_FIELD_LOC_KIND (field_type, index) + || (field_type->field (index).loc_kind () != FIELD_LOC_KIND_BITPOS)) { complaint (_("Could not parse Rust enum encoding string \"%s\"" @@ -9197,7 +9197,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) std::unordered_map discriminant_map; for (int i = 0; i < enum_type->num_fields (); ++i) { - if (TYPE_FIELD_LOC_KIND (enum_type, i) == FIELD_LOC_KIND_ENUMVAL) + if (enum_type->field (i).loc_kind () == FIELD_LOC_KIND_ENUMVAL) { const char *name = rust_last_path_segment (enum_type->field (i).name ()); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8cfb9db280e..981b9b337c2 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2154,7 +2154,7 @@ is_dynamic_type_internal (struct type *type, int top_level) return 1; /* If the field is at a fixed offset, then it is not dynamic. */ - if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_DWARF_BLOCK) + if (type->field (i).loc_kind () != FIELD_LOC_KIND_DWARF_BLOCK) continue; /* Do not consider C++ virtual base types to be dynamic due to the field's offset being dynamic; these are @@ -2454,7 +2454,7 @@ compute_variant_fields_inner (struct type *type, { int idx = part.discriminant_index; - if (TYPE_FIELD_LOC_KIND (type, idx) != FIELD_LOC_KIND_BITPOS) + if (type->field (idx).loc_kind () != FIELD_LOC_KIND_BITPOS) error (_("Cannot determine struct field location" " (invalid location kind)")); @@ -2586,7 +2586,7 @@ resolve_dynamic_struct (struct type *type, if (field_is_static (&resolved_type->field (i))) continue; - if (TYPE_FIELD_LOC_KIND (resolved_type, i) == FIELD_LOC_KIND_DWARF_BLOCK) + if (resolved_type->field (i).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK) { struct dwarf2_property_baton baton; baton.property_type @@ -2610,7 +2610,7 @@ resolve_dynamic_struct (struct type *type, that verification indicates a bug in our code, the error is not severe enough to suggest to the user he stops his debugging session because of it. */ - if (TYPE_FIELD_LOC_KIND (resolved_type, i) != FIELD_LOC_KIND_BITPOS) + if (resolved_type->field (i).loc_kind () != FIELD_LOC_KIND_BITPOS) error (_("Cannot determine struct field location" " (invalid location kind)")); @@ -2625,7 +2625,7 @@ resolve_dynamic_struct (struct type *type, resolved_type->field (i).set_type (resolve_dynamic_type_internal (resolved_type->field (i).type (), &pinfo, 0)); - gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i) + gdb_assert (resolved_type->field (i).loc_kind () == FIELD_LOC_KIND_BITPOS); new_bit_length = TYPE_FIELD_BITPOS (resolved_type, i); @@ -5558,7 +5558,8 @@ copy_type_recursive (struct objfile *objfile, copied_types)); if (type->field (i).name ()) new_type->field (i).set_name (xstrdup (type->field (i).name ())); - switch (TYPE_FIELD_LOC_KIND (type, i)) + + switch (type->field (i).loc_kind ()) { case FIELD_LOC_KIND_BITPOS: new_type->field (i).set_loc_bitpos (TYPE_FIELD_BITPOS (type, i)); @@ -5581,7 +5582,7 @@ copy_type_recursive (struct objfile *objfile, default: internal_error (__FILE__, __LINE__, _("Unexpected type field location kind: %d"), - TYPE_FIELD_LOC_KIND (type, i)); + type->field (i).loc_kind ()); } } } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index e68aab5aefe..b9f96d94569 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2128,7 +2128,6 @@ 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_LOC_KIND(thistype, n) ((thistype)->field (n).loc_kind ()) #define TYPE_FIELD_BITPOS(thistype, n) ((thistype)->field (n).loc_bitpos ()) #define TYPE_FIELD_ENUMVAL(thistype, n) ((thistype)->field (n).loc_enumval ()) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((thistype)->field (n).loc_physname ()) diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 93113710137..773d3f8053c 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -464,7 +464,7 @@ gnuv3_baseclass_offset (struct type *type, int index, return TYPE_BASECLASS_BITPOS (type, index) / 8; /* If we have a DWARF expression for the offset, evaluate it. */ - if (TYPE_FIELD_LOC_KIND (type, index) == FIELD_LOC_KIND_DWARF_BLOCK) + if (type->field (index).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK) { struct dwarf2_property_baton baton; baton.property_type diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index f0f83579323..7980bec1c90 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -189,7 +189,7 @@ convert_field (struct type *type, int field) } else { - if (TYPE_FIELD_LOC_KIND (type, field) == FIELD_LOC_KIND_DWARF_BLOCK) + if (type->field (field).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK) arg = gdbpy_ref<>::new_reference (Py_None); else arg = gdb_py_object_from_longest (TYPE_FIELD_BITPOS (type, field)); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 4c2557f4dad..069aebf372a 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -2542,7 +2542,7 @@ riscv_struct_info::analyse_inner (struct type *type, int offset) for (i = 0; i < count; ++i) { - if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_BITPOS) + if (type->field (i).loc_kind () != FIELD_LOC_KIND_BITPOS) continue; struct type *field_type = type->field (i).type (); diff --git a/gdb/valops.c b/gdb/valops.c index 4847f937cd0..a80bdf08611 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3332,7 +3332,7 @@ enum_constant_from_type (struct type *type, const char *name) const char *fname = type->field (i).name (); int len; - if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_ENUMVAL + if (type->field (i).loc_kind () != FIELD_LOC_KIND_ENUMVAL || fname == NULL) continue; diff --git a/gdb/value.c b/gdb/value.c index a0ce3a796d0..b6672c77073 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2952,7 +2952,7 @@ value_static_field (struct type *type, int fieldno) { struct value *retval; - switch (TYPE_FIELD_LOC_KIND (type, fieldno)) + switch (type->field (fieldno).loc_kind ()) { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (type->field (fieldno).type (),