+/* Internal routine called by TYPE_VPTR_FIELDNO to return the value of
+ cplus_stuff.vptr_fieldno.
+
+ cplus_stuff is initialized to cplus_struct_default which does not
+ set vptr_fieldno to -1 for portability reasons (IWBN to use C99
+ designated initializers). We cope with that here. */
+
+int
+internal_type_vptr_fieldno (struct type *type)
+{
+ type = check_typedef (type);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION);
+ if (!HAVE_CPLUS_STRUCT (type))
+ return -1;
+ return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno;
+}
+
+/* Set the value of cplus_stuff.vptr_fieldno. */
+
+void
+set_type_vptr_fieldno (struct type *type, int fieldno)
+{
+ type = check_typedef (type);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION);
+ if (!HAVE_CPLUS_STRUCT (type))
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
+ TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno = fieldno;
+}
+
+/* Internal routine called by TYPE_VPTR_BASETYPE to return the value of
+ cplus_stuff.vptr_basetype. */
+
+struct type *
+internal_type_vptr_basetype (struct type *type)
+{
+ type = check_typedef (type);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF);
+ return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype;
+}
+
+/* Set the value of cplus_stuff.vptr_basetype. */
+
+void
+set_type_vptr_basetype (struct type *type, struct type *basetype)
+{
+ type = check_typedef (type);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION);
+ if (!HAVE_CPLUS_STRUCT (type))
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
+ TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype = basetype;
+}
+