doc/gdbinv-s.m4.in: remove text on special procedures to continue after
[deliverable/binutils-gdb.git] / gdb / gdbtypes.h
index fa1eb73bd9ff8d11d51ab5e39f4cdbbc54f88b69..95f40359e44d5213522524f16c905daa023f35e6 100644 (file)
@@ -83,6 +83,12 @@ enum type_code
   TYPE_CODE_BOOL               /* Builtin Modula-2 BOOLEAN */
 };
 
+/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
+   alias for TYPE_CODE_STRUCT.  Eventually these should probably be
+   officially distinct types within gdb. */
+
+#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
+
 /* Some bits for the type's flags word. */
 
 /* Explicitly unsigned integer type */
@@ -171,6 +177,9 @@ struct type
      For range types, there are two "fields",
      the minimum and maximum values (both inclusive).
      For enum types, each possible value is described by one "field".
+     For C++ classes, there is one field for each base class (if it is
+     a derived class) plus one field for each class data member.  Member
+     functions are recorded elsewhere.
 
      Using a pointer to a separate array of fields
      allows all types to have the same size, which is useful
@@ -260,10 +269,17 @@ struct cplus_struct_type
 
   int nfn_fields_total;
 
-  /* For derived classes, the number of base classes is given by
-     n_baseclasses and virtual_field_bits is a bit vector containing one bit
-     per base class.
-     If the base class is virtual, the corresponding bit will be set. */
+  /* For derived classes, the number of base classes is given by n_baseclasses
+     and virtual_field_bits is a bit vector containing one bit per base class.
+     If the base class is virtual, the corresponding bit will be set.
+     I.E, given:
+
+       class A{};
+       class B{};
+       class C : public B, public virtual A {};
+
+     B is a baseclass of C; A is a virtual baseclass for C.
+     This is a C++ 2.0 language feature. */
 
   B_TYPE *virtual_field_bits;
 
@@ -497,6 +513,20 @@ extern struct type *builtin_type_m2_bool;
    TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
     : MIN_OF_SIZE(TYPE_LENGTH(t))
 
+/* Allocate space for storing data associated with a particular type.
+   We ensure that the space is allocated using the same mechanism that
+   was used to allocate the space for the type structure itself.  I.E.
+   if the type is on an objfile's type_obstack, then the space for data
+   associated with that type will also be allocated on the type_obstack.
+   If the type is not associated with any particular objfile (such as
+   builtin types), then the data space will be allocated with xmalloc,
+   the same as for the type structure. */
+
+#define TYPE_ALLOC(t,size)  \
+   (TYPE_OBJFILE (t) != NULL  \
+    ? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \
+    : xmalloc (size))
+
 extern struct type *
 alloc_type PARAMS ((struct objfile *));
 
This page took 0.024382 seconds and 4 git commands to generate.