ada_check_typedef (desc_data_target_type (arr->type ()));
if (ada_is_unconstrained_packed_array_type (arr->type ()))
- TYPE_FIELD_BITSIZE (array_type, 0) =
- decode_packed_array_bitsize (arr->type ());
-
+ array_type->field (0).set_bitsize
+ (decode_packed_array_bitsize (arr->type ()));
+
return array_type;
}
else
LONGEST lo = value_as_long (low);
LONGEST hi = value_as_long (high);
- TYPE_FIELD_BITSIZE (elt_type, 0) =
- decode_packed_array_bitsize (arr->type ());
+ elt_type->field (0).set_bitsize
+ (decode_packed_array_bitsize (arr->type ()));
+
/* If the array has no element, then the size is already
zero, and does not need to be recomputed. */
if (lo < hi)
constrained_packed_array_type (ada_check_typedef (type->target_type ()),
elt_bits);
new_type = create_array_type (alloc, new_elt_type, index_type);
- TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
+ new_type->field (0).set_bitsize (*elt_bits);
new_type->set_name (ada_type_name (type));
if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE
{
LONGEST elt_len = recursively_update_array_bitsize (elt_type);
LONGEST elt_bitsize = elt_len * TYPE_FIELD_BITSIZE (elt_type, 0);
- TYPE_FIELD_BITSIZE (type, 0) = elt_bitsize;
+ type->field (0).set_bitsize (elt_bitsize);
type->set_length (((our_len * elt_bitsize + HOST_CHAR_BIT - 1)
/ HOST_CHAR_BIT));
off = align_up (off, field_alignment (type, f))
+ type->field (f).loc_bitpos ();
rtype->field (f).set_loc_bitpos (off);
- TYPE_FIELD_BITSIZE (rtype, f) = 0;
+ rtype->field (f).set_bitsize (0);
if (ada_is_variant_part (type, f))
{
rtype->field (f).set_type (type->field (f).type ());
rtype->field (f).set_name (type->field (f).name ());
if (TYPE_FIELD_BITSIZE (type, f) > 0)
- fld_bit_len =
- TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
+ {
+ fld_bit_len = TYPE_FIELD_BITSIZE (type, f);
+ rtype->field (f).set_bitsize (fld_bit_len);
+ }
else
{
struct type *field_type = type->field (f).type ();
{
rtype->field (variant_field).set_type (branch_type);
rtype->field (variant_field).set_name ("S");
- TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
+ rtype->field (variant_field).set_bitsize (0);
rtype->set_length (rtype->length () + branch_type->length ());
}
int len = result->length () / result->target_type ()->length ();
int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0);
- TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
+ result->field (0).set_bitsize (TYPE_FIELD_BITSIZE (type0, 0));
result->set_length (len * elt_bitsize / HOST_CHAR_BIT);
if (result->length () * HOST_CHAR_BIT < len * elt_bitsize)
result->set_length (result->length () + 1);
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
objfile));
list->field.set_loc_bitpos (8 * ms->c_value);
- FIELD_BITSIZE (list->field) = 0;
+ list->field.set_bitsize (0);
nfields++;
break;
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
objfile));
list->field.set_loc_bitpos (ms->c_value);
- FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
+ list->field.set_bitsize (sub_aux.x_sym.x_misc.x_lnsz.x_size);
nfields++;
break;
type->field (n).set_loc_enumval (xsym->value_longest ());
if (xsym->value_longest () < 0)
unsigned_enum = 0;
- TYPE_FIELD_BITSIZE (type, n) = 0;
+ type->field (n).set_bitsize (0);
}
if (syms == osyms)
break;
{
f = append_composite_type_field_raw (the_struct, "A", bool_type);
f->set_loc_bitpos (1);
- FIELD_BITSIZE (*f) = 1;
+ f->set_bitsize (1);
f = append_composite_type_field_raw (the_struct, "B", uint8_type);
f->set_loc_bitpos (3);
- FIELD_BITSIZE (*f) = 3;
+ f->set_bitsize (3);
f = append_composite_type_field_raw (the_struct, "C", bool_type);
f->set_loc_bitpos (7);
- FIELD_BITSIZE (*f) = 1;
+ f->set_bitsize (1);
}
/* According to the logic commented in "make_gdb_type_struct ()" of
* target-descriptions.c, bit positions are numbered differently for
{
f = append_composite_type_field_raw (the_struct, "A", bool_type);
f->set_loc_bitpos (30);
- FIELD_BITSIZE (*f) = 1;
+ f->set_bitsize (1);
f = append_composite_type_field_raw (the_struct, "B", uint8_type);
f->set_loc_bitpos (26);
- FIELD_BITSIZE (*f) = 3;
+ f->set_bitsize (3);
f = append_composite_type_field_raw (the_struct, "C", bool_type);
f->set_loc_bitpos (24);
- FIELD_BITSIZE (*f) = 1;
+ f->set_bitsize (1);
}
value *val = value::allocate (the_struct);
fp->set_type (t);
fp->set_loc_bitpos (offset / TARGET_CHAR_BIT);
- FIELD_BITSIZE (*fp) = get_bitsize (ccp->fp, tid, kind);
+ fp->set_bitsize (get_bitsize (ccp->fp, tid, kind));
fip->fields.emplace_back (new_field);
fp->set_name (name);
fp->set_type (nullptr);
fp->set_loc_enumval (enum_value);
- FIELD_BITSIZE (*fp) = 0;
+ fp->set_bitsize (0);
if (name != nullptr)
{
/* Get bit size of field (zero if none). */
attr = dwarf2_attr (die, DW_AT_bit_size, cu);
if (attr != nullptr)
- {
- FIELD_BITSIZE (*fp) = attr->constant_value (0);
- }
+ fp->set_bitsize (attr->constant_value (0));
else
- {
- FIELD_BITSIZE (*fp) = 0;
- }
+ fp->set_bitsize (0);
/* Get bit offset of field. */
handle_member_location (die, cu, fp);
{
/* C++ base class field. */
handle_member_location (die, cu, fp);
- FIELD_BITSIZE (*fp) = 0;
+ fp->set_bitsize (0);
fp->set_type (die_type (die, cu));
fp->set_name (fp->type ()->name ());
}
field->set_loc_bitpos (8 * offset);
if (size != field->type ()->length ())
- FIELD_BITSIZE (*field) = 8 * size;
+ field->set_bitsize (8 * size);
return true;
}
fields.append("m_name = %s" % f["m_name"])
fields.append("m_type = %s" % f["m_type"])
fields.append("m_loc_kind = %s" % f["m_loc_kind"])
- fields.append("bitsize = %d" % f["bitsize"])
+ fields.append("bitsize = %d" % f["m_bitsize"])
fields.append(self.struct_field_location_img(f))
return label + "\n" + " {" + ",\n ".join(fields) + "}"
&& TYPE_FIELD_BITSIZE (element_type, 0) != 0
&& get_array_bounds (element_type, &low_bound, &high_bound)
&& high_bound >= low_bound)
- TYPE_FIELD_BITSIZE (type, 0)
- = ((high_bound - low_bound + 1)
- * TYPE_FIELD_BITSIZE (element_type, 0));
+ type->field (0).set_bitsize
+ ((high_bound - low_bound + 1)
+ * TYPE_FIELD_BITSIZE (element_type, 0));
return true;
}
if (byte_stride_prop != NULL)
result_type->add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop);
else if (bit_stride > 0)
- TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride;
+ result_type->field (0).set_bitsize (bit_stride);
if (!update_static_array_size (result_type))
{
{
new_type->field (i).set_is_artificial
(type->field (i).is_artificial ());
- TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
+ new_type->field (i).set_bitsize (TYPE_FIELD_BITSIZE (type, i));
if (type->field (i).type ())
new_type->field (i).set_type
(copy_type_recursive (type->field (i).type (), copied_types));
type->field (field_nr).set_name (xstrdup (name));
type->field (field_nr).set_type (field_type);
type->field (field_nr).set_loc_bitpos (start_bitpos);
- TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
+ type->field (field_nr).set_bitsize (nr_bits);
}
/* Special version of append_flags_type_field to add a flag field.
m_artificial = is_artificial;
}
+ unsigned int bitsize () const
+ {
+ return m_bitsize;
+ }
+
+ void set_bitsize (unsigned int bitsize)
+ {
+ m_bitsize = bitsize;
+ }
+
/* Return true if this field is static; false if not. */
bool is_static () const
{
For an unpacked field, the field's type's length
says how many bytes the field occupies. */
- unsigned int bitsize : 28;
+ unsigned int m_bitsize : 28;
/* * In a struct or union type, type of this field.
- In a function or member type, type of this argument.
ULONGEST bit_stride () const
{
- if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize != 0)
- return this->field (0).bitsize;
+ if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize () != 0)
+ return this->field (0).bitsize ();
return this->bounds ()->bit_stride ();
}
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
+#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize ())
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)
f->set_loc_enumval (tsym.value);
f->set_type (t);
f->set_name (debug_info->ss + cur_fdr->issBase + tsym.iss);
- FIELD_BITSIZE (*f) = 0;
+ f->set_bitsize (0);
enum_sym = new (&mdebugread_objfile->objfile_obstack) symbol;
enum_sym->set_linkage_name
bitsize = 0;
f->set_type (parse_type (cur_fd, ax, sh->index, &bitsize, bigend,
name));
- FIELD_BITSIZE (*f) = bitsize;
+ f->set_bitsize (bitsize);
}
break;
return 0;
}
/* This field is unpacked. */
- FIELD_BITSIZE (fip->list->field) = 0;
+ fip->list->field.set_bitsize (0);
fip->list->visibility = VISIBILITY_PRIVATE;
}
else
stabs_general_complaint ("bad structure-type format");
return;
}
- FIELD_BITSIZE (fip->list->field) = read_huge_number (pp, ';', &nbits, 0);
+ fip->list->field.set_bitsize (read_huge_number (pp, ';', &nbits, 0));
if (nbits != 0)
{
stabs_general_complaint ("bad structure-type format");
&& field_type->code () != TYPE_CODE_BOOL
&& field_type->code () != TYPE_CODE_ENUM)
{
- FIELD_BITSIZE (fip->list->field) = 0;
+ fip->list->field.set_bitsize (0);
}
if ((FIELD_BITSIZE (fip->list->field)
== TARGET_CHAR_BIT * field_type->length ()
&&
fip->list->field.loc_bitpos () % 8 == 0)
{
- FIELD_BITSIZE (fip->list->field) = 0;
+ fip->list->field.set_bitsize (0);
}
}
}
newobj->next = fip->list;
fip->list = newobj;
- FIELD_BITSIZE (newobj->field) = 0; /* This should be an unpacked
+ newobj->field.set_bitsize (0); /* This should be an unpacked
field! */
STABS_CONTINUE (pp, objfile);
xsym->set_type (type);
type->field (n).set_name (xsym->linkage_name ());
type->field (n).set_loc_enumval (xsym->value_longest ());
- TYPE_FIELD_BITSIZE (type, n) = 0;
+ type->field (n).set_bitsize (0);
}
if (syms == osyms)
break;
fld->set_loc_bitpos (total_size - f.start - bitsize);
else
fld->set_loc_bitpos (f.start);
- FIELD_BITSIZE (fld[0]) = bitsize;
+ fld->set_bitsize (bitsize);
}
else
{