struct type *struct_type = check_typedef ((struct type *) type);
for (fieldno = 0; fieldno < struct_type->num_fields (); fieldno++)
- if (field_name_match (TYPE_FIELD_NAME (struct_type, fieldno), field_name))
+ if (field_name_match (struct_type->field (fieldno).name (), field_name))
return fieldno;
if (!maybe_missing)
is not equal to the field name. */
if (index_desc_type->field (0).type ()->name () != NULL
&& strcmp (index_desc_type->field (0).type ()->name (),
- TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
+ index_desc_type->field (0).name ()) == 0)
return;
/* Fixup each field of INDEX_DESC_TYPE. */
for (i = 0; i < index_desc_type->num_fields (); i++)
{
- const char *name = TYPE_FIELD_NAME (index_desc_type, i);
+ const char *name = index_desc_type->field (i).name ();
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
if (raw_type)
suffix). */
for (i = 0; i < type1->num_fields (); i++)
{
- const char *name_1 = TYPE_FIELD_NAME (type1, i);
- const char *name_2 = TYPE_FIELD_NAME (type2, i);
+ const char *name_1 = type1->field (i).name ();
+ const char *name_2 = type2->field (i).name ();
int len_1 = strlen (name_1);
int len_2 = strlen (name_2);
- ada_remove_trailing_digits (TYPE_FIELD_NAME (type1, i), &len_1);
- ada_remove_trailing_digits (TYPE_FIELD_NAME (type2, i), &len_2);
+ ada_remove_trailing_digits (type1->field (i).name (), &len_1);
+ ada_remove_trailing_digits (type2->field (i).name (), &len_2);
if (len_1 != len_2
- || strncmp (TYPE_FIELD_NAME (type1, i),
- TYPE_FIELD_NAME (type2, i),
+ || strncmp (type1->field (i).name (),
+ type2->field (i).name (),
len_1) != 0)
return 0;
}
/* Check the name of that field. */
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
/* Anonymous field names should not be printed.
brobecker/2007-02-20: I don't think this can actually happen
int
ada_is_parent_field (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num);
+ const char *name = ada_check_typedef (type)->field (field_num).name ();
return (name != NULL
&& (startswith (name, "PARENT")
int
ada_is_wrapper_field (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
if (name != NULL && strcmp (name, "RETVAL") == 0)
{
static int
ada_is_others_clause (struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
return (name != NULL && name[0] == 'O');
}
static int
ada_in_variant (LONGEST val, struct type *type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
int p;
p = 0;
{
int bit_pos = TYPE_FIELD_BITPOS (type, i);
int fld_offset = offset + bit_pos / 8;
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name == NULL)
continue;
type = ada_check_typedef (type);
for (i = 0; i < type->num_fields (); i += 1)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name == NULL)
continue;
for (i = 0; i < type->num_fields (); i += 1)
{
- if (TYPE_FIELD_NAME (type, i) == NULL)
+ if (type->field (i).name () == NULL)
continue;
else if (ada_is_wrapper_field (type, i))
{
for (i = 0; i < type->num_fields (); i += 1)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
struct type *t;
if (t_field_name == NULL)
NOT wrapped in a struct, since the compiler sometimes
generates these for unchecked variant types. Revisit
if the compiler changes this practice. */
- const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
+ const char *v_field_name = field_type->field (j).name ();
if (v_field_name != NULL
&& field_name_match (v_field_name, name))
static unsigned int
field_alignment (struct type *type, int f)
{
- const char *name = TYPE_FIELD_NAME (type, f);
+ const char *name = type->field (f).name ();
int len;
int align_offset;
static int
is_dynamic_field (struct type *templ_type, int field_num)
{
- const char *name = TYPE_FIELD_NAME (templ_type, field_num);
+ const char *name = templ_type->field (field_num).name ();
return name != NULL
&& templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
ada_ensure_varsize_limit (field_type);
rtype->field (f).set_type (field_type);
- rtype->field (f).set_name (TYPE_FIELD_NAME (type, f));
+ rtype->field (f).set_name (type->field (f).name ());
/* The multiplication can potentially overflow. But because
the field length has been size-checked just above, and
assuming that the maximum size is a reasonable value,
to distinguish between the two options. Stripping it
would prevent us from printing this field appropriately. */
rtype->field (f).set_type (type->field (f).type ());
- rtype->field (f).set_name (TYPE_FIELD_NAME (type, f));
+ 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);
TYPE_LENGTH (type) = 0;
}
type->field (f).set_type (new_type);
- type->field (f).set_name (TYPE_FIELD_NAME (type0, f));
+ type->field (f).set_name (type0->field (f).name ());
}
}
return (type->code () == TYPE_CODE_STRUCT
&& type->num_fields () == 1
- && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
+ && strcmp (type->field (0).name (), "F") == 0);
}
/* If there is an ___XVS-convention type parallel to SUBTYPE, return
/* This is an older encoding form where the base type needs to be
looked up by name. We prefer the newer encoding because it is
more efficient. */
- raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
+ raw_real_type = ada_find_any_type (real_type_namer->field (0).name ());
if (raw_real_type == NULL)
return raw_type;
else
have a name like "pkg__QUxx". This is safe enough because we
already have the correct type, and because mangling means
there can't be clashes. */
- const char *ename = TYPE_FIELD_NAME (type, f);
+ const char *ename = type->field (f).name ();
size_t elen = strlen (ename);
if (elen >= len && strcmp (name, ename + elen - len) == 0)
if (i)
fprintf_filtered (stream, ", ");
wrap_here (" ");
- fputs_styled (ada_enum_name (TYPE_FIELD_NAME (type, i)),
+ fputs_styled (ada_enum_name (type->field (i).name ()),
variable_name_style.style (), stream);
if (lastval != TYPE_FIELD_ENUMVAL (type, i))
{
{
int have_output;
int p;
- const char *name = TYPE_FIELD_NAME (type, field_num);
+ const char *name = type->field (field_num).name ();
have_output = 0;
flds += 1;
fprintf_filtered (stream, "\n%*s", level + 4, "");
ada_print_type (type->field (i).type (),
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";");
}
name = "?";
else
{
- name = TYPE_FIELD_NAME (type, part.discriminant_index);
+ name = type->field (part.discriminant_index).name ();;
discr_type = type->field (part.discriminant_index).type ();
}
fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "",
level + 12, "");
ada_print_type (type->field (i).type (),
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
stream, show - 1, level + 12, flags);
fprintf_filtered (stream, ";");
}
}
if (i < len)
{
- fputs_styled (ada_enum_name (TYPE_FIELD_NAME (type, i)),
+ fputs_styled (ada_enum_name (type->field (i).name ()),
variable_name_style.style (), stream);
}
else
annotate_field_begin (type->field (i).type ());
fprintf_filtered (stream, "%.*s",
- ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
- TYPE_FIELD_NAME (type, i));
+ ada_name_prefix_len (type->field (i).name ()),
+ type->field (i).name ());
annotate_field_name_end ();
fputs_filtered (" => ", stream);
annotate_field_value ();
if (i < len)
{
- const char *name = ada_enum_name (TYPE_FIELD_NAME (type, i));
+ const char *name = ada_enum_name (type->field (i).name ());
if (name[0] == '\'')
fprintf_filtered (stream, "%ld %ps", (long) val,
name, except that we need to strip suffixes from it.
For instance, fields with alignment constraints will
have an __XVA suffix added to them. */
- const char *field_name = TYPE_FIELD_NAME (parent_type, fieldno);
+ const char *field_name = parent_type->field (fieldno).name ();
int child_name_len = ada_name_prefix_len (field_name);
*child_name = string_printf ("%.*s", child_name_len, field_name);
name, except that we need to strip suffixes from it.
For instance, fields with alignment constraints will
have an __XVA suffix added to them. */
- const char *field_name = TYPE_FIELD_NAME (parent_type, fieldno);
+ const char *field_name = parent_type->field (fieldno).name ();
int child_name_len = ada_name_prefix_len (field_name);
*child_path_expr =
for (i = type->num_fields () - 1; i >= nbases; i--)
{
- const char *this_name = TYPE_FIELD_NAME (type, i);
+ const char *this_name = type->field (i).name ();
if (this_name)
{
for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
- const char *t_field_name = TYPE_FIELD_NAME (t, i);
+ const char *t_field_name = t->field (i).name ();
if (t_field_name && strcmp (t_field_name, fieldname) == 0)
{
}
c_print_type_1 (type->field (i).type (),
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
stream, newshow, level + 4,
language, &local_flags, &local_podata);
if (i)
fprintf_filtered (stream, ", ");
wrap_here (" ");
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
if (lastval != TYPE_FIELD_ENUMVAL (type, i))
{
/* We pass "show" here and not "show - 1" to get enum types
printed. There's no other way to see them. */
c_print_type_1 (type->field (i).type (),
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
stream, show, level + 4,
language, &local_flags, podata);
fprintf_filtered (stream, " @%s",
const char *field_name;
gdb_assert (var->index < parent_type->num_fields ());
- field_name = TYPE_FIELD_NAME (parent_type, var->index);
+ field_name = parent_type->field (var->index).name ();
return !(field_name == NULL || *field_name == '\0');
}
}
/* If the type is anonymous and the field has no name,
set an appropriate name. */
- field_name = TYPE_FIELD_NAME (type, index);
+ field_name = type->field (index).name ();
if (field_name == NULL || *field_name == '\0')
{
if (cname)
/* If the type is anonymous and the field has no name,
set an appropriate name. */
- field_name = TYPE_FIELD_NAME (type, type_index);
+ field_name = type->field (type_index).name ();
if (field_name == NULL || *field_name == '\0')
{
if (cname)
else
{
if (cname)
- *cname = TYPE_FIELD_NAME (type, type_index);
+ *cname = type->field (type_index).name ();
if (cfull_expression)
*cfull_expression
{
/* This is a baseclass. */
if (cname)
- *cname = TYPE_FIELD_NAME (type, index);
+ *cname = type->field (index).name ();
if (cvalue && value)
*cvalue = value_cast (type->field (index).type (), value);
'class' keyword. See PR mi/11912 */
*cfull_expression = string_printf ("(%s(class %s%s) %s)",
ptr,
- TYPE_FIELD_NAME (type, index),
+ type->field (index).name (),
ptr,
parent_expression);
}
if (bitsize == 0)
bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
context->plugin ().build_add_field (result,
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
field_type,
bitsize,
TYPE_FIELD_BITPOS (type, i));
for (i = 0; i < type->num_fields (); ++i)
{
context->plugin ().build_add_enum_constant
- (result, TYPE_FIELD_NAME (type, i), TYPE_FIELD_ENUMVAL (type, i));
+ (result, type->field (i).name (), TYPE_FIELD_ENUMVAL (type, i));
}
context->plugin ().finish_enum_type (result);
{
for (int i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
{
- const char *field_name = TYPE_FIELD_NAME (type, i);
+ const char *field_name = type->field (i).name ();
if (TYPE_FIELD_IGNORE (type, i)
|| TYPE_FIELD_ARTIFICIAL (type, i))
for (int i = 0; i < type->num_fields (); ++i)
{
gdb::unique_xmalloc_ptr<char> fname
- = compile_cplus_instance::decl_name (TYPE_FIELD_NAME (type, i));
+ = compile_cplus_instance::decl_name (type->field (i).name ());
if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_ENUMVAL
|| fname == nullptr)
for (fieldno = 0; fieldno < regs_type->num_fields (); fieldno++)
{
- const char *reg_name = TYPE_FIELD_NAME (regs_type, fieldno);
+ const char *reg_name = regs_type->field (fieldno).name ();
ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno);
ULONGEST reg_offset;
if (i < TYPE_N_BASECLASSES (type))
add_struct_fields (TYPE_BASECLASS (type, i),
output, fieldname, namelen);
- else if (TYPE_FIELD_NAME (type, i))
+ else if (type->field (i).name ())
{
- if (TYPE_FIELD_NAME (type, i)[0] != '\0')
+ if (type->field (i).name ()[0] != '\0')
{
- if (! strncmp (TYPE_FIELD_NAME (type, i),
+ if (! strncmp (type->field (i).name (),
fieldname, namelen))
- output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i)));
+ output.emplace_back (xstrdup (type->field (i).name ()));
}
else if (type->field (i).type ()->code () == TYPE_CODE_UNION)
{
{
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream,
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
current_language->la_language,
DMGL_PARAMS | DMGL_ANSI);
}
else
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
annotate_field_name_end ();
/* Do not print leading '=' in case of anonymous
unions. */
- if (strcmp (TYPE_FIELD_NAME (type, i), ""))
+ if (strcmp (type->field (i).name (), ""))
fputs_filtered (" = ", stream);
else
{
else
c_type_print_base (self_type, stream, 0, 0, &type_print_raw_options);
fprintf_filtered (stream, "::");
- fputs_styled (TYPE_FIELD_NAME (self_type, fieldno),
+ fputs_styled (self_type->field (fieldno).name (),
variable_name_style.style (), stream);
}
else
{
if (type->num_fields () == 2
&& type->field (0).type ()->code () == TYPE_CODE_INT
- && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
- && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0
+ && strcmp (type->field (0).name (), "length") == 0
+ && strcmp (type->field (1).name (), "ptr") == 0
&& !value_bits_any_optimized_out (val,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
#define RUST_ENUM_PREFIX "RUST$ENCODED$ENUM$"
if (type->num_fields () == 1
- && startswith (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX))
+ && startswith (type->field (0).name (), RUST_ENUM_PREFIX))
{
- const char *name = TYPE_FIELD_NAME (type, 0) + strlen (RUST_ENUM_PREFIX);
+ const char *name = type->field (0).name () + strlen (RUST_ENUM_PREFIX);
/* Decode the field name to find the offset of the
discriminant. */
{
complaint (_("Could not parse Rust enum encoding string \"%s\""
"[in module %s]"),
- TYPE_FIELD_NAME (type, 0),
+ type->field (0).name (),
objfile_name (objfile));
return;
}
(rust_last_path_segment (type->field (1).type ()->name ()));
type->field (1).type ()->set_name
(rust_fully_qualify (&objfile->objfile_obstack, type->name (),
- TYPE_FIELD_NAME (type, 1)));
+ type->field (1).name ()));
const char *dataless_name
= rust_fully_qualify (&objfile->objfile_obstack, type->name (),
}
/* A union with a single anonymous field is probably an old-style
univariant enum. */
- else if (type->num_fields () == 1 && streq (TYPE_FIELD_NAME (type, 0), ""))
+ else if (type->num_fields () == 1 && streq (type->field (0).name (), ""))
{
/* Smash this type to be a structure type. We have to do this
because the type has already been recorded. */
/* Could be data-less variant, so keep going. */
disr_type = nullptr;
}
- else if (strcmp (TYPE_FIELD_NAME (disr_type, 0),
+ else if (strcmp (disr_type->field (0).name (),
"RUST$ENUM$DISR") != 0)
{
/* Not a Rust enum. */
if (TYPE_FIELD_LOC_KIND (enum_type, i) == FIELD_LOC_KIND_ENUMVAL)
{
const char *name
- = rust_last_path_segment (TYPE_FIELD_NAME (enum_type, i));
+ = rust_last_path_segment (enum_type->field (i).name ());
discriminant_map[name] = TYPE_FIELD_ENUMVAL (enum_type, i);
}
}
return;
/* Check for __pfn and __delta members. */
- if (TYPE_FIELD_NAME (type, 0) == NULL
- || strcmp (TYPE_FIELD_NAME (type, 0), "__pfn") != 0
- || TYPE_FIELD_NAME (type, 1) == NULL
- || strcmp (TYPE_FIELD_NAME (type, 1), "__delta") != 0)
+ if (type->field (0).name () == NULL
+ || strcmp (type->field (0).name (), "__pfn") != 0
+ || type->field (1).name () == NULL
+ || strcmp (type->field (1).name (), "__delta") != 0)
return;
/* Find the type of the method. */
return;
/* Check for P_ARRAY and P_BOUNDS members. */
- if (TYPE_FIELD_NAME (type, 0) == NULL
- || strcmp (TYPE_FIELD_NAME (type, 0), "P_ARRAY") != 0
- || TYPE_FIELD_NAME (type, 1) == NULL
- || strcmp (TYPE_FIELD_NAME (type, 1), "P_BOUNDS") != 0)
+ if (type->field (0).name () == NULL
+ || strcmp (type->field (0).name (), "P_ARRAY") != 0
+ || type->field (1).name () == NULL
+ || strcmp (type->field (1).name (), "P_BOUNDS") != 0)
return;
/* Make sure we're looking at a pointer to an array. */
i >= TYPE_N_BASECLASSES (t);
--i)
{
- const char *fieldname = TYPE_FIELD_NAME (t, i);
+ const char *fieldname = t->field (i).name ();
if (is_vtable_name (fieldname, cu))
{
i >= TYPE_N_BASECLASSES (type);
--i)
{
- if (strcmp (TYPE_FIELD_NAME (type, i), "__vfp") == 0)
+ if (strcmp (type->field (i).name (), "__vfp") == 0)
{
set_type_vptr_fieldno (type, i);
set_type_vptr_basetype (type, type);
error (_("too many initializers"));
field_type = struct_type->field (fieldno).type ();
if (field_type->code () == TYPE_CODE_UNION
- && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
+ && struct_type->field (fieldno).name ()[0] == '0')
error (_("don't know which variant you want to set"));
/* Here, struct_type is the type of the inner struct,
f_type_print_base (type->field (index).type (), stream,
show - 1, level + 4);
fputs_filtered (" :: ", stream);
- fputs_styled (TYPE_FIELD_NAME (type, index),
+ fputs_styled (type->field (index).name (),
variable_name_style.style (), stream);
f_type_print_varspec_suffix (type->field (index).type (),
stream, show - 1, 0, 0, 0, false);
if (printed_field > 0)
fputs_filtered (", ", stream);
- field_name = TYPE_FIELD_NAME (type, index);
+ field_name = type->field (index).name ();
if (field_name != NULL)
{
fputs_styled (field_name, variable_name_style.style (),
for (i = type->num_fields () - 1; i >= TYPE_N_BASECLASSES (type); i--)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
|| FIELD_BITSIZE (*field1) != FIELD_BITSIZE (*field2)
|| FIELD_LOC_KIND (*field1) != FIELD_LOC_KIND (*field2))
return false;
- if (!compare_maybe_null_strings (FIELD_NAME (*field1),
- FIELD_NAME (*field2)))
+ if (!compare_maybe_null_strings (field1->name (), field2->name ()))
return false;
switch (FIELD_LOC_KIND (*field1))
{
TYPE_FIELD_BITSIZE (type, idx));
gdb_print_host_address (type->field (idx).type (), gdb_stdout);
printf_filtered (" name '%s' (",
- TYPE_FIELD_NAME (type, idx) != NULL
- ? TYPE_FIELD_NAME (type, idx)
+ type->field (idx).name () != NULL
+ ? type->field (idx).name ()
: "<NULL>");
- gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
+ gdb_print_host_address (type->field (idx).name (), gdb_stdout);
printf_filtered (")\n");
if (type->field (idx).type () != NULL)
{
new_type->field (i).set_type
(copy_type_recursive (objfile, type->field (i).type (),
copied_types));
- if (TYPE_FIELD_NAME (type, i))
- new_type->field (i).set_name (xstrdup (TYPE_FIELD_NAME (type, i)));
+ if (type->field (i).name ())
+ new_type->field (i).set_name (xstrdup (type->field (i).name ()));
switch (TYPE_FIELD_LOC_KIND (type, i))
{
case FIELD_LOC_KIND_BITPOS:
#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
-#define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
+#define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
#define BASETYPE_VIA_PUBLIC(thistype, index) \
((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define FIELD_NAME(thisfld) ((thisfld).name ())
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
#define FIELD_BITPOS(thisfld) (FIELD_BITPOS_LVAL (thisfld) + 0)
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
-#define TYPE_FIELD_NAME(thistype, n) ((thistype)->field (n).name ())
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL ((thistype)->field (n))
vb_match (struct type *type, int index, struct type *basetype)
{
struct type *fieldtype;
- const char *name = TYPE_FIELD_NAME (type, index);
+ const char *name = type->field (index).name ();
const char *field_class_name = NULL;
if (*name != '_')
type1 = check_typedef (type1);
if (type0->code () == TYPE_CODE_PTR
- && strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0
+ && strcmp (type->field (0).name (), "__data") == 0
&& type1->code () == TYPE_CODE_INT
- && strcmp (TYPE_FIELD_NAME (type, 1), "__length") == 0)
+ && strcmp (type->field (1).name (), "__length") == 0)
{
struct type *target_type = TYPE_TARGET_TYPE (type0);
for (int i = 0; i < type->num_fields (); i++)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, field.get ()) == 0))
{
for (int i = 0; i < type->num_fields (); i++)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, field.get ()) == 0))
return SCM_BOOL_T;
= tyscm_get_field_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct field *field = tyscm_field_smob_to_field (f_smob);
- if (FIELD_NAME (*field))
- return gdbscm_scm_from_c_string (FIELD_NAME (*field));
+ if (field->name () != nullptr)
+ return gdbscm_scm_from_c_string (field->name ());
return SCM_BOOL_F;
}
return 0;
if (type->field (i).type ()->code () != TYPE_CODE_SET)
return 0;
- if (TYPE_FIELD_NAME (type, i) != NULL
- && (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
+ if (type->field (i).name () != NULL
+ && (strcmp (type->field (i).name (), "") != 0))
return 0;
range = type->field (i).type ()->index_type ();
if ((i > TYPE_N_BASECLASSES (type))
*/
if (type->num_fields () != 2)
return 0;
- if (strcmp (TYPE_FIELD_NAME (type, 0), "_m2_contents") != 0)
+ if (strcmp (type->field (0).name (), "_m2_contents") != 0)
return 0;
- if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0)
+ if (strcmp (type->field (1).name (), "_m2_high") != 0)
return 0;
if (type->field (0).type ()->code () != TYPE_CODE_PTR)
return 0;
QUIT;
print_spaces_filtered (level + 4, stream);
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
fputs_filtered (" : ", stream);
m2_print_type (type->field (i).type (),
if (i > 0)
fprintf_filtered (stream, ", ");
wrap_here (" ");
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
if (lastval != TYPE_FIELD_ENUMVAL (type, i))
{
/* Old Borland type pascal strings from Free Pascal Compiler. */
/* Two fields: length and st. */
if (type->num_fields () == 2
- && TYPE_FIELD_NAME (type, 0)
- && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
- && TYPE_FIELD_NAME (type, 1)
- && strcmp (TYPE_FIELD_NAME (type, 1), "st") == 0)
+ && type->field (0).name ()
+ && strcmp (type->field (0).name (), "length") == 0
+ && type->field (1).name ()
+ && strcmp (type->field (1).name (), "st") == 0)
{
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
if (char_type)
*char_type = TYPE_TARGET_TYPE (type->field (1).type ());
if (arrayname)
- *arrayname = TYPE_FIELD_NAME (type, 1);
+ *arrayname = type->field (1).name ();
return 2;
};
/* GNU pascal strings. */
/* Three fields: Capacity, length and schema$ or _p_schema. */
if (type->num_fields () == 3
- && TYPE_FIELD_NAME (type, 0)
- && strcmp (TYPE_FIELD_NAME (type, 0), "Capacity") == 0
- && TYPE_FIELD_NAME (type, 1)
- && strcmp (TYPE_FIELD_NAME (type, 1), "length") == 0)
+ && type->field (0).name ()
+ && strcmp (type->field (0).name (), "Capacity") == 0
+ && type->field (1).name ()
+ && strcmp (type->field (1).name (), "length") == 0)
{
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
*char_type = TYPE_TARGET_TYPE (*char_type);
}
if (arrayname)
- *arrayname = TYPE_FIELD_NAME (type, 2);
+ *arrayname = type->field (2).name ();
return 3;
};
}
{
QUIT;
/* Don't print out virtual function table. */
- if ((startswith (TYPE_FIELD_NAME (type, i), "_vptr"))
- && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
+ if ((startswith (type->field (i).name (), "_vptr"))
+ && is_cplus_marker ((type->field (i).name ())[5]))
continue;
/* If this is a pascal object or class we can print the
if (field_is_static (&type->field (i)))
fprintf_filtered (stream, "static ");
print_type (type->field (i).type (),
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
stream, show - 1, level + 4, flags);
if (!field_is_static (&type->field (i))
&& TYPE_FIELD_PACKED (type, i))
if (i)
fprintf_filtered (stream, ", ");
wrap_here (" ");
- fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
+ fputs_filtered (type->field (i).name (), stream);
if (lastval != TYPE_FIELD_ENUMVAL (type, i))
{
fprintf_filtered (stream,
{
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream,
- TYPE_FIELD_NAME (type, i),
+ type->field (i).name (),
current_language->la_language,
DMGL_PARAMS | DMGL_ANSI);
}
else
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
annotate_field_name_end ();
fputs_filtered (" = ", stream);
}
arg.reset (NULL);
- if (TYPE_FIELD_NAME (type, field))
+ if (type->field (field).name ())
{
- const char *field_name = TYPE_FIELD_NAME (type, field);
+ const char *field_name = type->field (field).name ();
if (field_name[0] != '\0')
{
- arg.reset (PyString_FromString (TYPE_FIELD_NAME (type, field)));
+ arg.reset (PyString_FromString (type->field (field).name ()));
if (arg == NULL)
return NULL;
}
{
gdbpy_ref<> result;
- if (TYPE_FIELD_NAME (type, field))
- result.reset (PyString_FromString (TYPE_FIELD_NAME (type, field)));
+ if (type->field (field).name ())
+ result.reset (PyString_FromString (type->field (field).name ()));
else
result = gdbpy_ref<>::new_reference (Py_None);
for (i = 0; i < type->num_fields (); i++)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, field.get ()) == 0))
return convert_field (type, i).release ();
for (i = 0; i < type->num_fields (); i++)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
Py_RETURN_TRUE;
char buf[20];
xsnprintf (buf, sizeof (buf), "__%d", field_number);
- if (strcmp (buf, TYPE_FIELD_NAME (type, i)) != 0)
+ if (strcmp (buf, type->field (i).name ()) != 0)
return false;
field_number++;
}
return true;
i = 0;
- if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
+ if (strcmp (type->field (0).name (), "start") == 0)
{
if (type->num_fields () == 1)
return true;
return false;
}
- return strcmp (TYPE_FIELD_NAME (type, i), "end") == 0;
+ return strcmp (type->field (i).name (), "end") == 0;
}
/* Return true if TYPE is an inclusive range type, otherwise false.
int vtable_field = 0;
for (int i = 0; i < 2; ++i)
{
- if (strcmp (TYPE_FIELD_NAME (type, i), "vtable") == 0)
+ if (strcmp (type->field (i).name (), "vtable") == 0)
vtable_field = i;
- else if (strcmp (TYPE_FIELD_NAME (type, i), "pointer") != 0)
+ else if (strcmp (type->field (i).name (), "pointer") != 0)
return NULL;
}
if (!is_tuple && !is_tuple_struct)
{
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
fputs_filtered (": ", stream);
}
if (!is_tuple)
fprintf_filtered (stream, "%ps: ",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (variant_type, j)));
+ variant_type->field (j).name ()));
common_val_print (value_field (val, j), stream, recurse + 1, &opts,
this);
if (!for_rust_enum || flags->print_offsets)
print_spaces_filtered (level + 2, stream);
if (is_enum)
- fputs_styled (TYPE_FIELD_NAME (type, i), variable_name_style.style (),
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
stream);
else if (!is_tuple_struct)
fprintf_filtered (stream, "%ps: ",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (type, i)));
+ type->field (i).name ()));
rust_internal_print_type (type->field (i).type (), NULL,
stream, (is_enum ? show : show - 1),
for (int i = 0; i < type->num_fields (); ++i)
{
- const char *name = TYPE_FIELD_NAME (type, i);
+ const char *name = type->field (i).name ();
QUIT;
return;
i = 0;
- if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
+ if (strcmp (type->field (0).name (), "start") == 0)
{
*kind = RANGE_HIGH_BOUND_DEFAULT;
*low = value_as_long (value_field (range, 0));
++i;
}
if (type->num_fields () > i
- && strcmp (TYPE_FIELD_NAME (type, i), "end") == 0)
+ && strcmp (type->field (i).name (), "end") == 0)
{
*kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
{
for (int i = 0; i < type->num_fields (); ++i)
{
- if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0)
+ if (strcmp (type->field (i).name (), "data_ptr") == 0)
{
base_type = TYPE_TARGET_TYPE (type->field (i).type ());
break;
i >= TYPE_N_BASECLASSES (t);
--i)
{
- const char *name = TYPE_FIELD_NAME (t, i);
+ const char *name = t->field (i).name ();
if (!strncmp (name, vptr_name, sizeof (vptr_name) - 2)
&& is_cplus_marker (name[sizeof (vptr_name) - 2]))
for (i = type->num_fields () - 1; i >= TYPE_N_BASECLASSES (type); i--)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT)
for (j = TYPE_N_BASECLASSES (t); j < t->num_fields (); j++)
- if (TYPE_FIELD_NAME (t, j))
+ if (t->field (j).name ())
completion_list_add_name (tracker, sym->language (),
- TYPE_FIELD_NAME (t, j),
+ t->field (j).name (),
lookup_name, text, word);
}
}
}
if (i < len)
{
- fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
+ fputs_filtered (type->field (i).name (), stream);
}
else
{
if (!m_looking_for_baseclass)
for (i = type->num_fields () - 1; i >= nbases; i--)
{
- const char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = type->field (i).name ();
if (t_field_name && (strcmp_iw (t_field_name, m_name) == 0))
{
for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
{
- const char *fname = TYPE_FIELD_NAME (type, i);
+ const char *fname = type->field (i).name ();
int len;
if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_ENUMVAL
for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
- const char *t_field_name = TYPE_FIELD_NAME (t, i);
+ const char *t_field_name = t->field (i).name ();
if (t_field_name && strcmp (t_field_name, name) == 0)
{
}
if (i < len)
{
- fputs_styled (TYPE_FIELD_NAME (type, i), variable_name_style.style (),
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
stream);
}
else if (type->is_flag_enum ())
fputs_filtered (" | ", stream);
val &= ~TYPE_FIELD_ENUMVAL (type, i);
- fputs_styled (TYPE_FIELD_NAME (type, i),
+ fputs_styled (type->field (i).name (),
variable_name_style.style (), stream);
}
}
fputs_filtered ("[", stream);
for (field = 0; field < nfields; field++)
{
- if (TYPE_FIELD_NAME (type, field)[0] != '\0')
+ if (type->field (field).name ()[0] != '\0')
{
struct type *field_type = type->field (field).type ();
fprintf_filtered
(stream, " %ps",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (type, field)));
+ type->field (field).name ()));
}
else
{
field_val &= ((ULONGEST) 1 << field_len) - 1;
fprintf_filtered (stream, " %ps=",
styled_string (variable_name_style.style (),
- TYPE_FIELD_NAME (type, field)));
+ type->field (field).name ()));
if (field_type->code () == TYPE_CODE_ENUM)
generic_val_print_enum_1 (field_type, field_val, stream);
else
case FIELD_LOC_KIND_PHYSNAME:
{
const char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
- /* TYPE_FIELD_NAME (type, fieldno); */
+ /* type->field (fieldno).name (); */
struct block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
if (sym.symbol == NULL)