gdb: remove FIELD_TYPE macro
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:06 +0000 (15:26 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:06 +0000 (15:26 -0400)
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

gdb/ChangeLog
gdb/dwarf2/read.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/guile/scm-type.c
gdb/s390-tdep.c
gdb/stabsread.c

index 7d3bcfc4d22d47a5d3e19f9a39a6b0e6aa3404ba..c658014d0754f015f764800b68ba6a087c5ec2fe 100644 (file)
@@ -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>
 
        * gdbtypes.h (struct field) <type, set_type>: New methods.
index 52feff0b23d73c54626d046a593524fb919eaa27..f44e4eee84fe0cbb36bc7076ff56ff5faacc7285 100644 (file)
@@ -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 ();
index 58aae9f137b4e4cc5b3e13f9b85cd558df207141..a94fe8dd84a9c142ac610dc8b45770c274f77e7a 100644 (file)
@@ -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)
index af5587592a4525b57eb3c570e9415a90fa0ddb13..d1132d333280441e6ece2471ea25f205afbfda71 100644 (file)
@@ -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))
index 8209d1b653d599b9d32198ce9814a4f4051f0899..8aa3e68f123906c2c595fc34aab69cf41814d396 100644 (file)
@@ -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));
index a6a6b77f868ab0ddc29b2773cfa75db8356f53f2..a36f0ba71cf4d829de37be90a7a1e12d01784b36 100644 (file)
@@ -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;
 }
 
index a7f71f85b299abb4511771a823d5c793d665f681..0ee7a37256301ecf5b3a92da907984d82b00675f 100644 (file)
@@ -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)
index 6d581ba862d1eb31a578de7dc32eed27d217d329..bb8ab8300a9adfe9dff9ab1226f6a63269e0460c 100644 (file)
@@ -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
This page took 0.039994 seconds and 4 git commands to generate.