gdb: add type::fields / type::set_fields
[deliverable/binutils-gdb.git] / gdb / coffread.c
index 6bf3abd646f5c3b5621a6533fc553b529a5ae0ff..9b2f638d748f0ac2dde7b946810eedc50600e0ff 100644 (file)
@@ -1456,12 +1456,10 @@ patch_type (struct type *type, struct type *real_type)
 
   TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
   target->set_num_fields (real_target->num_fields ());
-  TYPE_FIELDS (target) = (struct field *) TYPE_ALLOC (target,
-                                                     field_size);
 
-  memcpy (TYPE_FIELDS (target), 
-         TYPE_FIELDS (real_target), 
-         field_size);
+  field *fields = (struct field *) TYPE_ALLOC (target, field_size);
+  memcpy (fields, real_target->fields (), field_size);
+  target->set_fields (fields);
 
   if (real_target->name ())
     {
@@ -1882,7 +1880,7 @@ decode_base_type (struct coff_symbol *cs,
          type->set_name (NULL);
          INIT_CPLUS_SPECIFIC (type);
          TYPE_LENGTH (type) = 0;
-         TYPE_FIELDS (type) = 0;
+         type->set_fields (nullptr);
          type->set_num_fields (0);
        }
       else
@@ -1902,7 +1900,7 @@ decode_base_type (struct coff_symbol *cs,
          type->set_name (NULL);
          INIT_CPLUS_SPECIFIC (type);
          TYPE_LENGTH (type) = 0;
-         TYPE_FIELDS (type) = 0;
+         type->set_fields (nullptr);
          type->set_num_fields (0);
        }
       else
@@ -1923,7 +1921,7 @@ decode_base_type (struct coff_symbol *cs,
          type->set_code (TYPE_CODE_ENUM);
          type->set_name (NULL);
          TYPE_LENGTH (type) = 0;
-         TYPE_FIELDS (type) = 0;
+         type->set_fields (nullptr);
          type->set_num_fields (0);
        }
       else
@@ -2041,8 +2039,8 @@ coff_read_struct_type (int index, int length, int lastsym,
   /* Now create the vector of fields, and record how big it is.  */
 
   type->set_num_fields (nfields);
-  TYPE_FIELDS (type) = (struct field *)
-    TYPE_ALLOC (type, sizeof (struct field) * nfields);
+  type->set_fields
+    ((struct field *) TYPE_ALLOC (type, sizeof (struct field) * nfields));
 
   /* Copy the saved-up fields into the field vector.  */
 
@@ -2121,8 +2119,8 @@ coff_read_enum_type (int index, int length, int lastsym,
     TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
   type->set_code (TYPE_CODE_ENUM);
   type->set_num_fields (nsyms);
-  TYPE_FIELDS (type) = (struct field *)
-    TYPE_ALLOC (type, sizeof (struct field) * nsyms);
+  type->set_fields
+    ((struct field *) TYPE_ALLOC (type, sizeof (struct field) * nsyms));
 
   /* Find the symbols for the values and put them into the type.
      The symbols can be found in the symlist that we put them on
This page took 0.026431 seconds and 4 git commands to generate.