}
}
case TYPE_CODE_ENUM:
- return TYPE_FIELD_ENUMVAL (type, type->num_fields () - 1);
+ return type->field (type->num_fields () - 1).loc_enumval ();
case TYPE_CODE_BOOL:
return 1;
case TYPE_CODE_CHAR:
}
}
case TYPE_CODE_ENUM:
- return TYPE_FIELD_ENUMVAL (type, 0);
+ return type->field (0).loc_enumval ();
case TYPE_CODE_BOOL:
return 0;
case TYPE_CODE_CHAR:
/* All enums in the type should have an identical underlying value. */
for (i = 0; i < type1->num_fields (); i++)
- if (TYPE_FIELD_ENUMVAL (type1, i) != TYPE_FIELD_ENUMVAL (type2, i))
+ if (type1->field (i).loc_enumval () != type2->field (i).loc_enumval ())
return 0;
/* All enumerals should also have the same name (modulo any numerical
{
if (val < 0 || val >= type->num_fields ())
error (_("argument to 'VAL out of range"));
- val = TYPE_FIELD_ENUMVAL (type, val);
+ val = type->field (val).loc_enumval ();
}
return value_from_longest (type, val);
}
size_t elen = strlen (ename);
if (elen >= len && strcmp (name, ename + elen - len) == 0)
- return TYPE_FIELD_ENUMVAL (type, f);
+ return type->field (f).loc_enumval ();
}
return val;
}
wrap_here (" ");
fputs_styled (ada_enum_name (type->field (i).name ()),
variable_name_style.style (), stream);
- if (lastval != TYPE_FIELD_ENUMVAL (type, i))
+ if (lastval != type->field (i).loc_enumval ())
{
fprintf_filtered (stream, " => %s",
- plongest (TYPE_FIELD_ENUMVAL (type, i)));
- lastval = TYPE_FIELD_ENUMVAL (type, i);
+ plongest (type->field (i).loc_enumval ()));
+ lastval = type->field (i).loc_enumval ();
}
lastval += 1;
}
case TYPE_CODE_ENUM:
if (low_bound == 0)
return 0;
- low_bound = TYPE_FIELD_ENUMVAL (index_type, low_bound);
+ low_bound = index_type->field (low_bound).loc_enumval ();
break;
case TYPE_CODE_UNDEF:
index_type = NULL;
len = type->num_fields ();
for (i = 0; i < len; i++)
{
- if (TYPE_FIELD_ENUMVAL (type, i) == val)
+ if (type->field (i).loc_enumval () == val)
{
break;
}
for (i = 0; i < len; i++)
{
QUIT;
- if (val == TYPE_FIELD_ENUMVAL (type, i))
+ if (val == type->field (i).loc_enumval ())
break;
}
wrap_here (" ");
fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
- if (lastval != TYPE_FIELD_ENUMVAL (type, i))
+ if (lastval != type->field (i).loc_enumval ())
{
fprintf_filtered (stream, " = %s",
- plongest (TYPE_FIELD_ENUMVAL (type, i)));
- lastval = TYPE_FIELD_ENUMVAL (type, i);
+ plongest (type->field (i).loc_enumval ()));
+ lastval = type->field (i).loc_enumval ();
}
lastval++;
}
for (i = 0; i < type->num_fields (); ++i)
{
context->plugin ().build_add_enum_constant
- (result, type->field (i).name (), TYPE_FIELD_ENUMVAL (type, i));
+ (result, type->field (i).name (), type->field (i).loc_enumval ());
}
context->plugin ().finish_enum_type (result);
continue;
instance->plugin ().build_enum_constant (result, fname.get (),
- TYPE_FIELD_ENUMVAL (type, i));
+ type->field (i).loc_enumval ());
}
/* Finish enum definition and pop scopes. */
{
const char *name
= rust_last_path_segment (enum_type->field (i).name ());
- discriminant_map[name] = TYPE_FIELD_ENUMVAL (enum_type, i);
+ discriminant_map[name] = enum_type->field (i).loc_enumval ();
}
}
{
/* The enums may not be sorted by value, so search all
entries. */
- LONGEST low = TYPE_FIELD_ENUMVAL (type, 0);
+ LONGEST low = type->field (0).loc_enumval ();
for (int i = 0; i < type->num_fields (); i++)
{
- if (TYPE_FIELD_ENUMVAL (type, i) < low)
- low = TYPE_FIELD_ENUMVAL (type, i);
+ if (type->field (i).loc_enumval () < low)
+ low = type->field (i).loc_enumval ();
}
/* Set unsigned indicator if warranted. */
{
/* The enums may not be sorted by value, so search all
entries. */
- LONGEST high = TYPE_FIELD_ENUMVAL (type, 0);
+ LONGEST high = type->field (0).loc_enumval ();
for (int i = 0; i < type->num_fields (); i++)
{
- if (TYPE_FIELD_ENUMVAL (type, i) > high)
- high = TYPE_FIELD_ENUMVAL (type, i);
+ if (type->field (i).loc_enumval () > high)
+ high = type->field (i).loc_enumval ();
}
return high;
for (i = 0; i < type->num_fields (); i += 1)
{
- if (val == TYPE_FIELD_ENUMVAL (type, i))
+ if (val == type->field (i).loc_enumval ())
return i;
}
{
if (type->code () == TYPE_CODE_ENUM)
printf_filtered ("%*s[%d] enumval %s type ", spaces + 2, "",
- idx, plongest (TYPE_FIELD_ENUMVAL (type, idx)));
+ idx, plongest (type->field (idx).loc_enumval ()));
else
printf_filtered ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "",
idx, plongest (type->field (idx).loc_bitpos ()),
new_type->field (i).set_loc_bitpos (type->field (i).loc_bitpos ());
break;
case FIELD_LOC_KIND_ENUMVAL:
- new_type->field (i).set_loc_enumval (TYPE_FIELD_ENUMVAL (type, i));
+ new_type->field (i).set_loc_enumval (type->field (i).loc_enumval ());
break;
case FIELD_LOC_KIND_PHYSADDR:
new_type->field (i).set_loc_physaddr
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
-#define TYPE_FIELD_ENUMVAL(thistype, n) ((thistype)->field (n).loc_enumval ())
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((thistype)->field (n).loc_physname ())
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) ((thistype)->field (n).loc_physaddr ())
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) ((thistype)->field (n).loc_dwarf_block ())
wrap_here (" ");
fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
- if (lastval != TYPE_FIELD_ENUMVAL (type, i))
+ if (lastval != type->field (i).loc_enumval ())
{
fprintf_filtered (stream, " = %s",
- plongest (TYPE_FIELD_ENUMVAL (type, i)));
- lastval = TYPE_FIELD_ENUMVAL (type, i);
+ plongest (type->field (i).loc_enumval ()));
+ lastval = type->field (i).loc_enumval ();
}
lastval++;
}
fprintf_filtered (stream, ", ");
wrap_here (" ");
fputs_filtered (type->field (i).name (), stream);
- if (lastval != TYPE_FIELD_ENUMVAL (type, i))
+ if (lastval != type->field (i).loc_enumval ())
{
fprintf_filtered (stream,
" := %s",
- plongest (TYPE_FIELD_ENUMVAL (type, i)));
- lastval = TYPE_FIELD_ENUMVAL (type, i);
+ plongest (type->field (i).loc_enumval ()));
+ lastval = type->field (i).loc_enumval ();
}
lastval++;
}
if (type->code () == TYPE_CODE_ENUM)
{
- arg = gdb_py_object_from_longest (TYPE_FIELD_ENUMVAL (type, field));
+ arg = gdb_py_object_from_longest (type->field (field).loc_enumval ());
attrstring = "enumval";
}
else
len = type->num_fields ();
for (i = 0; i < len; i++)
{
- if (TYPE_FIELD_ENUMVAL (type, i) == val)
+ if (type->field (i).loc_enumval () == val)
{
break;
}
&& fname[len - name_len - 2] == ':'
&& fname[len - name_len - 1] == ':'
&& strcmp (&fname[len - name_len], name) == 0)
- return value_from_longest (type, TYPE_FIELD_ENUMVAL (type, i));
+ return value_from_longest (type, type->field (i).loc_enumval ());
}
error (_("no constant named \"%s\" in enum \"%s\""),
for (i = 0; i < len; i++)
{
QUIT;
- if (val == TYPE_FIELD_ENUMVAL (type, i))
+ if (val == type->field (i).loc_enumval ())
{
break;
}
{
QUIT;
- ULONGEST enumval = TYPE_FIELD_ENUMVAL (type, i);
+ ULONGEST enumval = type->field (i).loc_enumval ();
int nbits = count_one_bits_ll (enumval);
gdb_assert (nbits == 0 || nbits == 1);
else
fputs_filtered (" | ", stream);
- val &= ~TYPE_FIELD_ENUMVAL (type, i);
+ val &= ~type->field (i).loc_enumval ();
fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
}