/* Abstraction of GNU v2 abi.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@redhat.com>
#include "cp-support.h"
#include <ctype.h>
-struct cp_abi_ops gnu_v2_abi_ops;
+static cp_abi_ops gnu_v2_abi_ops;
static int vb_match (struct type *, int, struct type *);
&& TYPE_TARGET_TYPE (value_type (vtbl))->code () == TYPE_CODE_ARRAY)
{
/* Handle the case where the vtbl field points to an
- array of structures. */
+ array of structures. */
vtbl = value_ind (vtbl);
/* Index into the virtual function table. This is hard-coded because
- looking up a field is not cheap, and it may be important to save
- time, e.g. if the user has set a conditional breakpoint calling
- a virtual function. */
+ looking up a field is not cheap, and it may be important to save
+ time, e.g. if the user has set a conditional breakpoint calling
+ a virtual function. */
entry = value_subscript (vtbl, vi);
}
else
{
v = value_cast (btype, v);
if (using_enc)
- *using_enc=1;
+ *using_enc=1;
}
/* We can't use value_ind here, because it would want to use RTTI, and
we'd waste a bunch of time figuring out we already know the type.
if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1)
{
if (top)
- *top = TYPE_BASECLASS_BITPOS (rtti_type,
+ *top = TYPE_BASECLASS_BITPOS (rtti_type,
TYPE_VPTR_FIELDNO(rtti_type)) / 8;
if (top && ((*top) >0))
- {
- if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
- {
- if (full)
- *full=0;
- }
- else
- {
- if (full)
- *full=1;
- }
- }
+ {
+ if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
+ {
+ if (full)
+ *full=0;
+ }
+ else
+ {
+ if (full)
+ *full=1;
+ }
+ }
}
else
{
if (full)
- *full=1;
+ *full=1;
}
return rtti_type;
/* It's a virtual baseclass pointer, now we just need to find out whether
it is for this baseclass. */
- fieldtype = TYPE_FIELD_TYPE (type, index);
+ fieldtype = type->field (index).type ();
if (fieldtype == NULL
|| fieldtype->code () != TYPE_CODE_PTR)
/* "Can't happen". */
if (BASETYPE_VIA_VIRTUAL (type, index))
{
/* Must hunt for the pointer to this virtual baseclass. */
- int i, len = TYPE_NFIELDS (type);
+ int i, len = type->num_fields ();
int n_baseclasses = TYPE_N_BASECLASSES (type);
/* First look for the virtual baseclass pointer
- in the fields. */
+ in the fields. */
for (i = n_baseclasses; i < len; i++)
{
if (vb_match (type, i, basetype))
int field_length;
CORE_ADDR addr;
- field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
+ field_type = check_typedef (type->field (i).type ());
field_offset = TYPE_FIELD_BITPOS (type, i) / 8;
field_length = TYPE_LENGTH (field_type);