Introduce typeid_operation
[deliverable/binutils-gdb.git] / gdb / gnu-v2-abi.c
index d4cf6b95629c8152d376432a99ee3e5c85c335f6..466ae6c080279869c45ee19ac16bc9e2c39f2dbf 100644 (file)
@@ -1,6 +1,6 @@
 /* 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>
 
@@ -29,7 +29,7 @@
 #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 *);
 
@@ -136,13 +136,13 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
       && 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
@@ -230,7 +230,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
     {
       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.
@@ -262,26 +262,26 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
   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;
@@ -312,7 +312,7 @@ vb_match (struct type *type, int index, struct type *basetype)
 
   /* 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".  */
@@ -348,11 +348,11 @@ gnuv2_baseclass_offset (struct type *type, int index,
   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))
@@ -362,7 +362,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
              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);
 
This page took 0.028617 seconds and 4 git commands to generate.