]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove TYPE_NFIELDS macro
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 22 May 2020 20:55:15 +0000 (16:55 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 22 May 2020 20:55:15 +0000 (16:55 -0400)
Remove `TYPE_NFIELDS`, changing all the call sites to use
`type::num_fields` directly.  This is quite a big diff, but this was
mostly done using sed and coccinelle.  A few call sites were done by
hand.

gdb/ChangeLog:

* gdbtypes.h (TYPE_NFIELDS): Remove.  Change all cal sites to use
type::num_fields instead.

Change-Id: Ib73be4c36f9e770e0f729bac3b5257d7cb2f9591

68 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-typeprint.c
gdb/ada-valprint.c
gdb/ada-varobj.c
gdb/amd64-tdep.c
gdb/arm-tdep.c
gdb/ax-gdb.c
gdb/buildsym.c
gdb/c-lang.c
gdb/c-typeprint.c
gdb/c-varobj.c
gdb/coffread.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-c-types.c
gdb/compile/compile-cplus-types.c
gdb/compile/compile-object-load.c
gdb/compile/compile-object-run.c
gdb/completer.c
gdb/cp-valprint.c
gdb/d-valprint.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/f-typeprint.c
gdb/f-valprint.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v2-abi.c
gdb/gnu-v3-abi.c
gdb/go-lang.c
gdb/guile/scm-type.c
gdb/i386-darwin-tdep.c
gdb/i386-tdep.c
gdb/i386-windows-tdep.c
gdb/ia64-tdep.c
gdb/infcall.c
gdb/iq2000-tdep.c
gdb/m2-typeprint.c
gdb/m2-valprint.c
gdb/m32c-tdep.c
gdb/m68k-tdep.c
gdb/mdebugread.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/nds32-tdep.c
gdb/or1k-tdep.c
gdb/p-lang.c
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/ppc-sysv-tdep.c
gdb/python/py-type.c
gdb/riscv-tdep.c
gdb/rust-exp.y
gdb/rust-lang.c
gdb/rx-tdep.c
gdb/s390-tdep.c
gdb/score-tdep.c
gdb/sh-tdep.c
gdb/sparc64-tdep.c
gdb/stabsread.c
gdb/symtab.c
gdb/tic6x-tdep.c
gdb/typeprint.c
gdb/v850-tdep.c
gdb/valops.c
gdb/valprint.c

index 9656bf907d908c214860a5f4c35f5afec57d61e7..44e7b1f9b50035e423f8c80ff77b6b049465aa4f 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-22  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (TYPE_NFIELDS): Remove.  Change all cal sites to use
+       type::num_fields instead.
+
 2020-05-22  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (struct type) <num_fields, set_num_fields>: New
index 37d75a81f08a4d80c0e93d46f71edcf9943e5036..2872d2d2bf7f23b36057229cf869bc600fe44c39 100644 (file)
@@ -1346,7 +1346,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
       {
        int count = 0;
 
-       for (int i = 0; i < TYPE_NFIELDS (type); i++)
+       for (int i = 0; i < type->num_fields (); i++)
          {
            /* Ignore any static fields.  */
            if (field_is_static (&TYPE_FIELD (type, i)))
@@ -1628,7 +1628,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
 
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
-      for (int i = 0; i < TYPE_NFIELDS (arg_type); i++)
+      for (int i = 0; i < arg_type->num_fields (); i++)
        {
          /* Don't include static fields.  */
          if (field_is_static (&TYPE_FIELD (arg_type, i)))
index 15b28ac807d855d71999521cf7065297463da829..2ae9830dbbb865e0cfa02dca3ccec7c3483219e4 100644 (file)
@@ -1394,7 +1394,7 @@ convert_char_literal (struct type *type, LONGEST val)
   else
     xsnprintf (name, sizeof (name), "QU%02x", (int) val);
   size_t len = strlen (name);
-  for (f = 0; f < TYPE_NFIELDS (type); f += 1)
+  for (f = 0; f < type->num_fields (); f += 1)
     {
       /* Check the suffix because an enum constant in a package will
         have a name like "pkg__QUxx".  This is safe enough because we
index a477f27797e24b03d1454a2e5363399225f8fc0e..a4804e62ef54acd4c7ecb17e1fe28ffe0dcb9545 100644 (file)
@@ -571,7 +571,7 @@ ada_get_field_index (const struct type *type, const char *field_name,
   int fieldno;
   struct type *struct_type = check_typedef ((struct type *) type);
 
-  for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type); fieldno++)
+  for (fieldno = 0; fieldno < struct_type->num_fields (); fieldno++)
     if (field_name_match (TYPE_FIELD_NAME (struct_type, fieldno), field_name))
       return fieldno;
 
@@ -755,7 +755,7 @@ ada_discrete_type_high_bound (struct type *type)
     case TYPE_CODE_RANGE:
       return TYPE_HIGH_BOUND (type);
     case TYPE_CODE_ENUM:
-      return TYPE_FIELD_ENUMVAL (type, TYPE_NFIELDS (type) - 1);
+      return TYPE_FIELD_ENUMVAL (type, type->num_fields () - 1);
     case TYPE_CODE_BOOL:
       return 1;
     case TYPE_CODE_CHAR:
@@ -1461,7 +1461,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
 
   if (index_desc_type == NULL)
     return;
-  gdb_assert (TYPE_NFIELDS (index_desc_type) > 0);
+  gdb_assert (index_desc_type->num_fields () > 0);
 
   /* Check if INDEX_DESC_TYPE follows the older encoding (it is sufficient
      to check one field only, no need to check them all).  If not, return
@@ -1476,7 +1476,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
     return;
 
   /* Fixup each field of INDEX_DESC_TYPE.  */
-  for (i = 0; i < TYPE_NFIELDS (index_desc_type); i++)
+  for (i = 0; i < index_desc_type->num_fields (); i++)
    {
      const char *name = TYPE_FIELD_NAME (index_desc_type, i);
      struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
@@ -1807,7 +1807,7 @@ desc_arity (struct type *type)
   type = desc_base_type (type);
 
   if (type != NULL)
-    return TYPE_NFIELDS (type) / 2;
+    return type->num_fields () / 2;
   return 0;
 }
 
@@ -3206,12 +3206,12 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
       || type->code () != TYPE_CODE_FUNC)
     return;
 
-  if (TYPE_NFIELDS (type) > 0)
+  if (type->num_fields () > 0)
     {
       int i;
 
       fprintf_filtered (stream, " (");
-      for (i = 0; i < TYPE_NFIELDS (type); ++i)
+      for (i = 0; i < type->num_fields (); ++i)
        {
          if (i > 0)
            fprintf_filtered (stream, "; ");
@@ -3897,7 +3897,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
   else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC)
     return 0;
 
-  if (TYPE_NFIELDS (func_type) != n_actuals)
+  if (func_type->num_fields () != n_actuals)
     return 0;
 
   for (i = 0; i < n_actuals; i += 1)
@@ -4958,7 +4958,7 @@ is_nondebugging_type (struct type *type)
 
    This function assumes that TYPE1 and TYPE2 are both TYPE_CODE_ENUM
    types and that their number of enumerals is identical (in other
-   words, TYPE_NFIELDS (type1) == TYPE_NFIELDS (type2)).  */
+   words, type1->num_fields () == type2->num_fields ()).  */
 
 static int
 ada_identical_enum_types_p (struct type *type1, struct type *type2)
@@ -4971,13 +4971,13 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
      underlying value and name.  */
 
   /* All enums in the type should have an identical underlying value.  */
-  for (i = 0; i < TYPE_NFIELDS (type1); i++)
+  for (i = 0; i < type1->num_fields (); i++)
     if (TYPE_FIELD_ENUMVAL (type1, i) != TYPE_FIELD_ENUMVAL (type2, i))
       return 0;
 
   /* All enumerals should also have the same name (modulo any numerical
      suffix).  */
-  for (i = 0; i < TYPE_NFIELDS (type1); i++)
+  for (i = 0; i < type1->num_fields (); i++)
     {
       const char *name_1 = TYPE_FIELD_NAME (type1, i);
       const char *name_2 = TYPE_FIELD_NAME (type2, i);
@@ -5040,8 +5040,8 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms)
 
   /* Quick check: They should all have the same number of enumerals.  */
   for (i = 1; i < syms.size (); i++)
-    if (TYPE_NFIELDS (SYMBOL_TYPE (syms[i].symbol))
-        != TYPE_NFIELDS (SYMBOL_TYPE (syms[0].symbol)))
+    if (SYMBOL_TYPE (syms[i].symbol)->num_fields ()
+        != SYMBOL_TYPE (syms[0].symbol)->num_fields ())
       return 0;
 
   /* All the sanity checks passed, so we might have a set of
@@ -6527,7 +6527,7 @@ ada_is_interface_tag (struct type *type)
 int
 ada_is_ignored_field (struct type *type, int field_num)
 {
-  if (field_num < 0 || field_num > TYPE_NFIELDS (type))
+  if (field_num < 0 || field_num > type->num_fields ())
     return 1;
 
   /* Check the name of that field.  */
@@ -6863,7 +6863,7 @@ ada_parent_type (struct type *type)
   if (type == NULL || type->code () != TYPE_CODE_STRUCT)
     return NULL;
 
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+  for (i = 0; i < type->num_fields (); i += 1)
     if (ada_is_parent_field (type, i))
       {
         struct type *parent_type = TYPE_FIELD_TYPE (type, i);
@@ -7226,7 +7226,7 @@ find_struct_field (const char *name, struct type *type, int offset,
   if (bit_size_p != NULL)
     *bit_size_p = 0;
 
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+  for (i = 0; i < type->num_fields (); i += 1)
     {
       int bit_pos = TYPE_FIELD_BITPOS (type, i);
       int fld_offset = offset + bit_pos / 8;
@@ -7278,7 +7278,7 @@ find_struct_field (const char *name, struct type *type, int offset,
           struct type *field_type
            = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
 
-          for (j = 0; j < TYPE_NFIELDS (field_type); j += 1)
+          for (j = 0; j < field_type->num_fields (); j += 1)
             {
               if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j),
                                      fld_offset
@@ -7338,7 +7338,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
   int parent_offset = -1;
 
   type = ada_check_typedef (type);
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+  for (i = 0; i < type->num_fields (); i += 1)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -7381,7 +7381,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
                                                                        i));
           int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
 
-          for (j = 0; j < TYPE_NFIELDS (field_type); j += 1)
+          for (j = 0; j < field_type->num_fields (); j += 1)
             {
               struct value *v = ada_search_struct_field /* Force line
                                                           break.  */
@@ -7439,7 +7439,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
   int i;
   type = ada_check_typedef (type);
 
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+  for (i = 0; i < type->num_fields (); i += 1)
     {
       if (TYPE_FIELD_NAME (type, i) == NULL)
         continue;
@@ -7532,7 +7532,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
 
   type = to_static_fixed_type (type);
 
-  for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+  for (i = 0; i < type->num_fields (); i += 1)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
       struct type *t;
@@ -7571,7 +7571,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
           struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
                                                                        i));
 
-          for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
+          for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
             {
              /* FIXME pnh 2008/01/26: We check for a field that is
                 NOT wrapped in a struct, since the compiler sometimes
@@ -7655,7 +7655,7 @@ ada_which_variant_applies (struct type *var_type, struct value *outer)
   discrim_val = value_as_long (discrim);
 
   others_clause = -1;
-  for (i = 0; i < TYPE_NFIELDS (var_type); i += 1)
+  for (i = 0; i < var_type->num_fields (); i += 1)
     {
       if (ada_is_others_clause (var_type, i))
         others_clause = i;
@@ -8005,7 +8005,7 @@ variant_field_index (struct type *type)
   if (type == NULL || type->code () != TYPE_CODE_STRUCT)
     return -1;
 
-  for (f = 0; f < TYPE_NFIELDS (type); f += 1)
+  for (f = 0; f < type->num_fields (); f += 1)
     {
       if (ada_is_variant_part (type, f))
         return f;
@@ -8064,11 +8064,11 @@ ada_template_to_fixed_record_type_1 (struct type *type,
      to be processed: unless keep_dynamic_fields, this includes only
      fields whose position and length are static will be processed.  */
   if (keep_dynamic_fields)
-    nfields = TYPE_NFIELDS (type);
+    nfields = type->num_fields ();
   else
     {
       nfields = 0;
-      while (nfields < TYPE_NFIELDS (type)
+      while (nfields < type->num_fields ()
              && !ada_is_variant_part (type, nfields)
              && !is_dynamic_field (type, nfields))
         nfields++;
@@ -8243,7 +8243,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
          cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
       if (branch_type == NULL)
         {
-          for (f = variant_field + 1; f < TYPE_NFIELDS (rtype); f += 1)
+          for (f = variant_field + 1; f < rtype->num_fields (); f += 1)
             TYPE_FIELDS (rtype)[f - 1] = TYPE_FIELDS (rtype)[f];
          rtype->set_num_fields (rtype->num_fields () - 1);
         }
@@ -8325,7 +8325,7 @@ template_to_static_fixed_type (struct type *type0)
 
   /* Don't clone TYPE0 until we are sure we are going to need a copy.  */
   type = type0;
-  nfields = TYPE_NFIELDS (type0);
+  nfields = type0->num_fields ();
 
   /* Whether or not we cloned TYPE0, cache the result so that we don't do
      recompute all over next time.  */
@@ -8384,7 +8384,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
   struct value *dval;
   struct type *rtype;
   struct type *branch_type;
-  int nfields = TYPE_NFIELDS (type);
+  int nfields = type->num_fields ();
   int variant_field = variant_field_index (type);
 
   if (variant_field == -1)
@@ -8590,7 +8590,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
   struct type *this_layer = check_typedef (array_type);
   int i;
 
-  for (i = 0; i < TYPE_NFIELDS (desc_type); i++)
+  for (i = 0; i < desc_type->num_fields (); i++)
     {
       if (!ada_is_redundant_range_encoding (TYPE_INDEX_TYPE (this_layer),
                                            TYPE_FIELD_TYPE (desc_type, i)))
@@ -8694,7 +8694,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
       struct type *elt_type0;
 
       elt_type0 = type0;
-      for (i = TYPE_NFIELDS (index_type_desc); i > 0; i -= 1)
+      for (i = index_type_desc->num_fields (); i > 0; i -= 1)
         elt_type0 = TYPE_TARGET_TYPE (elt_type0);
 
       /* NOTE: result---the fixed version of elt_type0---should never
@@ -8712,7 +8712,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
         ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
 
       elt_type0 = type0;
-      for (i = TYPE_NFIELDS (index_type_desc) - 1; i >= 0; i -= 1)
+      for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
         {
           struct type *range_type =
             to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, i), dval);
@@ -9148,7 +9148,7 @@ value_val_atr (struct type *type, struct value *arg)
     {
       long pos = value_as_long (arg);
 
-      if (pos < 0 || pos >= TYPE_NFIELDS (type))
+      if (pos < 0 || pos >= type->num_fields ())
         error (_("argument to 'VAL out of range"));
       return value_from_longest (type, TYPE_FIELD_ENUMVAL (type, pos));
     }
@@ -9229,7 +9229,7 @@ ada_is_aligner_type (struct type *type)
     return 0;
 
   return (type->code () == TYPE_CODE_STRUCT
-          && TYPE_NFIELDS (type) == 1
+          && type->num_fields () == 1
           && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
 }
 
@@ -9263,7 +9263,7 @@ ada_get_base_type (struct type *raw_type)
   real_type_namer = ada_find_parallel_type (raw_type, "___XVS");
   if (real_type_namer == NULL
       || real_type_namer->code () != TYPE_CODE_STRUCT
-      || TYPE_NFIELDS (real_type_namer) != 1)
+      || real_type_namer->num_fields () != 1)
     return raw_type;
 
   if (TYPE_FIELD_TYPE (real_type_namer, 0)->code () != TYPE_CODE_REF)
index 076c0a63bfa15f14302288fa6a490b1032039a1a..2021edf011182e2b587126ac305105d81d66ed86 100644 (file)
@@ -312,7 +312,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
 static void
 print_enum_type (struct type *type, struct ui_file *stream)
 {
-  int len = TYPE_NFIELDS (type);
+  int len = type->num_fields ();
   int i;
   LONGEST lastval;
 
@@ -417,7 +417,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
        {
          int k;
 
-         n_indices = TYPE_NFIELDS (range_desc_type);
+         n_indices = range_desc_type->num_fields ();
          for (k = 0, arr_type = type;
               k < n_indices;
               k += 1, arr_type = TYPE_TARGET_TYPE (arr_type))
@@ -563,7 +563,7 @@ print_variant_clauses (struct type *type, int field_num,
   if (par_type != NULL)
     var_type = par_type;
 
-  for (i = 0; i < TYPE_NFIELDS (var_type); i += 1)
+  for (i = 0; i < var_type->num_fields (); i += 1)
     {
       fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
       if (print_choices (var_type, i, stream, discr_type))
@@ -786,13 +786,13 @@ print_record_field_types (struct type *type, struct type *outer_type,
        }
       gdb_assert (prop->kind == PROP_VARIANT_PARTS);
       print_record_field_types_dynamic (*prop->data.variant_parts,
-                                       0, TYPE_NFIELDS (type),
+                                       0, type->num_fields (),
                                        type, stream, show, level, flags);
-      return TYPE_NFIELDS (type);
+      return type->num_fields ();
     }
 
   return print_selected_record_field_types (type, outer_type,
-                                           0, TYPE_NFIELDS (type) - 1,
+                                           0, type->num_fields () - 1,
                                            stream, show, level, flags);
 }
    
@@ -863,7 +863,7 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
 {
   if (show < 0)
     fprintf_filtered (stream, "record (?) is ... end record");
-  else if (TYPE_NFIELDS (type) == 0)
+  else if (type->num_fields () == 0)
     fprintf_filtered (stream, "record (?) is null; end record");
   else
     {
@@ -871,7 +871,7 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
 
       fprintf_filtered (stream, "record (?) is\n%*scase ? is", level + 4, "");
 
-      for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+      for (i = 0; i < type->num_fields (); i += 1)
        {
          fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "",
                            level + 12, "");
@@ -895,7 +895,7 @@ static void
 print_func_type (struct type *type, struct ui_file *stream, const char *name,
                 const struct type_print_options *flags)
 {
-  int i, len = TYPE_NFIELDS (type);
+  int i, len = type->num_fields ();
 
   if (TYPE_TARGET_TYPE (type) != NULL
       && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)
index e11e47ee59eae35626d4fa8a99a1139bbbce2d3d..f0e7bfc296bdbeec19303b77c0a7d5618e465ff8 100644 (file)
@@ -400,7 +400,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
     {
 
     case TYPE_CODE_ENUM:
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       for (i = 0; i < len; i++)
        {
          if (TYPE_FIELD_ENUMVAL (type, i) == val)
@@ -600,7 +600,7 @@ print_field_values (struct value *value, struct value *outer_value,
   int i, len;
 
   struct type *type = value_type (value);
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
 
   for (i = 0; i < len; i += 1)
     {
@@ -886,7 +886,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
   const gdb_byte *valaddr = value_contents_for_printing (value);
   int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
 
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
   val = unpack_long (type, valaddr + offset_aligned);
   for (i = 0; i < len; i++)
     {
index 98dc9d199008b39235f16d7314cde2982b3c825a..485eae29b92573ce0d6bfc5adcf58be6bb793b76 100644 (file)
@@ -273,7 +273,7 @@ ada_varobj_get_struct_number_of_children (struct value *parent_value,
   gdb_assert (parent_type->code () == TYPE_CODE_STRUCT
              || parent_type->code () == TYPE_CODE_UNION);
 
-  for (i = 0; i < TYPE_NFIELDS (parent_type); i++)
+  for (i = 0; i < parent_type->num_fields (); i++)
     {
       if (ada_is_ignored_field (parent_type, i))
        continue;
@@ -421,7 +421,7 @@ ada_varobj_describe_struct_child (struct value *parent_value,
   gdb_assert (parent_type->code () == TYPE_CODE_STRUCT
              || parent_type->code () == TYPE_CODE_UNION);
 
-  for (fieldno = 0; fieldno < TYPE_NFIELDS (parent_type); fieldno++)
+  for (fieldno = 0; fieldno < parent_type->num_fields (); fieldno++)
     {
       if (ada_is_ignored_field (parent_type, fieldno))
        continue;
index 9fa5d2b83df829e502832d518575fad7e36fda69..24f0614b235b55110d1616179d22f0779cb877e4 100644 (file)
@@ -549,7 +549,7 @@ amd64_has_unaligned_fields (struct type *type)
   if (type->code () == TYPE_CODE_STRUCT
       || type->code () == TYPE_CODE_UNION)
     {
-      for (int i = 0; i < TYPE_NFIELDS (type); i++)
+      for (int i = 0; i < type->num_fields (); i++)
        {
          struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
          int bitpos = TYPE_FIELD_BITPOS (type, i);
@@ -608,7 +608,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
     {
       /* Each field of an object is classified recursively.  */
       int j;
-      for (j = 0; j < TYPE_NFIELDS (subtype); j++)
+      for (j = 0; j < subtype->num_fields (); j++)
        amd64_classify_aggregate_field (subtype, j, theclass, bitpos);
       return;
     }
@@ -684,7 +684,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
       gdb_assert (type->code () == TYPE_CODE_STRUCT
                  || type->code () == TYPE_CODE_UNION);
 
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        amd64_classify_aggregate_field (type, i, theclass, 0);
     }
 
index 45df1bd39dea5828c7015a8df23f29b4eeaa1832..e96819252118ea6288ace37a2dd25223ec82a952 100644 (file)
@@ -3497,7 +3497,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
        int count = 0;
        unsigned unitlen;
        int i;
-       for (i = 0; i < TYPE_NFIELDS (t); i++)
+       for (i = 0; i < t->num_fields (); i++)
          {
            int sub_count = 0;
 
@@ -3526,7 +3526,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
        int count = 0;
        unsigned unitlen;
        int i;
-       for (i = 0; i < TYPE_NFIELDS (t); i++)
+       for (i = 0; i < t->num_fields (); i++)
          {
            int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
                                                        base_type);
@@ -7970,7 +7970,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
             --> yes, nRc = 1
          */
 
-         for (i = 0; i < TYPE_NFIELDS (type); i++)
+         for (i = 0; i < type->num_fields (); i++)
            {
              enum type_code field_type_code;
 
index 0f389e49cb7e50275de46f7797b79b502985827a..4dcdc3b411f1470ff0d5772f6a8abf9fd9896a5b 100644 (file)
@@ -316,7 +316,7 @@ gen_trace_static_fields (struct agent_expr *ax,
 
   type = check_typedef (type);
 
-  for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
+  for (i = type->num_fields () - 1; i >= nbases; i--)
     {
       if (field_is_static (&TYPE_FIELD (type, i)))
        {
@@ -1444,7 +1444,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
 
   type = check_typedef (type);
 
-  for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
+  for (i = type->num_fields () - 1; i >= nbases; i--)
     {
       const char *this_name = TYPE_FIELD_NAME (type, i);
 
@@ -1588,7 +1588,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
     internal_error (__FILE__, __LINE__,
                    _("non-aggregate type to gen_struct_elt_for_reference"));
 
-  for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
+  for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
     {
       const char *t_field_name = TYPE_FIELD_NAME (t, i);
 
index f66607cd736575377bfb24a7554b0961d266b02b..b25d09b5c0c91ca5c53fc526ec452f5105a0b21f 100644 (file)
@@ -254,7 +254,7 @@ buildsym_compunit::finish_block_internal
       SYMBOL_BLOCK_VALUE (symbol) = block;
       BLOCK_FUNCTION (block) = symbol;
 
-      if (TYPE_NFIELDS (ftype) <= 0)
+      if (ftype->num_fields () <= 0)
        {
          /* No parameter type information is recorded with the
             function's type.  Set that from the type of the
index 557482f2be446dba0ff24b338d382835fb4a7eaa..e549c5cb6571737af424f19a20077d2eb3a95a1b 100644 (file)
@@ -254,7 +254,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
     {
       /* If we know the size of the array, we can use it as a limit on
         the number of characters to be fetched.  */
-      if (TYPE_NFIELDS (type) == 1
+      if (type->num_fields () == 1
          && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE)
        {
          LONGEST low_bound, high_bound;
index bbe12ccfe871ff27fe8e639a099befff9af99a99..955cfd6045124bccb703ddbfe936f2b9e4a97646 100644 (file)
@@ -278,7 +278,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
                           const struct type_print_options *flags)
 {
   struct field *args = TYPE_FIELDS (mtype);
-  int nargs = TYPE_NFIELDS (mtype);
+  int nargs = mtype->num_fields ();
   int varargs = TYPE_VARARGS (mtype);
   int i;
 
@@ -560,7 +560,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
 
   fprintf_filtered (stream, "(");
 
-  for (i = 0; i < TYPE_NFIELDS (type); i++)
+  for (i = 0; i < type->num_fields (); i++)
     {
       struct type *param_type;
 
@@ -965,7 +965,7 @@ need_access_label_p (struct type *type)
   if (TYPE_DECLARED_CLASS (type))
     {
       QUIT;
-      for (int i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); i++)
+      for (int i = TYPE_N_BASECLASSES (type); i < type->num_fields (); i++)
        if (!TYPE_FIELD_PRIVATE (type, i))
          return true;
       QUIT;
@@ -982,7 +982,7 @@ need_access_label_p (struct type *type)
   else
     {
       QUIT;
-      for (int i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); i++)
+      for (int i = TYPE_N_BASECLASSES (type); i < type->num_fields (); i++)
        if (TYPE_FIELD_PRIVATE (type, i) || TYPE_FIELD_PROTECTED (type, i))
          return true;
       QUIT;
@@ -1115,7 +1115,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
 
       fprintf_filtered (stream, "{\n");
 
-      if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0
+      if (type->num_fields () == 0 && TYPE_NFN_FIELDS (type) == 0
          && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
        {
          if (TYPE_STUB (type))
@@ -1143,7 +1143,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
       /* If there is a base class for this type,
         do not print the field that it occupies.  */
 
-      int len = TYPE_NFIELDS (type);
+      int len = type->num_fields ();
       vptr_fieldno = get_vptr_fieldno (type, &basetype);
 
       struct print_offset_data local_podata;
@@ -1374,7 +1374,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
          if (semi_local_flags.print_nested_type_limit > 0)
            --semi_local_flags.print_nested_type_limit;
 
-         if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0)
+         if (type->num_fields () != 0 || TYPE_NFN_FIELDS (type) != 0)
            fprintf_filtered (stream, "\n");
 
          for (int i = 0; i < TYPE_NESTED_TYPES_COUNT (type); ++i)
@@ -1392,7 +1392,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
 
       if (TYPE_TYPEDEF_FIELD_COUNT (type) != 0 && flags->print_typedefs)
        {
-         if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0
+         if (type->num_fields () != 0 || TYPE_NFN_FIELDS (type) != 0
              || TYPE_NESTED_TYPES_COUNT (type) != 0)
            fprintf_filtered (stream, "\n");
 
@@ -1593,7 +1593,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
            }
 
          fprintf_filtered (stream, "{");
-         len = TYPE_NFIELDS (type);
+         len = type->num_fields ();
          for (i = 0; i < len; i++)
            {
              QUIT;
@@ -1627,7 +1627,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
          {
            fputs_filtered (" ", stream);
            fprintf_filtered (stream, "{\n");
-           if (TYPE_NFIELDS (type) == 0)
+           if (type->num_fields () == 0)
              {
                if (TYPE_STUB (type))
                  fprintfi_filtered (level + 4, stream,
@@ -1638,7 +1638,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
                                     _("%p[<no data fields>%p]\n"),
                                     metadata_style.style ().ptr (), nullptr);
              }
-           len = TYPE_NFIELDS (type);
+           len = type->num_fields ();
            for (i = 0; i < len; i++)
              {
                QUIT;
index 51940b9dd667c3cf65e3984b46abef72745f753a..6cb260ddc91a86388569645899d5edffc7e8c548 100644 (file)
@@ -164,7 +164,7 @@ c_is_path_expr_parent (const struct varobj *var)
            {
              const char *field_name;
 
-             gdb_assert (var->index < TYPE_NFIELDS (parent_type));
+             gdb_assert (var->index < parent_type->num_fields ());
              field_name = TYPE_FIELD_NAME (parent_type, var->index);
              return !(field_name == NULL || *field_name == '\0');
            }
@@ -202,7 +202,7 @@ c_number_of_children (const struct varobj *var)
 
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
-      children = TYPE_NFIELDS (type);
+      children = type->num_fields ();
       break;
 
     case TYPE_CODE_PTR:
@@ -649,7 +649,7 @@ cplus_class_num_children (struct type *type, int children[3])
   children[v_protected] = 0;
 
   vptr_fieldno = get_vptr_fieldno (type, &basetype);
-  for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); i++)
+  for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); i++)
     {
       /* If we have a virtual table pointer, omit it.  Even if virtual
         table pointers are not specifically marked in the debug info,
index 2732421a35cd5d2ccb59e2c7ff18b98c85198750..6bf3abd646f5c3b5621a6533fc553b529a5ae0ff 100644 (file)
@@ -1452,10 +1452,10 @@ patch_type (struct type *type, struct type *real_type)
 {
   struct type *target = TYPE_TARGET_TYPE (type);
   struct type *real_target = TYPE_TARGET_TYPE (real_type);
-  int field_size = TYPE_NFIELDS (real_target) * sizeof (struct field);
+  int field_size = real_target->num_fields () * sizeof (struct field);
 
   TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
-  target->set_num_fields (TYPE_NFIELDS (real_target));
+  target->set_num_fields (real_target->num_fields ());
   TYPE_FIELDS (target) = (struct field *) TYPE_ALLOC (target,
                                                      field_size);
 
index ab9f4425b7c7badd4330adb5026ddc2c9802c5d1..8b3cd370aa49ba286d1dbe13efa70a23c3f9cad7 100644 (file)
@@ -526,7 +526,7 @@ generate_vla_size (compile_instance *compiler,
       {
        int i;
 
-       for (i = 0; i < TYPE_NFIELDS (type); ++i)
+       for (i = 0; i < type->num_fields (); ++i)
          if (!field_is_static (&TYPE_FIELD (type, i)))
            generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
                               TYPE_FIELD_TYPE (type, i), sym);
index 8f6ed0571ca9cd1b7671ac135cffca81815d2ed3..c4f5811678eb5dddf0b4b49a6907cf05d830f976 100644 (file)
@@ -103,7 +103,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
     }
   context->insert_type (type, result);
 
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (i = 0; i < type->num_fields (); ++i)
     {
       gcc_type field_type;
       unsigned long bitsize = TYPE_FIELD_BITSIZE (type, i);
@@ -134,7 +134,7 @@ convert_enum (compile_c_instance *context, struct type *type)
                                             TYPE_LENGTH (type));
 
   result = context->plugin ().build_enum_type (int_type);
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (i = 0; i < type->num_fields (); ++i)
     {
       context->plugin ().build_add_enum_constant
        (result, TYPE_FIELD_NAME (type, i), TYPE_FIELD_ENUMVAL (type, i));
@@ -175,9 +175,9 @@ convert_func (compile_c_instance *context, struct type *type)
      types.  Those are impossible in C, though.  */
   return_type = context->convert_type (target_type);
 
-  array.n_elements = TYPE_NFIELDS (type);
-  array.elements = XNEWVEC (gcc_type, TYPE_NFIELDS (type));
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  array.n_elements = type->num_fields ();
+  array.elements = XNEWVEC (gcc_type, type->num_fields ());
+  for (i = 0; i < type->num_fields (); ++i)
     array.elements[i] = context->convert_type (TYPE_FIELD_TYPE (type, i));
 
   result = context->plugin ().build_function_type (return_type,
index 523ab34b403e70923ceda8464039077b9a94ae3c..b2a4544c041e4c848acc5a7a843138963b3fce72 100644 (file)
@@ -580,7 +580,7 @@ static void
 compile_cplus_convert_struct_or_union_members
   (compile_cplus_instance *instance, struct type *type, gcc_type comp_type)
 {
-  for (int i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); ++i)
+  for (int i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
     {
       const char *field_name = TYPE_FIELD_NAME (type, i);
 
@@ -938,7 +938,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
                                              ? GCC_CP_FLAG_ENUM_SCOPED
                                              : GCC_CP_FLAG_ENUM_NOFLAG),
                                           nullptr, 0);
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     {
       gdb::unique_xmalloc_ptr<char> fname
        = compile_cplus_instance::decl_name (TYPE_FIELD_NAME (type, i));
@@ -986,9 +986,9 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
   gcc_type return_type = instance->convert_type (target_type);
 
   struct gcc_type_array array =
-    { TYPE_NFIELDS (type), XNEWVEC (gcc_type, TYPE_NFIELDS (type)) };
+    { type->num_fields (), XNEWVEC (gcc_type, type->num_fields ()) };
   int artificials = 0;
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     {
       if (strip_artificial && TYPE_FIELD_ARTIFICIAL (type, i))
        {
index 76a9418dac0e6b5c99e69383105770f6a0025488..7f5f5931f210381c26cbcf9860789d90736689c5 100644 (file)
@@ -505,7 +505,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
   struct type *regsp_type, *regs_type;
 
   /* No register parameter present.  */
-  if (TYPE_NFIELDS (func_type) == 0)
+  if (func_type->num_fields () == 0)
     return NULL;
 
   regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0));
@@ -534,7 +534,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
   struct gdbarch *gdbarch = target_gdbarch ();
   int fieldno;
 
-  for (fieldno = 0; fieldno < TYPE_NFIELDS (regs_type); fieldno++)
+  for (fieldno = 0; fieldno < regs_type->num_fields (); fieldno++)
     {
       const char *reg_name = TYPE_FIELD_NAME (regs_type, fieldno);
       ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
@@ -670,10 +670,10 @@ compile_object_load (const compile_file_names &file_names,
     default:
       internal_error (__FILE__, __LINE__, _("invalid scope %d"), scope);
     }
-  if (TYPE_NFIELDS (func_type) != expect_parameters)
+  if (func_type->num_fields () != expect_parameters)
     error (_("Invalid %d parameters of function \"%s\" in compiled "
             "module \"%s\"."),
-          TYPE_NFIELDS (func_type), GCC_FE_WRAPPER_FUNCTION,
+          func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION,
           objfile_name (objfile));
   if (!types_deeply_equal (expect_return_type, TYPE_TARGET_TYPE (func_type)))
     error (_("Invalid return type of function \"%s\" in compiled "
index cef1d06adf70ed2029432e64acdf4895f90857b0..d8e285325663767576ab737739380fff44a33d46 100644 (file)
@@ -153,23 +153,23 @@ compile_object_run (struct compile_module *module)
       func_val = value_from_pointer (lookup_pointer_type (func_type),
                                   BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym)));
 
-      vargs = XALLOCAVEC (struct value *, TYPE_NFIELDS (func_type));
-      if (TYPE_NFIELDS (func_type) >= 1)
+      vargs = XALLOCAVEC (struct value *, func_type->num_fields ());
+      if (func_type->num_fields () >= 1)
        {
          gdb_assert (regs_addr != 0);
          vargs[current_arg] = value_from_pointer
                          (TYPE_FIELD_TYPE (func_type, current_arg), regs_addr);
          ++current_arg;
        }
-      if (TYPE_NFIELDS (func_type) >= 2)
+      if (func_type->num_fields () >= 2)
        {
          gdb_assert (data->out_value_addr != 0);
          vargs[current_arg] = value_from_pointer
               (TYPE_FIELD_TYPE (func_type, current_arg), data->out_value_addr);
          ++current_arg;
        }
-      gdb_assert (current_arg == TYPE_NFIELDS (func_type));
-      auto args = gdb::make_array_view (vargs, TYPE_NFIELDS (func_type));
+      gdb_assert (current_arg == func_type->num_fields ());
+      auto args = gdb::make_array_view (vargs, func_type->num_fields ());
       call_function_by_hand_dummy (func_val, NULL, args,
                                   do_module_cleanup, data);
     }
index d03dc77c65dafc682b7d1aa5c764a3c9d1156217..ad33b98c696812ca553053006603e601bf5d977b 100644 (file)
@@ -1090,7 +1090,7 @@ add_struct_fields (struct type *type, completion_list &output,
   const char *type_name = NULL;
 
   type = check_typedef (type);
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (i = 0; i < type->num_fields (); ++i)
     {
       if (i < TYPE_N_BASECLASSES (type))
        add_struct_fields (TYPE_BASECLASS (type, i),
index 1fb7edd5b0531fc8ac4404318c267c04568bdc81..a59afec4958d5fc113906c0b16e644d25c421763 100644 (file)
@@ -149,7 +149,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
     }
 
   fprintf_filtered (stream, "{");
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
   n_baseclasses = TYPE_N_BASECLASSES (type);
 
   /* First, print out baseclasses such that we don't print
@@ -638,7 +638,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
 
   *self_p = check_typedef (*self_p);
   self = *self_p;
-  len = TYPE_NFIELDS (self);
+  len = self->num_fields ();
 
   for (i = TYPE_N_BASECLASSES (self); i < len; i++)
     {
index cb0f5095dfc02dfbc056587439bc66eba53fa55d..34f8b05a62b438d108b4f3b8d8b35d1fe3cd6d84 100644 (file)
@@ -34,7 +34,7 @@ dynamic_array_type (struct type *type,
                    struct value *val,
                    const struct value_print_options *options)
 {
-  if (TYPE_NFIELDS (type) == 2
+  if (type->num_fields () == 2
       && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_INT
       && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
       && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0
index 975227ea7a271d076175798604d617ddc37d5894..0581b8e20855fad7103ddfd0637f085896eca819 100644 (file)
@@ -9249,17 +9249,17 @@ alloc_rust_variant (struct obstack *obstack, struct type *type,
   /* When DISCRIMINANT_INDEX == -1, we have a univariant enum.  Those
      must be handled by the caller.  */
   gdb_assert (discriminant_index >= 0
-             && discriminant_index < TYPE_NFIELDS (type));
+             && discriminant_index < type->num_fields ());
   gdb_assert (default_index == -1
-             || (default_index >= 0 && default_index < TYPE_NFIELDS (type)));
+             || (default_index >= 0 && default_index < type->num_fields ()));
 
   /* We have one variant for each non-discriminant field.  */
-  int n_variants = TYPE_NFIELDS (type) - 1;
+  int n_variants = type->num_fields () - 1;
 
   variant *variants = new (obstack) variant[n_variants];
   int var_idx = 0;
   int range_idx = 0;
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     {
       if (i == discriminant_index)
        continue;
@@ -9324,11 +9324,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
   gdb_assert (type->code () == TYPE_CODE_UNION);
 
   /* We don't need to deal with empty enums.  */
-  if (TYPE_NFIELDS (type) == 0)
+  if (type->num_fields () == 0)
     return;
 
 #define RUST_ENUM_PREFIX "RUST$ENCODED$ENUM$"
-  if (TYPE_NFIELDS (type) == 1
+  if (type->num_fields () == 1
       && startswith (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX))
     {
       const char *name = TYPE_FIELD_NAME (type, 0) + strlen (RUST_ENUM_PREFIX);
@@ -9343,7 +9343,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
          unsigned long index = strtoul (name, &tail, 10);
          name = tail;
          if (*name != '$'
-             || index >= TYPE_NFIELDS (field_type)
+             || index >= field_type->num_fields ()
              || (TYPE_FIELD_LOC_KIND (field_type, index)
                  != FIELD_LOC_KIND_BITPOS))
            {
@@ -9400,7 +9400,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
     }
   /* A union with a single anonymous field is probably an old-style
      univariant enum.  */
-  else if (TYPE_NFIELDS (type) == 1 && streq (TYPE_FIELD_NAME (type, 0), ""))
+  else if (type->num_fields () == 1 && streq (TYPE_FIELD_NAME (type, 0), ""))
     {
       /* Smash this type to be a structure type.  We have to do this
         because the type has already been recorded.  */
@@ -9417,7 +9417,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
   else
     {
       struct type *disr_type = nullptr;
-      for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+      for (int i = 0; i < type->num_fields (); ++i)
        {
          disr_type = TYPE_FIELD_TYPE (type, i);
 
@@ -9426,7 +9426,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
              /* All fields of a true enum will be structs.  */
              return;
            }
-         else if (TYPE_NFIELDS (disr_type) == 0)
+         else if (disr_type->num_fields () == 0)
            {
              /* Could be data-less variant, so keep going.  */
              disr_type = nullptr;
@@ -9456,12 +9456,12 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       /* Make space for the discriminant field.  */
       struct field *disr_field = &TYPE_FIELD (disr_type, 0);
       field *new_fields
-       = (struct field *) TYPE_ZALLOC (type, ((TYPE_NFIELDS (type) + 1)
+       = (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1)
                                               * sizeof (struct field)));
       memcpy (new_fields + 1, TYPE_FIELDS (type),
-             TYPE_NFIELDS (type) * sizeof (struct field));
+             type->num_fields () * sizeof (struct field));
       TYPE_FIELDS (type) = new_fields;
-      type->set_num_fields (TYPE_NFIELDS (type) + 1);
+      type->set_num_fields (type->num_fields () + 1);
 
       /* Install the discriminant at index 0 in the union.  */
       TYPE_FIELD (type, 0) = *disr_field;
@@ -9472,7 +9472,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
         variant name.  For convenience we build a map here.  */
       struct type *enum_type = FIELD_TYPE (*disr_field);
       std::unordered_map<std::string, ULONGEST> discriminant_map;
-      for (int i = 0; i < TYPE_NFIELDS (enum_type); ++i)
+      for (int i = 0; i < enum_type->num_fields (); ++i)
        {
          if (TYPE_FIELD_LOC_KIND (enum_type, i) == FIELD_LOC_KIND_ENUMVAL)
            {
@@ -9482,7 +9482,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
            }
        }
 
-      int n_fields = TYPE_NFIELDS (type);
+      int n_fields = type->num_fields ();
       /* We don't need a range entry for the discriminant, but we do
         need one for every other field, as there is no default
         variant.  */
@@ -9507,7 +9507,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
 
          /* Remove the discriminant field, if it exists.  */
          struct type *sub_type = TYPE_FIELD_TYPE (type, i);
-         if (TYPE_NFIELDS (sub_type) > 0)
+         if (sub_type->num_fields () > 0)
            {
              sub_type->set_num_fields (sub_type->num_fields () - 1);
              ++TYPE_FIELDS (sub_type);
@@ -10333,7 +10333,7 @@ dwarf2_compute_name (const char *name,
                     marks unnamed (and thus unused) parameters as
                     artificial; there is no way to differentiate
                     the two cases.  */
-                 if (TYPE_NFIELDS (type) > 0
+                 if (type->num_fields () > 0
                      && TYPE_FIELD_ARTIFICIAL (type, 0)
                      && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR
                      && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type,
@@ -14996,14 +14996,14 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
   this_type = read_type_die (die, cu);
   if (this_type && this_type->code () == TYPE_CODE_FUNC)
     {
-      int nparams = TYPE_NFIELDS (this_type);
+      int nparams = this_type->num_fields ();
 
       /* TYPE is the domain of this method, and THIS_TYPE is the type
           of the method itself (TYPE_CODE_METHOD).  */
       smash_to_method_type (fnp->type, type,
                            TYPE_TARGET_TYPE (this_type),
                            TYPE_FIELDS (this_type),
-                           TYPE_NFIELDS (this_type),
+                           this_type->num_fields (),
                            TYPE_VARARGS (this_type));
 
       /* Handle static member functions.
@@ -15095,7 +15095,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
              /* If there is no `this' field and no DW_AT_containing_type,
                 we cannot actually find a base class context for the
                 vtable!  */
-             if (TYPE_NFIELDS (this_type) == 0
+             if (this_type->num_fields () == 0
                  || !TYPE_FIELD_ARTIFICIAL (this_type, 0))
                {
                  complaint (_("cannot determine context for virtual member "
@@ -15192,7 +15192,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
   struct type *pfn_type, *self_type, *new_type;
 
   /* Check for a structure with no name and two children.  */
-  if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
+  if (type->code () != TYPE_CODE_STRUCT || type->num_fields () != 2)
     return;
 
   /* Check for __pfn and __delta members.  */
@@ -15211,7 +15211,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
 
   /* Look for the "this" argument.  */
   pfn_type = TYPE_TARGET_TYPE (pfn_type);
-  if (TYPE_NFIELDS (pfn_type) == 0
+  if (pfn_type->num_fields () == 0
       /* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */
       || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR)
     return;
@@ -15219,7 +15219,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
   self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
   new_type = alloc_type (objfile);
   smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
-                       TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
+                       TYPE_FIELDS (pfn_type), pfn_type->num_fields (),
                        TYPE_VARARGS (pfn_type));
   smash_to_methodptr_type (type, new_type);
 }
@@ -15722,7 +15722,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
                  int i;
 
                  /* Our own class provides vtbl ptr.  */
-                 for (i = TYPE_NFIELDS (t) - 1;
+                 for (i = t->num_fields () - 1;
                       i >= TYPE_N_BASECLASSES (t);
                       --i)
                    {
@@ -15755,7 +15755,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
 
              int i;
 
-             for (i = TYPE_NFIELDS (type) - 1;
+             for (i = type->num_fields () - 1;
                   i >= TYPE_N_BASECLASSES (type);
                   --i)
                {
@@ -16722,7 +16722,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
        = alloc_type (cu->per_cu->dwarf2_per_objfile->objfile);
 
       smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
-                           TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type),
+                           TYPE_FIELDS (to_type), to_type->num_fields (),
                            TYPE_VARARGS (to_type));
       type = lookup_methodptr_type (new_type);
     }
index 023b629c1aa7bb363e78b5e1d3d33326fa005cf8..8104c956b4234fca33d2fb3a5f5b4812db79215d 100644 (file)
@@ -295,11 +295,11 @@ evaluate_struct_tuple (struct value *struct_val,
 
       fieldno++;
       /* Skip static fields.  */
-      while (fieldno < TYPE_NFIELDS (struct_type)
+      while (fieldno < struct_type->num_fields ()
             && field_is_static (&TYPE_FIELD (struct_type,
                                              fieldno)))
        fieldno++;
-      if (fieldno >= TYPE_NFIELDS (struct_type))
+      if (fieldno >= struct_type->num_fields ())
        error (_("too many initializers"));
       field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
       if (field_type->code () == TYPE_CODE_UNION
@@ -1058,7 +1058,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
            type = TYPE_TARGET_TYPE (type);
          if (type && type->code () == TYPE_CODE_FUNC)
            {
-             for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
+             for (; tem <= nargs && tem <= type->num_fields (); tem++)
                {
                  argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type,
                                                                  tem - 1),
index 820ba5ff0efea78c7140c0a31d397538dae7922f..7057a06ef40417fbe5db940855c1f14f09e36e30 100644 (file)
@@ -254,7 +254,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
 
     case TYPE_CODE_FUNC:
       {
-       int i, nfields = TYPE_NFIELDS (type);
+       int i, nfields = type->num_fields ();
 
        f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
                                     passed_a_ptr, 0,
@@ -430,7 +430,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
       if (show > 0)
        {
          fputs_filtered ("\n", stream);
-         for (index = 0; index < TYPE_NFIELDS (type); index++)
+         for (index = 0; index < type->num_fields (); index++)
            {
              f_type_print_base (TYPE_FIELD_TYPE (type, index), stream,
                                 show - 1, level + 4);
index 76981fa4117163f3d3cfd2cdf970f49db0d1cb9c..bd16a4348d34269819f8d7f3bcf1afcdfda322e0 100644 (file)
@@ -313,7 +313,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse,
       /* Starting from the Fortran 90 standard, Fortran supports derived
          types.  */
       fprintf_filtered (stream, "( ");
-      for (index = 0; index < TYPE_NFIELDS (type); index++)
+      for (index = 0; index < type->num_fields (); index++)
         {
          struct value *field = value_field (val, index);
 
index f42657ab8f9208cedde979b4a8c59c1426c6f52d..01d8530d0f5c5d15ff395cf0eef7e76e2a7f8dc4 100644 (file)
@@ -1040,14 +1040,14 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
       *highp = TYPE_HIGH_BOUND (type);
       return 1;
     case TYPE_CODE_ENUM:
-      if (TYPE_NFIELDS (type) > 0)
+      if (type->num_fields () > 0)
        {
          /* The enums may not be sorted by value, so search all
             entries.  */
          int i;
 
          *lowp = *highp = TYPE_FIELD_ENUMVAL (type, 0);
-         for (i = 0; i < TYPE_NFIELDS (type); i++)
+         for (i = 0; i < type->num_fields (); i++)
            {
              if (TYPE_FIELD_ENUMVAL (type, i) < *lowp)
                *lowp = TYPE_FIELD_ENUMVAL (type, i);
@@ -1159,7 +1159,7 @@ discrete_position (struct type *type, LONGEST val, LONGEST *pos)
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+      for (i = 0; i < type->num_fields (); i += 1)
         {
           if (val == TYPE_FIELD_ENUMVAL (type, i))
            {
@@ -1751,7 +1751,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
             type_name.c_str ());
     }
 
-  for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
+  for (i = type->num_fields () - 1; i >= TYPE_N_BASECLASSES (type); i--)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -2015,7 +2015,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
         treated as one here.  */
     case TYPE_CODE_ARRAY:
       {
-       gdb_assert (TYPE_NFIELDS (type) == 1);
+       gdb_assert (type->num_fields () == 1);
 
        /* The array is dynamic if either the bounds are dynamic...  */
        if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0))
@@ -2036,7 +2036,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
 
        bool is_cplus = HAVE_CPLUS_STRUCT (type);
 
-       for (i = 0; i < TYPE_NFIELDS (type); ++i)
+       for (i = 0; i < type->num_fields (); ++i)
          {
            /* Static fields can be ignored here.  */
            if (field_is_static (&TYPE_FIELD (type, i)))
@@ -2240,12 +2240,12 @@ resolve_dynamic_union (struct type *type,
   resolved_type = copy_type (type);
   TYPE_FIELDS (resolved_type)
     = (struct field *) TYPE_ALLOC (resolved_type,
-                                  TYPE_NFIELDS (resolved_type)
+                                  resolved_type->num_fields ()
                                   * sizeof (struct field));
   memcpy (TYPE_FIELDS (resolved_type),
          TYPE_FIELDS (type),
-         TYPE_NFIELDS (resolved_type) * sizeof (struct field));
-  for (i = 0; i < TYPE_NFIELDS (resolved_type); ++i)
+         resolved_type->num_fields () * sizeof (struct field));
+  for (i = 0; i < resolved_type->num_fields (); ++i)
     {
       struct type *t;
 
@@ -2396,7 +2396,7 @@ compute_variant_fields (struct type *type,
                        const gdb::array_view<variant_part> &parts)
 {
   /* Assume all fields are included by default.  */
-  std::vector<bool> flags (TYPE_NFIELDS (resolved_type), true);
+  std::vector<bool> flags (resolved_type->num_fields (), true);
 
   /* Now disable fields based on the variants that control them.  */
   for (const auto &part : parts)
@@ -2406,10 +2406,10 @@ compute_variant_fields (struct type *type,
     (std::count (flags.begin (), flags.end (), true));
   TYPE_FIELDS (resolved_type)
     = (struct field *) TYPE_ALLOC (resolved_type,
-                                  TYPE_NFIELDS (resolved_type)
+                                  resolved_type->num_fields ()
                                   * sizeof (struct field));
   int out = 0;
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     {
       if (!flags[i])
        continue;
@@ -2432,7 +2432,7 @@ resolve_dynamic_struct (struct type *type,
   unsigned resolved_type_bit_length = 0;
 
   gdb_assert (type->code () == TYPE_CODE_STRUCT);
-  gdb_assert (TYPE_NFIELDS (type) > 0);
+  gdb_assert (type->num_fields () > 0);
 
   resolved_type = copy_type (type);
 
@@ -2450,14 +2450,14 @@ resolve_dynamic_struct (struct type *type,
     {
       TYPE_FIELDS (resolved_type)
        = (struct field *) TYPE_ALLOC (resolved_type,
-                                      TYPE_NFIELDS (resolved_type)
+                                      resolved_type->num_fields ()
                                       * sizeof (struct field));
       memcpy (TYPE_FIELDS (resolved_type),
              TYPE_FIELDS (type),
-             TYPE_NFIELDS (resolved_type) * sizeof (struct field));
+             resolved_type->num_fields () * sizeof (struct field));
     }
 
-  for (i = 0; i < TYPE_NFIELDS (resolved_type); ++i)
+  for (i = 0; i < resolved_type->num_fields (); ++i)
     {
       unsigned new_bit_length;
       struct property_addr_info pinfo;
@@ -3388,7 +3388,7 @@ type_align (struct type *type)
     case TYPE_CODE_UNION:
       {
        int number_of_non_static_fields = 0;
-       for (unsigned i = 0; i < TYPE_NFIELDS (type); ++i)
+       for (unsigned i = 0; i < type->num_fields (); ++i)
          {
            if (!field_is_static (&TYPE_FIELD (type, i)))
              {
@@ -3530,7 +3530,7 @@ is_scalar_type_recursive (struct type *t)
     return 1;
   /* Are we dealing with an array or string of known dimensions?  */
   else if ((t->code () == TYPE_CODE_ARRAY
-           || t->code () == TYPE_CODE_STRING) && TYPE_NFIELDS (t) == 1
+           || t->code () == TYPE_CODE_STRING) && t->num_fields () == 1
           && TYPE_INDEX_TYPE(t)->code () == TYPE_CODE_RANGE)
     {
       LONGEST low_bound, high_bound;
@@ -3541,11 +3541,11 @@ is_scalar_type_recursive (struct type *t)
       return high_bound == low_bound && is_scalar_type_recursive (elt_type);
     }
   /* Are we dealing with a struct with one element?  */
-  else if (t->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (t) == 1)
+  else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1)
     return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0));
   else if (t->code () == TYPE_CODE_UNION)
     {
-      int i, n = TYPE_NFIELDS (t);
+      int i, n = t->num_fields ();
 
       /* If all elements of the union are scalar, then the union is scalar.  */
       for (i = 0; i < n; i++)
@@ -3943,13 +3943,13 @@ types_equal (struct type *a, struct type *b)
     {
       int i;
 
-      if (TYPE_NFIELDS (a) != TYPE_NFIELDS (b))
+      if (a->num_fields () != b->num_fields ())
        return false;
       
       if (!types_equal (TYPE_TARGET_TYPE (a), TYPE_TARGET_TYPE (b)))
        return false;
 
-      for (i = 0; i < TYPE_NFIELDS (a); ++i)
+      for (i = 0; i < a->num_fields (); ++i)
        if (!types_equal (TYPE_FIELD_TYPE (a, i), TYPE_FIELD_TYPE (b, i)))
          return false;
 
@@ -4008,7 +4008,7 @@ check_types_equal (struct type *type1, struct type *type2,
       || TYPE_VECTOR (type1) != TYPE_VECTOR (type2)
       || TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
       || TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2)
-      || TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2))
+      || type1->num_fields () != type2->num_fields ())
     return false;
 
   if (!compare_maybe_null_strings (type1->name (), type2->name ()))
@@ -4025,7 +4025,7 @@ check_types_equal (struct type *type1, struct type *type2,
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type1); ++i)
+      for (i = 0; i < type1->num_fields (); ++i)
        {
          const struct field *field1 = &TYPE_FIELD (type1, i);
          const struct field *field2 = &TYPE_FIELD (type2, i);
@@ -4762,7 +4762,7 @@ dump_fn_fieldlists (struct type *type, int spaces)
                                  gdb_stdout);
          printf_filtered ("\n");
          print_args (TYPE_FN_FIELD_ARGS (f, overload_idx),
-                     TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, overload_idx)),
+                     TYPE_FN_FIELD_TYPE (f, overload_idx)->num_fields (),
                      spaces + 8 + 2);
          printfi_filtered (spaces + 8, "fcontext ");
          gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
@@ -4815,30 +4815,30 @@ print_cplus_stuff (struct type *type, int spaces)
                        TYPE_N_BASECLASSES (type));
       puts_filtered ("\n");
     }
-  if (TYPE_NFIELDS (type) > 0)
+  if (type->num_fields () > 0)
     {
       if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
        {
          printfi_filtered (spaces, 
                            "private_field_bits (%d bits at *",
-                           TYPE_NFIELDS (type));
+                           type->num_fields ());
          gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type), 
                                  gdb_stdout);
          printf_filtered (")");
          print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
-                           TYPE_NFIELDS (type));
+                           type->num_fields ());
          puts_filtered ("\n");
        }
       if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
        {
          printfi_filtered (spaces, 
                            "protected_field_bits (%d bits at *",
-                           TYPE_NFIELDS (type));
+                           type->num_fields ());
          gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type), 
                                  gdb_stdout);
          printf_filtered (")");
          print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
-                           TYPE_NFIELDS (type));
+                           type->num_fields ());
          puts_filtered ("\n");
        }
     }
@@ -4878,7 +4878,7 @@ recursive_dump_type (struct type *type, int spaces)
   if (spaces == 0)
     obstack_begin (&dont_print_type_obstack, 0);
 
-  if (TYPE_NFIELDS (type) > 0
+  if (type->num_fields () > 0
       || (HAVE_CPLUS_STRUCT (type) && TYPE_NFN_FIELDS (type) > 0))
     {
       struct type **first_dont_print
@@ -5101,10 +5101,10 @@ recursive_dump_type (struct type *type, int spaces)
       puts_filtered (" TYPE_NOTTEXT");
     }
   puts_filtered ("\n");
-  printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
+  printfi_filtered (spaces, "nfields %d ", type->num_fields ());
   gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout);
   puts_filtered ("\n");
-  for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
+  for (idx = 0; idx < type->num_fields (); idx++)
     {
       if (type->code () == TYPE_CODE_ENUM)
        printfi_filtered (spaces + 2,
@@ -5296,11 +5296,11 @@ copy_type_recursive (struct objfile *objfile,
   TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
 
   /* Copy the fields.  */
-  if (TYPE_NFIELDS (type))
+  if (type->num_fields ())
     {
       int i, nfields;
 
-      nfields = TYPE_NFIELDS (type);
+      nfields = type->num_fields ();
       TYPE_FIELDS (new_type) = (struct field *)
         TYPE_ZALLOC (new_type, nfields * sizeof (struct field));
       for (i = 0; i < nfields; i++)
@@ -5575,10 +5575,10 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
                         struct type *field_type, const char *name)
 {
   int type_bitsize = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
-  int field_nr = TYPE_NFIELDS (type);
+  int field_nr = type->num_fields ();
 
   gdb_assert (type->code () == TYPE_CODE_FLAGS);
-  gdb_assert (TYPE_NFIELDS (type) + 1 <= type_bitsize);
+  gdb_assert (type->num_fields () + 1 <= type_bitsize);
   gdb_assert (start_bitpos >= 0 && start_bitpos < type_bitsize);
   gdb_assert (nr_bits >= 1 && nr_bits <= type_bitsize);
   gdb_assert (name != NULL);
@@ -5630,10 +5630,10 @@ append_composite_type_field_raw (struct type *t, const char *name,
 {
   struct field *f;
 
-  t->set_num_fields (TYPE_NFIELDS (t) + 1);
+  t->set_num_fields (t->num_fields () + 1);
   TYPE_FIELDS (t) = XRESIZEVEC (struct field, TYPE_FIELDS (t),
-                               TYPE_NFIELDS (t));
-  f = &(TYPE_FIELDS (t)[TYPE_NFIELDS (t) - 1]);
+                               t->num_fields ());
+  f = &(TYPE_FIELDS (t)[t->num_fields () - 1]);
   memset (f, 0, sizeof f[0]);
   FIELD_TYPE (f[0]) = field;
   FIELD_NAME (f[0]) = name;
@@ -5657,7 +5657,7 @@ append_composite_type_field_aligned (struct type *t, const char *name,
   else if (t->code () == TYPE_CODE_STRUCT)
     {
       TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
-      if (TYPE_NFIELDS (t) > 1)
+      if (t->num_fields () > 1)
        {
          SET_FIELD_BITPOS (f[0],
                            (FIELD_BITPOS (f[-1])
index da8d5e2a1199b457af540e4d066a2620230dc40f..e5f46dca0d296fac2f6df5b2dc01f3ff3b2d73c1 100644 (file)
@@ -1458,7 +1458,6 @@ extern unsigned type_align (struct type *);
    space in struct type.  */
 extern bool set_type_align (struct type *, ULONGEST);
 
-#define TYPE_NFIELDS(thistype) ((thistype)->num_fields ())
 #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
 
 #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
@@ -1705,7 +1704,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
 #define TYPE_IS_OPAQUE(thistype) \
   ((((thistype)->code () == TYPE_CODE_STRUCT) \
     || ((thistype)->code () == TYPE_CODE_UNION)) \
-   && (TYPE_NFIELDS (thistype) == 0) \
+   && ((thistype)->num_fields () == 0) \
    && (!HAVE_CPLUS_STRUCT (thistype) \
        || TYPE_NFN_FIELDS (thistype) == 0) \
    && (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype)))
index d4cf6b95629c8152d376432a99ee3e5c85c335f6..9238f10986d9eb9f69a86bdc99250a60a60ece5f 100644 (file)
@@ -348,7 +348,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
   if (BASETYPE_VIA_VIRTUAL (type, index))
     {
       /* Must hunt for the pointer to this virtual baseclass.  */
-      int i, len = TYPE_NFIELDS (type);
+      int i, len = type->num_fields ();
       int n_baseclasses = TYPE_N_BASECLASSES (type);
 
       /* First look for the virtual baseclass pointer
index b05443193832313f06f385ef5b9fb5f7ce0cb43b..c1967e62bb793b28b120496c5ca131677d2d8b20 100644 (file)
@@ -1326,7 +1326,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
                                  type_code expected)
 {
   /* The method should take at least two arguments...  */
-  if (TYPE_NFIELDS (method_type) < 2)
+  if (method_type->num_fields () < 2)
     return false;
 
   /* ...and the second argument should be the same as the class
@@ -1343,7 +1343,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
   /* ...and if any of the remaining arguments don't have a default value
      then this is not a copy or move constructor, but just a
      constructor.  */
-  for (int i = 2; i < TYPE_NFIELDS (method_type); i++)
+  for (int i = 2; i < method_type->num_fields (); i++)
     {
       arg_type = TYPE_FIELD_TYPE (method_type, i);
       /* FIXME aktemur/2019-10-31: As of this date, neither
@@ -1527,7 +1527,7 @@ gnuv3_pass_by_reference (struct type *type)
      are constructed whenever this class is.  We do not need to worry
      about recursive loops here, since we are only looking at members
      of complete class type.  Also ignore any static members.  */
-  for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++)
+  for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++)
     if (!field_is_static (&TYPE_FIELD (type, fieldnum)))
       {
        struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);
index 366ac368333a56c0aaaffdd560b7c7ab721d3441..c97db1b9db7fcb565e97bcb67825f5c218314820 100644 (file)
@@ -73,7 +73,7 @@ gccgo_string_p (struct type *type)
 {
   /* gccgo strings don't necessarily have a name we can use.  */
 
-  if (TYPE_NFIELDS (type) == 2)
+  if (type->num_fields () == 2)
     {
       struct type *type0 = TYPE_FIELD_TYPE (type, 0);
       struct type *type1 = TYPE_FIELD_TYPE (type, 1);
@@ -106,7 +106,7 @@ gccgo_string_p (struct type *type)
 static int
 sixg_string_p (struct type *type)
 {
-  if (TYPE_NFIELDS (type) == 2
+  if (type->num_fields () == 2
       && type->name () != NULL
       && strcmp (type->name (), "string") == 0)
     return 1;
index 6ea6a3140cf0e74b99ef67d06206aea484eb1265..b216087e7789b2d0c4778e08c096fdf0bfebb85e 100644 (file)
@@ -560,7 +560,7 @@ gdbscm_type_fields (SCM self)
     containing_type_scm = tyscm_scm_from_type (containing_type);
 
   result = SCM_EOL;
-  for (i = 0; i < TYPE_NFIELDS (containing_type); ++i)
+  for (i = 0; i < containing_type->num_fields (); ++i)
     result = scm_cons (tyscm_make_field_smob (containing_type_scm, i), result);
 
   return scm_reverse_x (result, SCM_EOL);
@@ -969,7 +969,7 @@ gdbscm_type_num_fields (SCM self)
     gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
                               _(not_composite_error));
 
-  return scm_from_long (TYPE_NFIELDS (type));
+  return scm_from_long (type->num_fields ());
 }
 
 /* (type-field <gdb:type> string) -> <gdb:field>
@@ -997,7 +997,7 @@ gdbscm_type_field (SCM self, SCM field_scm)
   {
     gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm);
 
-    for (int i = 0; i < TYPE_NFIELDS (type); i++)
+    for (int i = 0; i < type->num_fields (); i++)
       {
        const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -1039,7 +1039,7 @@ gdbscm_type_has_field_p (SCM self, SCM field_scm)
     gdb::unique_xmalloc_ptr<char> field
       = gdbscm_scm_to_c_string (field_scm);
 
-    for (int i = 0; i < TYPE_NFIELDS (type); i++)
+    for (int i = 0; i < type->num_fields (); i++)
       {
        const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -1105,11 +1105,11 @@ gdbscm_type_next_field_x (SCM self)
   type = t_smob->type;
 
   SCM_ASSERT_TYPE (scm_is_signed_integer (progress,
-                                         0, TYPE_NFIELDS (type)),
+                                         0, type->num_fields ()),
                   progress, SCM_ARG1, FUNC_NAME, _("integer"));
   field = scm_to_int (progress);
 
-  if (field < TYPE_NFIELDS (type))
+  if (field < type->num_fields ())
     {
       result = tyscm_make_field_smob (object, field);
       itscm_set_iterator_smob_progress_x (i_smob, scm_from_int (field + 1));
index 39081481790d1121b665d764ca7b14e0edd45ece..8f9fc2dcb2e718fb10fccc280ebefafc2145c8bb 100644 (file)
@@ -136,7 +136,7 @@ i386_darwin_arg_type_alignment (struct type *type)
     {
       int i;
       int res = 4;
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          int align
            = i386_darwin_arg_type_alignment (TYPE_FIELD_TYPE (type, i));
index f4fe3a20c708d39a04ae05f437e15b4fd7f2a680..e87d7f363564a42466a6cb747b70b50e9e52d6c3 100644 (file)
@@ -2643,7 +2643,7 @@ i386_16_byte_align_p (struct type *type)
       || type->code () == TYPE_CODE_UNION)
     {
       int i;
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          if (i386_16_byte_align_p (TYPE_FIELD_TYPE (type, i)))
            return 1;
@@ -2952,7 +2952,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
 
   /* Structures consisting of a single `float', `double' or 'long
      double' member are returned in %st(0).  */
-  if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
+  if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
       type = check_typedef (TYPE_FIELD_TYPE (type, 0));
       if (type->code () == TYPE_CODE_FLT)
@@ -3020,7 +3020,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
      the structure.  Since that should work for all structures that
      have only one member, we don't bother to check the member's type
      here.  */
-  if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
+  if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
       type = check_typedef (TYPE_FIELD_TYPE (type, 0));
       return i386_return_value (gdbarch, function, type, regcache,
index f5965399abceaae271bb5010cfcfa109321c69d6..b2db9bc8310822322e00a8fe02e173beaf4dec54 100644 (file)
@@ -219,7 +219,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* read_subroutine_type sets for non-static member functions the
      artificial flag of the first parameter ('this' pointer).  */
   if (type->code () == TYPE_CODE_METHOD
-      && TYPE_NFIELDS (type) > 0
+      && type->num_fields () > 0
       && TYPE_FIELD_ARTIFICIAL (type, 0)
       && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR)
     thiscall = 1;
index de6273c8cc7626d3463e1e486ce78a7df416e148..1d1fd2e5f0ee479edfccd2da05442e06d43a03a5 100644 (file)
@@ -3340,7 +3340,7 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
       {
        int i;
 
-       for (i = 0; i < TYPE_NFIELDS (t); i++)
+       for (i = 0; i < t->num_fields (); i++)
          if (!is_float_or_hfa_type_recurse
              (check_typedef (TYPE_FIELD_TYPE (t, i)), etp))
            return 0;
@@ -3389,7 +3389,7 @@ slot_alignment_is_next_even (struct type *t)
       {
        int i;
 
-       for (i = 0; i < TYPE_NFIELDS (t); i++)
+       for (i = 0; i < t->num_fields (); i++)
          if (slot_alignment_is_next_even
              (check_typedef (TYPE_FIELD_TYPE (t, i))))
            return 1;
index 8da843a01901107476fb7ef451b6daf0214aa0b3..d211ad88df81ad9e6cd4d3eb4596e84bc8f62a45 100644 (file)
@@ -827,7 +827,7 @@ call_function_by_hand_dummy (struct value *function,
 
   values_type = check_typedef (values_type);
 
-  if (args.size () < TYPE_NFIELDS (ftype))
+  if (args.size () < ftype->num_fields ())
     error (_("Too few arguments in function call."));
 
   /* A holder for the inferior status.
@@ -1027,7 +1027,7 @@ call_function_by_hand_dummy (struct value *function,
         prototyped.  Can we respect TYPE_VARARGS?  Probably not.  */
       if (ftype->code () == TYPE_CODE_METHOD)
        prototyped = 1;
-      if (TYPE_TARGET_TYPE (ftype) == NULL && TYPE_NFIELDS (ftype) == 0
+      if (TYPE_TARGET_TYPE (ftype) == NULL && ftype->num_fields () == 0
          && default_return_type != NULL)
        {
          /* Calling a no-debug function with the return type
@@ -1042,12 +1042,12 @@ call_function_by_hand_dummy (struct value *function,
          */
          prototyped = 1;
        }
-      else if (i < TYPE_NFIELDS (ftype))
+      else if (i < ftype->num_fields ())
        prototyped = TYPE_PROTOTYPED (ftype);
       else
        prototyped = 0;
 
-      if (i < TYPE_NFIELDS (ftype))
+      if (i < ftype->num_fields ())
        param_type = TYPE_FIELD_TYPE (ftype, i);
       else
        param_type = NULL;
index 1767a457ca7ed2b3bfc83016988c99b3da2be308..18d207535b41387a59521c23c77950c6e5b08c7b 100644 (file)
@@ -604,7 +604,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
       && type->code () != TYPE_CODE_UNION)
     return 0;
   /* Structs with more than 1 field are always passed by address.  */
-  if (TYPE_NFIELDS (type) != 1)
+  if (type->num_fields () != 1)
     return 1;
   /* Get field type.  */
   ftype = (TYPE_FIELDS (type))[0].type;
index 99222993f4a6d468093c32df43e2ec119ec63cba..d2596b256d239390d14c1b9c3de50eede1b93a60 100644 (file)
@@ -284,7 +284,7 @@ m2_procedure (struct type *type, struct ui_file *stream,
   if (TYPE_TARGET_TYPE (type) == NULL
       || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
     {
-      int i, len = TYPE_NFIELDS (type);
+      int i, len = type->num_fields ();
 
       fprintf_filtered (stream, " (");
       for (i = 0; i < len; i++)
@@ -311,7 +311,7 @@ m2_print_bounds (struct type *type,
 {
   struct type *target = TYPE_TARGET_TYPE (type);
 
-  if (TYPE_NFIELDS(type) == 0)
+  if (type->num_fields () == 0)
     return;
 
   if (print_high)
@@ -346,7 +346,7 @@ m2_is_long_set (struct type *type)
 
       /* check if all fields of the RECORD are consecutive sets.  */
 
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       for (i = TYPE_N_BASECLASSES (type); i < len; i++)
        {
          if (TYPE_FIELD_TYPE (type, i) == NULL)
@@ -409,7 +409,7 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
 
   if (type->code () == TYPE_CODE_STRUCT)
     {
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       i = TYPE_N_BASECLASSES (type);
       if (len == 0)
        return 0;
@@ -434,7 +434,7 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
 {
   struct type *of_type;
   int i;
-  int len = TYPE_NFIELDS (type);
+  int len = type->num_fields ();
   LONGEST low;
   LONGEST high;
 
@@ -490,7 +490,7 @@ m2_is_unbounded_array (struct type *type)
        *  type of _m2_contents is a pointer.  The TYPE_TARGET_TYPE
        *  of the pointer determines the unbounded ARRAY OF type.
        */
-      if (TYPE_NFIELDS (type) != 2)
+      if (type->num_fields () != 2)
        return 0;
       if (strcmp (TYPE_FIELD_NAME (type, 0), "_m2_contents") != 0)
        return 0;
@@ -550,7 +550,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
   else if (show > 0)
     {
       int i;
-      int len = TYPE_NFIELDS (type);
+      int len = type->num_fields ();
 
       if (type->code () == TYPE_CODE_STRUCT)
        fprintf_filtered (stream, "RECORD\n");
@@ -601,7 +601,7 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
   else if (show > 0 || type->name () == NULL)
     {
       fprintf_filtered (stream, "(");
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       lastval = 0;
       for (i = 0; i < len; i++)
        {
index f0166118634ce1212a90b3c87eef8a3161328fde..f9cb626fd6872ba348d77344e51dabb8f3b72fd3 100644 (file)
@@ -51,7 +51,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
 
   if (type->code () == TYPE_CODE_STRUCT)
     {
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       i = TYPE_N_BASECLASSES (type);
       if (len == 0)
        return 0;
@@ -83,7 +83,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
   type = check_typedef (type);
 
   fprintf_filtered (stream, "{");
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
   if (get_long_set_bounds (type, &low_bound, &high_bound))
     {
       field = TYPE_N_BASECLASSES (type);
index a49937a7bd25115d90b432ab9b30eb919999f2f0..d579616b06aa4a14b99362e78e50aa962fa09167 100644 (file)
@@ -2033,7 +2033,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        separately, but the code in GCC doesn't actually do so.  */
     if (TYPE_PROTOTYPED (func_type))
 #endif
-      num_prototyped_args = TYPE_NFIELDS (func_type);
+      num_prototyped_args = func_type->num_fields ();
   }
 
   /* First, if the function returns an aggregate by value, push a
index 46a0f093201c2b923330a95fd23f13629a9cbe77..578cfdbf19ac3ff131803f12c49d74f23ce9701b 100644 (file)
@@ -463,7 +463,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
      changing TYPE into the type of the first member of the structure.
      Since that should work for all structures that have only one
      member, we don't bother to check the member's type here.  */
-  if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
+  if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
     {
       type = check_typedef (TYPE_FIELD_TYPE (type, 0));
       return m68k_svr4_return_value (gdbarch, function, type, regcache,
index 1b499ccad34c47e66c7a28070f4d945aa0a92401..f634dbb08f18060ab4d55072b6e1012a79f71f3d 100644 (file)
@@ -1036,7 +1036,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
               are hopefully rare enough.
               Alpha cc -migrate has a sh.value field of zero, we adjust
               that too.  */
-           if (TYPE_LENGTH (t) == TYPE_NFIELDS (t)
+           if (TYPE_LENGTH (t) == t->num_fields ()
                || TYPE_LENGTH (t) == 0)
              TYPE_LENGTH (t) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
            for (ext_tsym = ext_sh + external_sym_size;
@@ -1085,7 +1085,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
        /* gcc puts out an empty struct for an opaque struct definitions,
           do not create a symbol for it either.  */
-       if (TYPE_NFIELDS (t) == 0)
+       if (t->num_fields () == 0)
          {
            TYPE_STUB (t) = 1;
            break;
@@ -1174,7 +1174,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                }
            }
 
-         if (TYPE_NFIELDS (ftype) <= 0)
+         if (ftype->num_fields () <= 0)
            {
              /* No parameter type information is recorded with the function's
                 type.  Set that from the type of the parameter symbols.  */
@@ -1297,7 +1297,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
       /* Incomplete definitions of structs should not get a name.  */
       if (SYMBOL_TYPE (s)->name () == NULL
-         && (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0
+         && (SYMBOL_TYPE (s)->num_fields () != 0
              || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
                  && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
        {
index df59f416b8e142d12b29c38c2dd6ebe550f59685..a3ab8c80e37589ca1e19e603d3da2ba5ba7dca1a 100644 (file)
@@ -4407,7 +4407,7 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
           || (MIPS_EABI (gdbarch)
               && (typecode == TYPE_CODE_STRUCT
                   || typecode == TYPE_CODE_UNION)
-              && TYPE_NFIELDS (arg_type) == 1
+              && arg_type->num_fields () == 1
               && check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code ()
               == TYPE_CODE_FLT))
          && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
@@ -4425,7 +4425,7 @@ mips_type_needs_double_align (struct type *type)
     return 1;
   else if (typecode == TYPE_CODE_STRUCT)
     {
-      if (TYPE_NFIELDS (type) < 1)
+      if (type->num_fields () < 1)
        return 0;
       return mips_type_needs_double_align (TYPE_FIELD_TYPE (type, 0));
     }
@@ -4433,7 +4433,7 @@ mips_type_needs_double_align (struct type *type)
     {
       int i, n;
 
-      n = TYPE_NFIELDS (type);
+      n = type->num_fields ();
       for (i = 0; i < n; i++)
        if (mips_type_needs_double_align (TYPE_FIELD_TYPE (type, i)))
          return 1;
@@ -4788,7 +4788,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
         are returned in a floating point register.  */
       if ((type->code () == TYPE_CODE_STRUCT
           || type->code () == TYPE_CODE_UNION)
-         && TYPE_NFIELDS (type) == 1)
+         && type->num_fields () == 1)
        {
          struct type *fieldtype = TYPE_FIELD_TYPE (type, 0);
 
@@ -4850,7 +4850,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
   if (TYPE_LENGTH (arg_type) < offset + MIPS64_REGSIZE)
     return 0;
 
-  for (i = 0; i < TYPE_NFIELDS (arg_type); i++)
+  for (i = 0; i < arg_type->num_fields (); i++)
     {
       int pos;
       struct type *field_type;
@@ -5226,12 +5226,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
   else if (type->code () == TYPE_CODE_STRUCT
-          && TYPE_NFIELDS (type) <= 2
-          && TYPE_NFIELDS (type) >= 1
-          && ((TYPE_NFIELDS (type) == 1
+          && type->num_fields () <= 2
+          && type->num_fields () >= 1
+          && ((type->num_fields () == 1
                && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
                    == TYPE_CODE_FLT))
-              || (TYPE_NFIELDS (type) == 2
+              || (type->num_fields () == 2
                   && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
                       == TYPE_CODE_FLT)
                   && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code ()
@@ -5245,7 +5245,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
       for (field = 0, regnum = (tdep->mips_fpu_type != MIPS_FPU_NONE
                                ? mips_regnum (gdbarch)->fp0
                                : MIPS_V0_REGNUM);
-          field < TYPE_NFIELDS (type); field++, regnum += 2)
+          field < type->num_fields (); field++, regnum += 2)
        {
          int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
                        / TARGET_CHAR_BIT);
@@ -5779,12 +5779,12 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 #if 0
   else if (type->code () == TYPE_CODE_STRUCT
-          && TYPE_NFIELDS (type) <= 2
-          && TYPE_NFIELDS (type) >= 1
-          && ((TYPE_NFIELDS (type) == 1
+          && type->num_fields () <= 2
+          && type->num_fields () >= 1
+          && ((type->num_fields () == 1
                && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
                    == TYPE_CODE_FLT))
-              || (TYPE_NFIELDS (type) == 2
+              || (type->num_fields () == 2
                   && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
                       == TYPE_CODE_FLT)
                   && (TYPE_CODE (TYPE_FIELD_TYPE (type, 1))
@@ -5797,7 +5797,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
       int regnum;
       int field;
       for (field = 0, regnum = mips_regnum (gdbarch)->fp0;
-          field < TYPE_NFIELDS (type); field++, regnum += 2)
+          field < type->num_fields (); field++, regnum += 2)
        {
          int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
                        / TARGET_CHAR_BIT);
index 98660485f7ca7a325a468202f52b76906316d04f..7f81c5985fff53637f9c1095644f498d335bce93 100644 (file)
@@ -107,7 +107,7 @@ mn10300_type_align (struct type *type)
 
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i));
          while (align < falign)
@@ -143,7 +143,7 @@ mn10300_use_struct_convention (struct type *type)
     case TYPE_CODE_UNION:
       /* Structures with a single field are handled as the field
         itself.  */
-      if (TYPE_NFIELDS (type) == 1)
+      if (type->num_fields () == 1)
        return mn10300_use_struct_convention (TYPE_FIELD_TYPE (type, 0));
 
       /* Structures with word or double-word size are passed in memory, as
index d4d07c030f1bd95bad99485aa0a6f0c06704ed71..d403b71f10b0e9c4ff17f9dfbc2df0ce7485995f 100644 (file)
@@ -1405,7 +1405,7 @@ nds32_check_calling_use_fpr (struct type *type)
       typecode = t->code ();
       if (typecode != TYPE_CODE_STRUCT)
        break;
-      else if (TYPE_NFIELDS (t) != 1)
+      else if (t->num_fields () != 1)
        return 0;
       else
        t = TYPE_FIELD_TYPE (t, 0);
@@ -1496,7 +1496,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
         and pushes all unnamed arguments in stack.  */
 
       if (abi_use_fpr && TYPE_VARARGS (func_type)
-         && i >= TYPE_NFIELDS (func_type))
+         && i >= func_type->num_fields ())
        goto use_stack;
 
       /* Try to use FPRs to pass arguments only when
index 37fb90c391d2f4ec259d08951e47c3863ddb2a60..75df206a2bd409eeebef9074cbbac842d08b80be 100644 (file)
@@ -635,7 +635,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int len = TYPE_LENGTH (arg_type);
       enum type_code typecode = arg_type->code ();
 
-      if (TYPE_VARARGS (func_type) && argnum >= TYPE_NFIELDS (func_type))
+      if (TYPE_VARARGS (func_type) && argnum >= func_type->num_fields ())
        break; /* end or regular args, varargs go to stack.  */
 
       /* Extract the value, either a reference or the data.  */
index 19dd850733552e1fc36a8d7b27b40d9553080bcc..aa483336d2c2a57bac33a8a0b15f0b6ac0bc53b7 100644 (file)
@@ -104,7 +104,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
     {
       /* Old Borland type pascal strings from Free Pascal Compiler.  */
       /* Two fields: length and st.  */
-      if (TYPE_NFIELDS (type) == 2
+      if (type->num_fields () == 2
          && TYPE_FIELD_NAME (type, 0)
          && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
          && TYPE_FIELD_NAME (type, 1)
@@ -124,7 +124,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
         };
       /* GNU pascal strings.  */
       /* Three fields: Capacity, length and schema$ or _p_schema.  */
-      if (TYPE_NFIELDS (type) == 3
+      if (type->num_fields () == 3
          && TYPE_FIELD_NAME (type, 0)
          && strcmp (TYPE_FIELD_NAME (type, 0), "Capacity") == 0
          && TYPE_FIELD_NAME (type, 1)
index 05e28a49d3ebdcaec303d1feb6a725772ced6c1c..3246d4e82a51cee5fc3a5d7f08783af3f0284693 100644 (file)
@@ -309,7 +309,7 @@ static void
 pascal_print_func_args (struct type *type, struct ui_file *stream,
                        const struct type_print_options *flags)
 {
-  int i, len = TYPE_NFIELDS (type);
+  int i, len = type->num_fields ();
 
   if (len)
     {
@@ -559,7 +559,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
          pascal_type_print_derivation_info (stream, type);
 
          fprintf_filtered (stream, "\n");
-         if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
+         if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0))
            {
              if (TYPE_STUB (type))
                fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
@@ -576,7 +576,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
          /* If there is a base class for this type,
             do not print the field that it occupies.  */
 
-         len = TYPE_NFIELDS (type);
+         len = type->num_fields ();
          for (i = TYPE_N_BASECLASSES (type); i < len; i++)
            {
              QUIT;
@@ -758,7 +758,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
       else if (show > 0 || type->name () == NULL)
        {
          fprintf_filtered (stream, "(");
-         len = TYPE_NFIELDS (type);
+         len = type->num_fields ();
          lastval = 0;
          for (i = 0; i < len; i++)
            {
index 44dcbf9dc4295eb7a40cedf9bbbf68b4c4922749..284dc85bf8c816434c241f44d2d259c164bd6b4b 100644 (file)
@@ -524,7 +524,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
   struct type *type = check_typedef (value_type (val));
 
   fprintf_filtered (stream, "{");
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
   n_baseclasses = TYPE_N_BASECLASSES (type);
 
   /* Print out baseclasses such that we don't print
index 9dcf84c94c1655bfc52f1a72ba47a1d23f09e067..c0e6a929263c3c27f7ea147fcc922ed291d094e2 100644 (file)
@@ -1138,7 +1138,7 @@ ppc64_aggregate_candidate (struct type *type,
          LONGEST count = 0;
          int i;
 
-         for (i = 0; i < TYPE_NFIELDS (type); i++)
+         for (i = 0; i < type->num_fields (); i++)
            {
              LONGEST sub_count;
 
@@ -1494,10 +1494,10 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
         single floating-point value, at any level of nesting of
         single-member structs, are passed in floating-point registers.  */
       if (type->code () == TYPE_CODE_STRUCT
-         && TYPE_NFIELDS (type) == 1)
+         && type->num_fields () == 1)
        {
          while (type->code () == TYPE_CODE_STRUCT
-                && TYPE_NFIELDS (type) == 1)
+                && type->num_fields () == 1)
            type = check_typedef (TYPE_FIELD_TYPE (type, 0));
 
          if (type->code () == TYPE_CODE_FLT)
index 4b57e1638edbc975faea2a8adac022aca147b21a..dbe25ad8f6cd53330eb48b91bb2885ec7321605a 100644 (file)
@@ -1150,7 +1150,7 @@ typy_length (PyObject *self)
   if (type == NULL)
     return -1;
 
-  return TYPE_NFIELDS (type);
+  return type->num_fields ();
 }
 
 /* Implements boolean evaluation of gdb.Type.  Handle this like other
@@ -1193,7 +1193,7 @@ typy_getitem (PyObject *self, PyObject *key)
   if (type == NULL)
     return NULL;
 
-  for (i = 0; i < TYPE_NFIELDS (type); i++)
+  for (i = 0; i < type->num_fields (); i++)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -1251,7 +1251,7 @@ typy_has_key (PyObject *self, PyObject *args)
   if (type == NULL)
     return NULL;
 
-  for (i = 0; i < TYPE_NFIELDS (type); i++)
+  for (i = 0; i < type->num_fields (); i++)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -1336,7 +1336,7 @@ typy_iterator_iternext (PyObject *self)
   typy_iterator_object *iter_obj = (typy_iterator_object *) self;
   struct type *type = iter_obj->source->type;
 
-  if (iter_obj->field < TYPE_NFIELDS (type))
+  if (iter_obj->field < type->num_fields ())
     {
       gdbpy_ref<> result = make_fielditem (type, iter_obj->field,
                                           iter_obj->kind);
index 4b0dd025f0badf73a1a7fcf73111a3bef6235f01..0842dcbcb239abdf82c01c3585c542bdd7d51c18 100644 (file)
@@ -642,11 +642,11 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
 
   if (regtype->code () == TYPE_CODE_FLT
       || (regtype->code () == TYPE_CODE_UNION
-         && TYPE_NFIELDS (regtype) == 2
+         && regtype->num_fields () == 2
          && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
          && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT)
       || (regtype->code () == TYPE_CODE_UNION
-         && TYPE_NFIELDS (regtype) == 3
+         && regtype->num_fields () == 3
          && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
          && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT
          && TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT))
@@ -2044,7 +2044,7 @@ private:
 void
 riscv_struct_info::analyse_inner (struct type *type, int offset)
 {
-  unsigned int count = TYPE_NFIELDS (type);
+  unsigned int count = type->num_fields ();
   unsigned int i;
 
   for (i = 0; i < count; ++i)
@@ -2445,7 +2445,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
       arg_type = check_typedef (value_type (arg_value));
 
       riscv_arg_location (gdbarch, info, &call_info, arg_type,
-                         TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
+                         TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
 
       if (info->type != arg_type)
        arg_value = value_cast (info->type, arg_value);
index 6e3e49259d09f8390d3a996c5da6bb5af49d4b2a..47aa799754d7661b0c5e5b52e27fbc01ea9d8fa7 100644 (file)
@@ -2414,7 +2414,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
 
            if (!want_type
                && type->code () == TYPE_CODE_STRUCT
-               && TYPE_NFIELDS (type) == 0)
+               && type->num_fields () == 0)
              {
                /* A unit-like struct.  */
                write_exp_elt_opcode (pstate, OP_AGGREGATE);
index f0bea374ecb20f40ece3cc7b8c41a6c9c96a1eb3..f8696628474d4b3dfa568ddc2d565c4e621c37b8 100644 (file)
@@ -81,7 +81,7 @@ rust_enum_p (struct type *type)
 static bool
 rust_empty_enum_p (const struct type *type)
 {
-  return TYPE_NFIELDS (type) == 0;
+  return type->num_fields () == 0;
 }
 
 /* Given an already-resolved enum type and contents, find which
@@ -91,7 +91,7 @@ static int
 rust_enum_variant (struct type *type)
 {
   /* The active variant is simply the first non-artificial field.  */
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     if (!TYPE_FIELD_ARTIFICIAL (type, i))
       return i;
 
@@ -126,7 +126,7 @@ rust_underscore_fields (struct type *type)
 
   if (type->code () != TYPE_CODE_STRUCT)
     return false;
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (i = 0; i < type->num_fields (); ++i)
     {
       if (!field_is_static (&TYPE_FIELD (type, i)))
        {
@@ -149,7 +149,7 @@ rust_tuple_struct_type_p (struct type *type)
   /* This is just an approximation until DWARF can represent Rust more
      precisely.  We exclude zero-length structs because they may not
      be tuple structs, and there's no way to tell.  */
-  return TYPE_NFIELDS (type) > 0 && rust_underscore_fields (type);
+  return type->num_fields () > 0 && rust_underscore_fields (type);
 }
 
 /* Return true if TYPE is a slice type, otherwise false.  */
@@ -171,22 +171,22 @@ rust_range_type_p (struct type *type)
   int i;
 
   if (type->code () != TYPE_CODE_STRUCT
-      || TYPE_NFIELDS (type) > 2
+      || type->num_fields () > 2
       || type->name () == NULL
       || strstr (type->name (), "::Range") == NULL)
     return false;
 
-  if (TYPE_NFIELDS (type) == 0)
+  if (type->num_fields () == 0)
     return true;
 
   i = 0;
   if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
     {
-      if (TYPE_NFIELDS (type) == 1)
+      if (type->num_fields () == 1)
        return true;
       i = 1;
     }
-  else if (TYPE_NFIELDS (type) == 2)
+  else if (type->num_fields () == 2)
     {
       /* First field had to be "start".  */
       return false;
@@ -255,7 +255,7 @@ rust_get_trait_object_pointer (struct value *value)
 {
   struct type *type = check_typedef (value_type (value));
 
-  if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
+  if (type->code () != TYPE_CODE_STRUCT || type->num_fields () != 2)
     return NULL;
 
   /* Try to be a bit resilient if the ABI changes.  */
@@ -402,7 +402,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
       if (type->name () != NULL)
         fprintf_filtered (stream, "%s", type->name ());
 
-      if (TYPE_NFIELDS (type) == 0)
+      if (type->num_fields () == 0)
         return;
 
       if (type->name () != NULL)
@@ -418,7 +418,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
   opts.deref_ref = 0;
 
   first_field = 1;
-  for (i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (i = 0; i < type->num_fields (); ++i)
     {
       if (field_is_static (&TYPE_FIELD (type, i)))
         continue;
@@ -488,7 +488,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
   val = value_field (val, variant_fieldno);
   struct type *variant_type = TYPE_FIELD_TYPE (type, variant_fieldno);
 
-  int nfields = TYPE_NFIELDS (variant_type);
+  int nfields = variant_type->num_fields ();
 
   bool is_tuple = rust_tuple_struct_type_p (variant_type);
 
@@ -510,7 +510,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
     }
 
   bool first_field = true;
-  for (int j = 0; j < TYPE_NFIELDS (variant_type); j++)
+  for (int j = 0; j < variant_type->num_fields (); j++)
     {
       if (!first_field)
        fputs_filtered (", ", stream);
@@ -721,7 +721,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
        fputs_filtered (tagname, stream);
     }
 
-  if (TYPE_NFIELDS (type) == 0 && !is_tuple)
+  if (type->num_fields () == 0 && !is_tuple)
     return;
   if (for_rust_enum && !flags->print_offsets)
     fputs_filtered (is_tuple_struct ? "(" : "{", stream);
@@ -733,7 +733,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
      field indices here because it simplifies calls to
      print_offset_data::update below.  */
   std::vector<int> fields;
-  for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+  for (int i = 0; i < type->num_fields (); ++i)
     {
       if (field_is_static (&TYPE_FIELD (type, i)))
        continue;
@@ -783,7 +783,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
       /* Note that this check of "I" is ok because we only sorted the
         fields by offset when print_offsets was set, so we won't take
         this branch in that case.  */
-      else if (i + 1 < TYPE_NFIELDS (type))
+      else if (i + 1 < type->num_fields ())
        fputs_filtered (", ", stream);
     }
 
@@ -855,7 +855,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
       if (varstring != NULL)
        fputs_filtered (varstring, stream);
       fputs_filtered ("(", stream);
-      for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+      for (int i = 0; i < type->num_fields (); ++i)
        {
          QUIT;
          if (i > 0)
@@ -911,7 +911,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
          }
        fputs_filtered ("{\n", stream);
 
-       for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+       for (int i = 0; i < type->num_fields (); ++i)
          {
            const char *name = TYPE_FIELD_NAME (type, i);
 
@@ -1171,7 +1171,7 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
     error (_("Could not find function named '%s'"), name.c_str ());
 
   fn_type = SYMBOL_TYPE (sym.symbol);
-  if (TYPE_NFIELDS (fn_type) == 0)
+  if (fn_type->num_fields () == 0)
     error (_("Function '%s' takes no arguments"), name.c_str ());
 
   if (TYPE_FIELD_TYPE (fn_type, 0)->code () == TYPE_CODE_PTR)
@@ -1303,7 +1303,7 @@ rust_compute_range (struct type *type, struct value *range,
   *high = 0;
   *kind = BOTH_BOUND_DEFAULT;
 
-  if (TYPE_NFIELDS (type) == 0)
+  if (type->num_fields () == 0)
     return;
 
   i = 0;
@@ -1313,7 +1313,7 @@ rust_compute_range (struct type *type, struct value *range,
       *low = value_as_long (value_field (range, 0));
       ++i;
     }
-  if (TYPE_NFIELDS (type) > i
+  if (type->num_fields () > i
       && strcmp (TYPE_FIELD_NAME (type, i), "end") == 0)
     {
       *kind = (*kind == BOTH_BOUND_DEFAULT
@@ -1365,7 +1365,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
        base_type = TYPE_TARGET_TYPE (type);
       else if (rust_slice_type_p (type))
        {
-         for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+         for (int i = 0; i < type->num_fields (); ++i)
            {
              if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0)
                {
@@ -1676,7 +1676,7 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
              }
 
            /* Tuples and tuple structs */
-           nfields = TYPE_NFIELDS (type);
+           nfields = type->num_fields ();
 
            if (field_number >= nfields || field_number < 0)
              {
index 9963bc358d4544f79a9e0c98fdf78903ced5e916..0a9b1e8e47a19620fd54ea9afdefb414ccad3d83 100644 (file)
@@ -687,7 +687,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      of the ``arg_reg'' variable to get these other details correct.  */
 
   if (TYPE_VARARGS (func_type))
-    num_register_candidate_args = TYPE_NFIELDS (func_type) - 1;
+    num_register_candidate_args = func_type->num_fields () - 1;
   else
     num_register_candidate_args = 4;
 
@@ -796,7 +796,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                      int p_arg_size = 4;
 
                      if (TYPE_PROTOTYPED (func_type)
-                         && i < TYPE_NFIELDS (func_type))
+                         && i < func_type->num_fields ())
                        {
                          struct type *p_arg_type =
                            TYPE_FIELD_TYPE (func_type, i);
index e94bf59b44d792408c5c8bb6b95c6caec48dda0b..d6f176a4867eb8cd936e521e1323dc91ebd40b70 100644 (file)
@@ -1644,7 +1644,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size)
 
       /* Find a non-static field, if any.  Unless there's exactly one,
         abort the unwrapping.  */
-      for (int i = 0; i < TYPE_NFIELDS (type); i++)
+      for (int i = 0; i < type->num_fields (); i++)
        {
          struct field f = TYPE_FIELD (type, i);
 
@@ -1938,7 +1938,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      and arg_state.argp with the size of the parameter area.  */
   for (i = 0; i < nargs; i++)
     s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
-                    TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
+                    TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
 
   param_area_start = align_down (arg_state.copy - arg_state.argp, 8);
 
@@ -1965,7 +1965,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Write all parameters.  */
   for (i = 0; i < nargs; i++)
     s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
-                    TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
+                    TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
 
   /* Store return PSWA.  In 31-bit mode, keep addressing mode bit.  */
   if (word_size == 4)
index 98ebeb2fcfcc01d7b3a569def98c888c4c9de568..b4f00e46ad4a81ebdfaeee8572dff9cf57648946 100644 (file)
@@ -478,7 +478,7 @@ score_type_needs_double_align (struct type *type)
     {
       int i, n;
 
-      n = TYPE_NFIELDS (type);
+      n = type->num_fields ();
       for (i = 0; i < n; i++)
         if (score_type_needs_double_align (TYPE_FIELD_TYPE (type, i)))
           return 1;
index c6bef85588ea091ee34abd9a87a193871b759203..f134cf1c917c73b9fd272500e5c61eacceb91935 100644 (file)
@@ -813,7 +813,7 @@ static int
 sh_use_struct_convention (int renesas_abi, struct type *type)
 {
   int len = TYPE_LENGTH (type);
-  int nelem = TYPE_NFIELDS (type);
+  int nelem = type->num_fields ();
 
   /* The Renesas ABI returns aggregate types always on stack.  */
   if (renesas_abi && (type->code () == TYPE_CODE_STRUCT
@@ -849,7 +849,7 @@ static int
 sh_use_struct_convention_nofpu (int renesas_abi, struct type *type)
 {
   /* The Renesas ABI returns long longs/doubles etc. always on stack.  */
-  if (renesas_abi && TYPE_NFIELDS (type) == 0 && TYPE_LENGTH (type) >= 8)
+  if (renesas_abi && type->num_fields () == 0 && TYPE_LENGTH (type) >= 8)
     return 1;
   return sh_use_struct_convention (renesas_abi, type);
 }
@@ -1046,7 +1046,7 @@ sh_treat_as_flt_p (struct type *type)
   if (type->code () != TYPE_CODE_STRUCT)
     return 0;
   /* Otherwise structs with more than one member are not treated as float.  */
-  if (TYPE_NFIELDS (type) != 1)
+  if (type->num_fields () != 1)
     return 0;
   /* Otherwise if the type of that member is float, the whole type is
      treated as float.  */
@@ -1084,7 +1084,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
      registers have been used so far.  */
   if (sh_is_renesas_calling_convention (func_type)
       && TYPE_VARARGS (func_type))
-    last_reg_arg = TYPE_NFIELDS (func_type) - 2;
+    last_reg_arg = func_type->num_fields () - 2;
 
   /* First force sp to a 4-byte alignment.  */
   sp = sh_frame_align (gdbarch, sp);
@@ -1225,7 +1225,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
      registers have been used so far.  */
   if (sh_is_renesas_calling_convention (func_type)
       && TYPE_VARARGS (func_type))
-    last_reg_arg = TYPE_NFIELDS (func_type) - 2;
+    last_reg_arg = func_type->num_fields () - 2;
 
   /* First force sp to a 4-byte alignment.  */
   sp = sh_frame_align (gdbarch, sp);
index 2529ddc515892427d3049120f0c6f40e96d85f85..5d6ef071099fe5ef97c35c22ca2d8e16919d521f 100644 (file)
@@ -1179,7 +1179,7 @@ sparc64_16_byte_align_p (struct type *type)
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
 
@@ -1256,7 +1256,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
          int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
@@ -1274,7 +1274,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
          probably in older releases to.  To appease GCC, if a
          structure has only a single `float' member, we store its
          value in %f1 too (we already have stored in %f0).  */
-      if (TYPE_NFIELDS (type) == 1)
+      if (type->num_fields () == 1)
        {
          struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0));
 
@@ -1344,7 +1344,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
          int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
index c3da9a239b4b33f9cce7bc5df4ab430e924c33e5..daf88c851c72a9110c3b00a7590987b01268fabf 100644 (file)
@@ -3232,7 +3232,7 @@ read_tilde_fields (struct stab_field_info *fip, const char **pp,
          set_type_vptr_basetype (type, t);
          if (type == t)        /* Our own class provides vtbl ptr.  */
            {
-             for (i = TYPE_NFIELDS (t) - 1;
+             for (i = t->num_fields () - 1;
                   i >= TYPE_N_BASECLASSES (t);
                   --i)
                {
index 20d73bb28f57e0a0d1b705bdcf99b3728fafff34..42f1b1ee690a49c6ceb367a7cf5a3bc176a062d0 100644 (file)
@@ -1966,7 +1966,7 @@ check_field (struct type *type, const char *name,
   /* The type may be a stub.  */
   type = check_typedef (type);
 
-  for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
+  for (i = type->num_fields () - 1; i >= TYPE_N_BASECLASSES (type); i--)
     {
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -5472,7 +5472,7 @@ completion_list_add_fields (completion_tracker &tracker,
       int j;
 
       if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT)
-       for (j = TYPE_N_BASECLASSES (t); j < TYPE_NFIELDS (t); j++)
+       for (j = TYPE_N_BASECLASSES (t); j < t->num_fields (); j++)
          if (TYPE_FIELD_NAME (t, j))
            completion_list_add_name (tracker, sym->language (),
                                      TYPE_FIELD_NAME (t, j),
index eb9701548ce7b66c0f58d59ffdcdf55c3c33a0eb..57945d21db711f17fad49b0e4c35c44247f9bce9 100644 (file)
@@ -890,7 +890,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* For a variadic C function, the last explicitly declared argument and all
      remaining arguments are passed on the stack.  */
   if (TYPE_VARARGS (func_type))
-    first_arg_on_stack = TYPE_NFIELDS (func_type) - 1;
+    first_arg_on_stack = func_type->num_fields () - 1;
 
   /* Now make space on the stack for the args.  */
   for (argnum = 0; argnum < nargs; argnum++)
index e5009ea3800167af48ec4b11415201c88907848a..a46f6a564c059956b1916e32bfa78d8f4b410046 100644 (file)
@@ -619,7 +619,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
     {
 
     case TYPE_CODE_ENUM:
-      len = TYPE_NFIELDS (type);
+      len = type->num_fields ();
       for (i = 0; i < len; i++)
        {
          if (TYPE_FIELD_ENUMVAL (type, i) == val)
index 1e0fd41a532b1ea9b8fc498285b426b90285398a..298613e42c31d35cb179e2e94f6ac75411d0a016 100644 (file)
@@ -532,7 +532,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
      type whose size is greater than or equal to 4 -> returned in register.  */
   if ((type->code () == TYPE_CODE_STRUCT
        || type->code () == TYPE_CODE_UNION)
-       && TYPE_NFIELDS (type) == 1)
+       && type->num_fields () == 1)
     {
       fld_type = TYPE_FIELD_TYPE (type, 0);
       if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
@@ -553,7 +553,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
       && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0))
       && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
     {
-      for (i = 1; i < TYPE_NFIELDS (type); ++i)
+      for (i = 1; i < type->num_fields (); ++i)
         {
          fld_type = TYPE_FIELD_TYPE (type, 0);
          if (fld_type->code () == TYPE_CODE_ARRAY)
@@ -572,7 +572,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
      returned in register.  */
   if (type->code () == TYPE_CODE_UNION)
     {
-      for (i = 0; i < TYPE_NFIELDS (type); ++i)
+      for (i = 0; i < type->num_fields (); ++i)
         {
          fld_type = TYPE_FIELD_TYPE (type, 0);
          if (!v850_use_struct_convention (gdbarch, fld_type))
@@ -981,7 +981,7 @@ v850_eight_byte_align_p (struct type *type)
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (type); i++)
+      for (i = 0; i < type->num_fields (); i++)
        {
          if (v850_eight_byte_align_p (TYPE_FIELD_TYPE (type, i)))
            return 1;
index 40c8f34ea1deac1a0573144eb3361941f24a1ed0..8cbc3b92ec8c66d14668f53ba0f902d09f56a84a 100644 (file)
@@ -1805,7 +1805,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
   nbases = TYPE_N_BASECLASSES (type);
 
   if (!looking_for_baseclass)
-    for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
+    for (i = type->num_fields () - 1; i >= nbases; i--)
       {
        const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -1851,7 +1851,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
                   bitpos is zero in an anonymous union field, so we
                   have to add the offset of the union here.  */
                if (field_type->code () == TYPE_CODE_STRUCT
-                   || (TYPE_NFIELDS (field_type) > 0
+                   || (field_type->num_fields () > 0
                        && TYPE_FIELD_BITPOS (field_type, 0) == 0))
                  new_offset += TYPE_FIELD_BITPOS (type, i) / 8;
 
@@ -2007,7 +2007,7 @@ search_struct_method (const char *name, struct value **arg1p,
              {
                if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
                              TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)),
-                             TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)),
+                             TYPE_FN_FIELD_TYPE (f, j)->num_fields (),
                              TYPE_FN_FIELD_ARGS (f, j), args))
                  {
                    if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
@@ -2219,7 +2219,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
     error (_("Attempt to extract a component of a value that is not a %s."),
           err);
 
-  for (i = TYPE_N_BASECLASSES (t); i < TYPE_NFIELDS (t); i++)
+  for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
     {
       if (!field_is_static (&TYPE_FIELD (t, i))
          && bitpos == TYPE_FIELD_BITPOS (t, i)
@@ -2957,11 +2957,11 @@ find_oload_champ (gdb::array_view<value *> args,
 
          if (methods != NULL)
            {
-             nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (methods, ix));
+             nparms = TYPE_FN_FIELD_TYPE (methods, ix)->num_fields ();
              static_offset = oload_method_static_p (methods, ix);
            }
          else
-           nparms = TYPE_NFIELDS (SYMBOL_TYPE (functions[ix]));
+           nparms = SYMBOL_TYPE (functions[ix])->num_fields ();
 
          parm_types.reserve (nparms);
          for (jj = 0; jj < nparms; jj++)
@@ -3121,7 +3121,7 @@ enum_constant_from_type (struct type *type, const char *name)
   gdb_assert (type->code () == TYPE_CODE_ENUM
              && TYPE_DECLARED_CLASS (type));
 
-  for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); ++i)
+  for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
     {
       const char *fname = TYPE_FIELD_NAME (type, i);
       int len;
@@ -3189,14 +3189,14 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
 {
   int start = 0;
 
-  if (TYPE_NFIELDS (t1) > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0))
+  if (t1->num_fields () > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0))
     ++start;
 
   /* If skipping artificial fields, find the first real field
      in T1.  */
   if (skip_artificial)
     {
-      while (start < TYPE_NFIELDS (t1)
+      while (start < t1->num_fields ()
             && TYPE_FIELD_ARTIFICIAL (t1, start))
        ++start;
     }
@@ -3205,15 +3205,15 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
 
   /* Special case: a method taking void.  T1 will contain no
      non-artificial fields, and T2 will contain TYPE_CODE_VOID.  */
-  if ((TYPE_NFIELDS (t1) - start) == 0 && TYPE_NFIELDS (t2) == 1
+  if ((t1->num_fields () - start) == 0 && t2->num_fields () == 1
       && TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID)
     return 1;
 
-  if ((TYPE_NFIELDS (t1) - start) == TYPE_NFIELDS (t2))
+  if ((t1->num_fields () - start) == t2->num_fields ())
     {
       int i;
 
-      for (i = 0; i < TYPE_NFIELDS (t2); ++i)
+      for (i = 0; i < t2->num_fields (); ++i)
        {
          if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
                                            TYPE_FIELD_TYPE (t2, i), NULL),
@@ -3293,7 +3293,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
     error (_("Internal error: non-aggregate type "
             "to value_struct_elt_for_reference"));
 
-  for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
+  for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
     {
       const char *t_field_name = TYPE_FIELD_NAME (t, i);
 
index 4bd643e938df5ecd8441ad40e9dd64f10fff1be1..17d091d613117857afa36923eedc2d73854e92f2 100644 (file)
@@ -587,7 +587,7 @@ generic_val_print_enum_1 (struct type *type, LONGEST val,
   unsigned int i;
   unsigned int len;
 
-  len = TYPE_NFIELDS (type);
+  len = type->num_fields ();
   for (i = 0; i < len; i++)
     {
       QUIT;
@@ -1135,7 +1135,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
   const gdb_byte *valaddr = (value_contents_for_printing (original_value)
                             + embedded_offset);
   ULONGEST val = unpack_long (type, valaddr);
-  int field, nfields = TYPE_NFIELDS (type);
+  int field, nfields = type->num_fields ();
   struct gdbarch *gdbarch = get_type_arch (type);
   struct type *bool_type = builtin_type (gdbarch)->builtin_bool;