gdb: add type::num_fields / type::set_num_fields
[deliverable/binutils-gdb.git] / gdb / gdbtypes.h
index ba8e6f837aaf91bca07abbaa123e266822f76c8f..da8d5e2a1199b457af540e4d066a2620230dc40f 100644 (file)
@@ -901,6 +901,18 @@ struct type
     this->main_type->name = name;
   }
 
+  /* Get the number of fields of this type.  */
+  int num_fields () const
+  {
+    return this->main_type->nfields;
+  }
+
+  /* Set the number of fields of this type.  */
+  void set_num_fields (int num_fields)
+  {
+    this->main_type->nfields = num_fields;
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@@ -1446,7 +1458,7 @@ extern unsigned type_align (struct type *);
    space in struct type.  */
 extern bool set_type_align (struct type *, ULONGEST);
 
-#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
+#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)
This page took 0.026754 seconds and 4 git commands to generate.