+2020-02-27 Tom Tromey <tromey@adacore.com>
+
+ * dwarf2/read.c (struct field_info) <nfields>: Now a method, not a
+ member.
+ (dwarf2_add_field): Don't update nfields.
+ (dwarf2_attach_fields_to_type, process_structure_scope): Update.
+
2020-02-27 Andrew Burgess <andrew.burgess@embecosm.com>
* gdbtypes.c (create_array_type_with_stride): Use std::abs not
std::vector<struct nextfield> fields;
std::vector<struct nextfield> baseclasses;
- /* Number of fields (including baseclasses). */
- int nfields = 0;
-
/* Set if the accessibility of one of the fields is not public. */
int non_public_fields = 0;
/* Nested types defined by this class and the number of elements in this
list. */
std::vector<struct decl_field> nested_types_list;
+
+ /* Return the total number of fields (including baseclasses). */
+ int nfields () const
+ {
+ return fields.size () + baseclasses.size ();
+ }
};
/* Loaded secondary compilation units are kept in memory until they
new_field = &fip->fields.back ();
}
- fip->nfields++;
-
attr = dwarf2_attr (die, DW_AT_accessibility, cu);
if (attr != nullptr)
new_field->accessibility = DW_UNSND (attr);
dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
struct dwarf2_cu *cu)
{
- int nfields = fip->nfields;
+ int nfields = fip->nfields ();
/* Record the field count, allocate space for the array of fields,
and create blank accessibility bitfields if necessary. */
}
/* Attach fields and member functions to the type. */
- if (fi.nfields)
+ if (fi.nfields () > 0)
dwarf2_attach_fields_to_type (&fi, type, cu);
if (!fi.fnfieldlists.empty ())
{