Remove some type field accessor macros

This removes TYPE_FIELD_PRIVATE, TYPE_FIELD_PROTECTED,
TYPE_FIELD_IGNORE, and TYPE_FIELD_VIRTUAL.

In c-varobj.c, match_accessibility can be removed entirely now.  Note
that the comment before this function was incorrect.

Acked-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Keith Seitz <keiths@redhat.com>
This commit is contained in:
Tom Tromey
2023-09-21 10:36:23 -06:00
parent a3e9fbf7e8
commit 20aadb931d
9 changed files with 40 additions and 60 deletions

View File

@@ -647,16 +647,18 @@ cplus_class_num_children (struct type *type, int children[3])
vptr_fieldno = get_vptr_fieldno (type, &basetype);
for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); i++)
{
field &fld = type->field (i);
/* If we have a virtual table pointer, omit it. Even if virtual
table pointers are not specifically marked in the debug info,
they should be artificial. */
if ((type == basetype && i == vptr_fieldno)
|| type->field (i).is_artificial ())
|| fld.is_artificial ())
continue;
if (TYPE_FIELD_PROTECTED (type, i))
if (fld.is_protected ())
children[v_protected]++;
else if (TYPE_FIELD_PRIVATE (type, i))
else if (fld.is_private ())
children[v_private]++;
else
children[v_public]++;
@@ -669,23 +671,6 @@ cplus_name_of_variable (const struct varobj *parent)
return c_name_of_variable (parent);
}
/* Check if field INDEX of TYPE has the specified accessibility.
Return 0 if so and 1 otherwise. */
static int
match_accessibility (struct type *type, int index, enum accessibility acc)
{
if (acc == accessibility::PRIVATE && TYPE_FIELD_PRIVATE (type, index))
return 1;
else if (acc == accessibility::PROTECTED && TYPE_FIELD_PROTECTED (type, index))
return 1;
else if (acc == accessibility::PUBLIC && !TYPE_FIELD_PRIVATE (type, index)
&& !TYPE_FIELD_PROTECTED (type, index))
return 1;
else
return 0;
}
static void
cplus_describe_child (const struct varobj *parent, int index,
std::string *cname, struct value **cvalue, struct type **ctype,
@@ -751,9 +736,9 @@ cplus_describe_child (const struct varobj *parent, int index,
if ((type == basetype && type_index == vptr_fieldno)
|| type->field (type_index).is_artificial ())
; /* ignore vptr */
else if (match_accessibility (type, type_index, acc))
--index;
++type_index;
else if (type->field (type_index).accessibility () == acc)
--index;
++type_index;
}
--type_index;