119370Spst/* Internal type definitions for GDB.
2130803Smarcel
3130803Smarcel   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4130803Smarcel   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5130803Smarcel
619370Spst   Contributed by Cygnus Support, using pieces from other GDB modules.
719370Spst
898944Sobrien   This file is part of GDB.
919370Spst
1098944Sobrien   This program is free software; you can redistribute it and/or modify
1198944Sobrien   it under the terms of the GNU General Public License as published by
1298944Sobrien   the Free Software Foundation; either version 2 of the License, or
1398944Sobrien   (at your option) any later version.
1419370Spst
1598944Sobrien   This program is distributed in the hope that it will be useful,
1698944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1798944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1898944Sobrien   GNU General Public License for more details.
1919370Spst
2098944Sobrien   You should have received a copy of the GNU General Public License
2198944Sobrien   along with this program; if not, write to the Free Software
2298944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2398944Sobrien   Boston, MA 02111-1307, USA.  */
2419370Spst
2519370Spst#if !defined (GDBTYPES_H)
2619370Spst#define GDBTYPES_H 1
2719370Spst
2898944Sobrien/* Forward declarations for prototypes.  */
29130803Smarcelstruct field;
3098944Sobrienstruct block;
3198944Sobrien
3219370Spst/* Codes for `fundamental types'.  This is a monstrosity based on the
3319370Spst   bogus notion that there are certain compiler-independent
3419370Spst   `fundamental types'.  None of these is well-defined (how big is
3519370Spst   FT_SHORT?  Does it depend on the language?  How does the
3619370Spst   language-specific code know which type to correlate to FT_SHORT?)  */
3719370Spst
3819370Spst#define FT_VOID			0
3919370Spst#define FT_BOOLEAN		1
4098944Sobrien#define FT_CHAR			2	/* we use this for not-unsigned C/C++ chars */
4198944Sobrien#define FT_SIGNED_CHAR		3	/* we use this for C++ signed chars */
4298944Sobrien#define FT_UNSIGNED_CHAR	4	/* we use this for C/C++ unsigned chars */
4319370Spst#define FT_SHORT		5
4419370Spst#define FT_SIGNED_SHORT		6
4519370Spst#define FT_UNSIGNED_SHORT	7
4619370Spst#define FT_INTEGER		8
4719370Spst#define FT_SIGNED_INTEGER	9
4819370Spst#define FT_UNSIGNED_INTEGER	10
4919370Spst#define FT_LONG			11
5019370Spst#define FT_SIGNED_LONG		12
5119370Spst#define FT_UNSIGNED_LONG	13
5219370Spst#define FT_LONG_LONG		14
5319370Spst#define FT_SIGNED_LONG_LONG	15
5419370Spst#define FT_UNSIGNED_LONG_LONG	16
5519370Spst#define FT_FLOAT		17
5619370Spst#define FT_DBL_PREC_FLOAT	18
5719370Spst#define FT_EXT_PREC_FLOAT	19
5819370Spst#define FT_COMPLEX		20
5919370Spst#define FT_DBL_PREC_COMPLEX	21
6019370Spst#define FT_EXT_PREC_COMPLEX	22
6119370Spst#define FT_STRING		23
6219370Spst#define FT_FIXED_DECIMAL	24
6319370Spst#define FT_FLOAT_DECIMAL	25
6419370Spst#define FT_BYTE			26
6519370Spst#define FT_UNSIGNED_BYTE	27
6646283Sdfr#define FT_TEMPLATE_ARG		28
6719370Spst
6846283Sdfr#define FT_NUM_MEMBERS		29	/* Highest FT_* above, plus one. */
6919370Spst
7019370Spst/* Some macros for char-based bitfields.  */
7119370Spst
7219370Spst#define B_SET(a,x)	((a)[(x)>>3] |= (1 << ((x)&7)))
7319370Spst#define B_CLR(a,x)	((a)[(x)>>3] &= ~(1 << ((x)&7)))
7419370Spst#define B_TST(a,x)	((a)[(x)>>3] & (1 << ((x)&7)))
7519370Spst#define B_TYPE		unsigned char
7619370Spst#define	B_BYTES(x)	( 1 + ((x)>>3) )
7719370Spst#define	B_CLRALL(a,x)	memset ((a), 0, B_BYTES(x))
7819370Spst
7919370Spst/* Different kinds of data types are distinguished by the `code' field.  */
8019370Spst
8119370Spstenum type_code
8298944Sobrien  {
8398944Sobrien    TYPE_CODE_UNDEF,		/* Not used; catches errors */
8498944Sobrien    TYPE_CODE_PTR,		/* Pointer type */
8598944Sobrien    TYPE_CODE_ARRAY,		/* Array type with lower & upper bounds. */
8698944Sobrien    TYPE_CODE_STRUCT,		/* C struct or Pascal record */
8798944Sobrien    TYPE_CODE_UNION,		/* C union or Pascal variant part */
8898944Sobrien    TYPE_CODE_ENUM,		/* Enumeration type */
8998944Sobrien    TYPE_CODE_FUNC,		/* Function type */
9098944Sobrien    TYPE_CODE_INT,		/* Integer type */
9119370Spst
9298944Sobrien    /* Floating type.  This is *NOT* a complex type.  Beware, there are parts
9398944Sobrien       of GDB which bogusly assume that TYPE_CODE_FLT can mean complex.  */
9498944Sobrien    TYPE_CODE_FLT,
9519370Spst
9698944Sobrien    /* Void type.  The length field specifies the length (probably always
9798944Sobrien       one) which is used in pointer arithmetic involving pointers to
9898944Sobrien       this type, but actually dereferencing such a pointer is invalid;
9998944Sobrien       a void type has no length and no actual representation in memory
10098944Sobrien       or registers.  A pointer to a void type is a generic pointer.  */
10198944Sobrien    TYPE_CODE_VOID,
10219370Spst
10398944Sobrien    TYPE_CODE_SET,		/* Pascal sets */
10498944Sobrien    TYPE_CODE_RANGE,		/* Range (integers within spec'd bounds) */
10519370Spst
10698944Sobrien    /* A string type which is like an array of character but prints
107130803Smarcel       differently (at least for (the deleted) CHILL).  It does not
108130803Smarcel       contain a length field as Pascal strings (for many Pascals,
109130803Smarcel       anyway) do; if we want to deal with such strings, we should use
110130803Smarcel       a new type code.  */
11198944Sobrien    TYPE_CODE_STRING,
11219370Spst
113130803Smarcel    /* String of bits; like TYPE_CODE_SET but prints differently (at
114130803Smarcel       least for (the deleted) CHILL).  */
11598944Sobrien    TYPE_CODE_BITSTRING,
11619370Spst
11798944Sobrien    /* Unknown type.  The length field is valid if we were able to
11898944Sobrien       deduce that much about the type, or 0 if we don't even know that.  */
11998944Sobrien    TYPE_CODE_ERROR,
12019370Spst
12198944Sobrien    /* C++ */
12298944Sobrien    TYPE_CODE_MEMBER,		/* Member type */
12398944Sobrien    TYPE_CODE_METHOD,		/* Method type */
12498944Sobrien    TYPE_CODE_REF,		/* C++ Reference types */
12519370Spst
12698944Sobrien    TYPE_CODE_CHAR,		/* *real* character type */
12719370Spst
12898944Sobrien    /* Boolean type.  0 is false, 1 is true, and other values are non-boolean
12998944Sobrien       (e.g. FORTRAN "logical" used as unsigned int).  */
13098944Sobrien    TYPE_CODE_BOOL,
13119370Spst
13298944Sobrien    /* Fortran */
13398944Sobrien    TYPE_CODE_COMPLEX,		/* Complex float */
13419370Spst
13598944Sobrien    TYPE_CODE_TYPEDEF,
13698944Sobrien    TYPE_CODE_TEMPLATE,		/* C++ template */
137130803Smarcel    TYPE_CODE_TEMPLATE_ARG,	/* C++ template arg */
13846283Sdfr
139130803Smarcel    TYPE_CODE_NAMESPACE		/* C++ namespace.  */
14098944Sobrien  };
14119370Spst
14219370Spst/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
14319370Spst   alias for TYPE_CODE_STRUCT.  This is for DWARF, which has a distinct
14419370Spst   "class" attribute.  Perhaps we should actually have a separate TYPE_CODE
14519370Spst   so that we can print "class" or "struct" depending on what the debug
14619370Spst   info said.  It's not clear we should bother.  */
14719370Spst
14819370Spst#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
14919370Spst
15098944Sobrien/* Some bits for the type's flags word, and macros to test them. */
15119370Spst
15219370Spst/* Unsigned integer type.  If this is not set for a TYPE_CODE_INT, the
15346283Sdfr   type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
15419370Spst
15519370Spst#define TYPE_FLAG_UNSIGNED	(1 << 0)
156130803Smarcel#define TYPE_UNSIGNED(t)	(TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED)
15719370Spst
15846283Sdfr/* No sign for this type.  In C++, "char", "signed char", and "unsigned
15946283Sdfr   char" are distinct types; so we need an extra flag to indicate the
16098944Sobrien   absence of a sign! */
16146283Sdfr
16246283Sdfr#define TYPE_FLAG_NOSIGN	(1 << 1)
163130803Smarcel#define TYPE_NOSIGN(t)		(TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN)
16446283Sdfr
16519370Spst/* This appears in a type's flags word if it is a stub type (e.g., if
16619370Spst   someone referenced a type that wasn't defined in a source file
16719370Spst   via (struct sir_not_appearing_in_this_film *)).  */
16819370Spst
16919370Spst#define TYPE_FLAG_STUB		(1 << 2)
170130803Smarcel#define TYPE_STUB(t)		(TYPE_FLAGS (t) & TYPE_FLAG_STUB)
17119370Spst
17219370Spst/* The target type of this type is a stub type, and this type needs to
17319370Spst   be updated if it gets un-stubbed in check_typedef.
17419370Spst   Used for arrays and ranges, in which TYPE_LENGTH of the array/range
17519370Spst   gets set based on the TYPE_LENGTH of the target type.
17619370Spst   Also, set for TYPE_CODE_TYPEDEF. */
17719370Spst
17898944Sobrien#define TYPE_FLAG_TARGET_STUB	(1 << 3)
179130803Smarcel#define TYPE_TARGET_STUB(t)	(TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB)
18019370Spst
18146283Sdfr/* Static type.  If this is set, the corresponding type had
18246283Sdfr * a static modifier.
18346283Sdfr * Note: This may be unnecessary, since static data members
18446283Sdfr * are indicated by other means (bitpos == -1)
18546283Sdfr */
18646283Sdfr
18798944Sobrien#define TYPE_FLAG_STATIC	(1 << 4)
188130803Smarcel#define TYPE_STATIC(t)		(TYPE_FLAGS (t) & TYPE_FLAG_STATIC)
18946283Sdfr
19046283Sdfr/* Constant type.  If this is set, the corresponding type has a
19146283Sdfr * const modifier.
19246283Sdfr */
19346283Sdfr
19498944Sobrien#define TYPE_FLAG_CONST		(1 << 5)
195130803Smarcel#define TYPE_CONST(t)		(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST)
19646283Sdfr
19746283Sdfr/* Volatile type.  If this is set, the corresponding type has a
19846283Sdfr * volatile modifier.
19946283Sdfr */
20046283Sdfr
20198944Sobrien#define TYPE_FLAG_VOLATILE	(1 << 6)
202130803Smarcel#define TYPE_VOLATILE(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE)
20346283Sdfr
20446283Sdfr
20546283Sdfr/* This is a function type which appears to have a prototype.  We need this
20646283Sdfr   for function calls in order to tell us if it's necessary to coerce the args,
20746283Sdfr   or to just do the standard conversions.  This is used with a short field. */
20846283Sdfr
20998944Sobrien#define TYPE_FLAG_PROTOTYPED	(1 << 7)
210130803Smarcel#define TYPE_PROTOTYPED(t)	(TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED)
21146283Sdfr
21246283Sdfr/* This flag is used to indicate that processing for this type
21346283Sdfr   is incomplete.
21498944Sobrien
21546283Sdfr   (Mostly intended for HP platforms, where class methods, for
21646283Sdfr   instance, can be encountered before their classes in the debug
21746283Sdfr   info; the incomplete type has to be marked so that the class and
21846283Sdfr   the method can be assigned correct types.) */
21946283Sdfr
22098944Sobrien#define TYPE_FLAG_INCOMPLETE	(1 << 8)
221130803Smarcel#define TYPE_INCOMPLETE(t)	(TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE)
22246283Sdfr
22398944Sobrien/* Instruction-space delimited type.  This is for Harvard architectures
22498944Sobrien   which have separate instruction and data address spaces (and perhaps
22598944Sobrien   others).
22646283Sdfr
22798944Sobrien   GDB usually defines a flat address space that is a superset of the
22898944Sobrien   architecture's two (or more) address spaces, but this is an extension
22998944Sobrien   of the architecture's model.
23098944Sobrien
23198944Sobrien   If TYPE_FLAG_INST is set, an object of the corresponding type
23298944Sobrien   resides in instruction memory, even if its address (in the extended
23398944Sobrien   flat address space) does not reflect this.
23498944Sobrien
23598944Sobrien   Similarly, if TYPE_FLAG_DATA is set, then an object of the
23698944Sobrien   corresponding type resides in the data memory space, even if
23798944Sobrien   this is not indicated by its (flat address space) address.
23898944Sobrien
23998944Sobrien   If neither flag is set, the default space for functions / methods
24098944Sobrien   is instruction space, and for data objects is data memory.  */
24198944Sobrien
24298944Sobrien#define TYPE_FLAG_CODE_SPACE	(1 << 9)
243130803Smarcel#define TYPE_CODE_SPACE(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE)
24498944Sobrien
24598944Sobrien#define TYPE_FLAG_DATA_SPACE	(1 << 10)
246130803Smarcel#define TYPE_DATA_SPACE(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE)
24798944Sobrien
248130803Smarcel/* FIXME drow/2002-06-03:  Only used for methods, but applies as well
249130803Smarcel   to functions.  */
25098944Sobrien
25198944Sobrien#define TYPE_FLAG_VARARGS	(1 << 11)
252130803Smarcel#define TYPE_VARARGS(t)		(TYPE_FLAGS (t) & TYPE_FLAG_VARARGS)
25398944Sobrien
254130803Smarcel/* Identify a vector type.  Gcc is handling this by adding an extra
255130803Smarcel   attribute to the array type.  We slurp that in as a new flag of a
256130803Smarcel   type.  This is used only in dwarf2read.c.  */
257130803Smarcel#define TYPE_FLAG_VECTOR	(1 << 12)
258130803Smarcel#define TYPE_VECTOR(t)		(TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)
25919370Spst
260130803Smarcel/* Address class flags.  Some environments provide for pointers whose
261130803Smarcel   size is different from that of a normal pointer or address types
262130803Smarcel   where the bits are interpreted differently than normal addresses.  The
263130803Smarcel   TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific
264130803Smarcel   ways to represent these different types of address classes.  */
265130803Smarcel#define TYPE_FLAG_ADDRESS_CLASS_1 (1 << 13)
266130803Smarcel#define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \
267130803Smarcel                                 & TYPE_FLAG_ADDRESS_CLASS_1)
268130803Smarcel#define TYPE_FLAG_ADDRESS_CLASS_2 (1 << 14)
269130803Smarcel#define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \
270130803Smarcel				 & TYPE_FLAG_ADDRESS_CLASS_2)
271130803Smarcel#define TYPE_FLAG_ADDRESS_CLASS_ALL (TYPE_FLAG_ADDRESS_CLASS_1 \
272130803Smarcel				     | TYPE_FLAG_ADDRESS_CLASS_2)
273130803Smarcel#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
274130803Smarcel				   & TYPE_FLAG_ADDRESS_CLASS_ALL)
27519370Spst
276244437Semaste/* Restrict type.  If this is set, the corresponding type has a
277244437Semaste * restrict modifier.
278244437Semaste */
279244437Semaste
280244437Semaste#define TYPE_FLAG_RESTRICT (1 << 17)
281244437Semaste#define TYPE_RESTRICT(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_RESTRICT)
282244437Semaste
283130803Smarcel/*  Array bound type.  */
284130803Smarcelenum array_bound_type
285130803Smarcel{
286130803Smarcel  BOUND_SIMPLE = 0,
287130803Smarcel  BOUND_BY_VALUE_IN_REG,
288130803Smarcel  BOUND_BY_REF_IN_REG,
289130803Smarcel  BOUND_BY_VALUE_ON_STACK,
290130803Smarcel  BOUND_BY_REF_ON_STACK,
291130803Smarcel  BOUND_CANNOT_BE_DETERMINED
292130803Smarcel};
29319370Spst
294130803Smarcel/* This structure is space-critical.
295130803Smarcel   Its layout has been tweaked to reduce the space used.  */
29619370Spst
297130803Smarcelstruct main_type
298130803Smarcel{
299130803Smarcel  /* Code for kind of type */
30019370Spst
301130803Smarcel  ENUM_BITFIELD(type_code) code : 8;
30219370Spst
303130803Smarcel  /* Array bounds.  These fields appear at this location because
304130803Smarcel     they pack nicely here.  */
30519370Spst
306130803Smarcel  ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
307130803Smarcel  ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
30819370Spst
309130803Smarcel  /* Name of this type, or NULL if none.
31019370Spst
311130803Smarcel     This is used for printing only, except by poorly designed C++ code.
312130803Smarcel     For looking up a name, look for a symbol in the VAR_DOMAIN.  */
31319370Spst
314130803Smarcel  char *name;
31519370Spst
316130803Smarcel  /* Tag name for this type, or NULL if none.  This means that the
317130803Smarcel     name of the type consists of a keyword followed by the tag name.
318130803Smarcel     Which keyword is determined by the type code ("struct" for
319130803Smarcel     TYPE_CODE_STRUCT, etc.).  As far as I know C/C++ are the only languages
320130803Smarcel     with this feature.
32198944Sobrien
322130803Smarcel     This is used for printing only, except by poorly designed C++ code.
323130803Smarcel     For looking up a name, look for a symbol in the STRUCT_DOMAIN.
324130803Smarcel     One more legitimate use is that if TYPE_FLAG_STUB is set, this is
325130803Smarcel     the name to use to look for definitions in other files.  */
32619370Spst
327130803Smarcel  char *tag_name;
32819370Spst
329130803Smarcel  /* Every type is now associated with a particular objfile, and the
330130803Smarcel     type is allocated on the objfile_obstack for that objfile.  One problem
331130803Smarcel     however, is that there are times when gdb allocates new types while
332130803Smarcel     it is not in the process of reading symbols from a particular objfile.
333130803Smarcel     Fortunately, these happen when the type being created is a derived
334130803Smarcel     type of an existing type, such as in lookup_pointer_type().  So
335130803Smarcel     we can just allocate the new type using the same objfile as the
336130803Smarcel     existing type, but to do this we need a backpointer to the objfile
337130803Smarcel     from the existing type.  Yes this is somewhat ugly, but without
338130803Smarcel     major overhaul of the internal type system, it can't be avoided
339130803Smarcel     for now. */
34019370Spst
341130803Smarcel  struct objfile *objfile;
34219370Spst
343130803Smarcel  /* For a pointer type, describes the type of object pointed to.
344130803Smarcel     For an array type, describes the type of the elements.
345130803Smarcel     For a function or method type, describes the type of the return value.
346130803Smarcel     For a range type, describes the type of the full range.
347130803Smarcel     For a complex type, describes the type of each coordinate.
348130803Smarcel     Unused otherwise.  */
34919370Spst
350130803Smarcel  struct type *target_type;
35119370Spst
352130803Smarcel  /* Flags about this type.  */
35319370Spst
354130803Smarcel  int flags;
35519370Spst
356130803Smarcel  /* Number of fields described for this type */
35719370Spst
358130803Smarcel  short nfields;
35946283Sdfr
360130803Smarcel  /* Field number of the virtual function table pointer in
361130803Smarcel     VPTR_BASETYPE.  If -1, we were unable to find the virtual
362130803Smarcel     function table pointer in initial symbol reading, and
363130803Smarcel     fill_in_vptr_fieldno should be called to find it if possible.
36419370Spst
365130803Smarcel     Unused if this type does not have virtual functions.  */
36619370Spst
367130803Smarcel  short vptr_fieldno;
36819370Spst
369130803Smarcel  /* For structure and union types, a description of each field.
370130803Smarcel     For set and pascal array types, there is one "field",
371130803Smarcel     whose type is the domain type of the set or array.
372130803Smarcel     For range types, there are two "fields",
373130803Smarcel     the minimum and maximum values (both inclusive).
374130803Smarcel     For enum types, each possible value is described by one "field".
375130803Smarcel     For a function or method type, a "field" for each parameter.
376130803Smarcel     For C++ classes, there is one field for each base class (if it is
377130803Smarcel     a derived class) plus one field for each class data member.  Member
378130803Smarcel     functions are recorded elsewhere.
37919370Spst
380130803Smarcel     Using a pointer to a separate array of fields
381130803Smarcel     allows all types to have the same size, which is useful
382130803Smarcel     because we can allocate the space for a type before
383130803Smarcel     we know what to put in it.  */
38419370Spst
385130803Smarcel  struct field
386130803Smarcel  {
387130803Smarcel    union field_location
388130803Smarcel    {
389130803Smarcel      /* Position of this field, counting in bits from start of
390130803Smarcel	 containing structure.
391130803Smarcel	 For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB.
392130803Smarcel	 For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB.
393130803Smarcel	 For a range bound or enum value, this is the value itself. */
39419370Spst
395130803Smarcel      int bitpos;
39619370Spst
397130803Smarcel      /* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
398130803Smarcel	 is the location (in the target) of the static field.
399130803Smarcel	 Otherwise, physname is the mangled label of the static field. */
40019370Spst
401130803Smarcel      CORE_ADDR physaddr;
402130803Smarcel      char *physname;
403130803Smarcel    }
404130803Smarcel    loc;
40519370Spst
406130803Smarcel    /* For a function or member type, this is 1 if the argument is marked
407130803Smarcel       artificial.  Artificial arguments should not be shown to the
408130803Smarcel       user.  */
409130803Smarcel    unsigned int artificial : 1;
41046283Sdfr
411130803Smarcel    /* This flag is zero for non-static fields, 1 for fields whose location
412130803Smarcel       is specified by the label loc.physname, and 2 for fields whose location
413130803Smarcel       is specified by loc.physaddr.  */
41446283Sdfr
415130803Smarcel    unsigned int static_kind : 2;
41646283Sdfr
417130803Smarcel    /* Size of this field, in bits, or zero if not packed.
418130803Smarcel       For an unpacked field, the field's type's length
419130803Smarcel       says how many bytes the field occupies.  */
42046283Sdfr
421130803Smarcel    unsigned int bitsize : 29;
42219370Spst
423130803Smarcel    /* In a struct or union type, type of this field.
424130803Smarcel       In a function or member type, type of this argument.
425130803Smarcel       In an array type, the domain-type of the array.  */
42619370Spst
427130803Smarcel    struct type *type;
42819370Spst
429130803Smarcel    /* Name of field, value or argument.
430130803Smarcel       NULL for range bounds, array domains, and member function
431130803Smarcel       arguments.  */
43219370Spst
433130803Smarcel    char *name;
43419370Spst
435130803Smarcel  } *fields;
43619370Spst
437130803Smarcel  /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE
438130803Smarcel     is the base class which defined the virtual function table pointer.
43919370Spst
440130803Smarcel     For types that are pointer to member types (TYPE_CODE_MEMBER),
441130803Smarcel     VPTR_BASETYPE is the type that this pointer is a member of.
44219370Spst
443130803Smarcel     For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate
444130803Smarcel     type that contains the method.
44519370Spst
446130803Smarcel     Unused otherwise.  */
44746283Sdfr
448130803Smarcel  struct type *vptr_basetype;
44919370Spst
450130803Smarcel  /* Slot to point to additional language-specific fields of this type.  */
45119370Spst
452130803Smarcel  union type_specific
453130803Smarcel  {
454130803Smarcel    /* CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to point to
455130803Smarcel       cplus_struct_default, a default static instance of a struct
456130803Smarcel       cplus_struct_type. */
45719370Spst
458130803Smarcel    struct cplus_struct_type *cplus_stuff;
45919370Spst
460130803Smarcel    /* FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to the
461130803Smarcel       floatformat object that describes the floating-point value
462130803Smarcel       that resides within the type.  */
46319370Spst
464130803Smarcel    const struct floatformat *floatformat;
465130803Smarcel  } type_specific;
466130803Smarcel};
46719370Spst
468130803Smarcel/* A ``struct type'' describes a particular instance of a type, with
469130803Smarcel   some particular qualification.  */
470130803Smarcelstruct type
471130803Smarcel{
472130803Smarcel  /* Type that is a pointer to this type.
473130803Smarcel     NULL if no such pointer-to type is known yet.
474130803Smarcel     The debugger may add the address of such a type
475130803Smarcel     if it has to construct one later.  */
47619370Spst
477130803Smarcel  struct type *pointer_type;
47819370Spst
479130803Smarcel  /* C++: also need a reference type.  */
48019370Spst
481130803Smarcel  struct type *reference_type;
48219370Spst
483130803Smarcel  /* Variant chain.  This points to a type that differs from this one only
484130803Smarcel     in qualifiers and length.  Currently, the possible qualifiers are
485130803Smarcel     const, volatile, code-space, data-space, and address class.  The
486130803Smarcel     length may differ only when one of the address class flags are set.
487130803Smarcel     The variants are linked in a circular ring and share MAIN_TYPE.  */
488130803Smarcel  struct type *chain;
48919370Spst
490130803Smarcel  /* Flags specific to this instance of the type, indicating where
491130803Smarcel     on the ring we are.  */
492130803Smarcel  int instance_flags;
49319370Spst
494130803Smarcel  /* Length of storage for a value of this type.  This is what
495130803Smarcel     sizeof(type) would return; use it for address arithmetic,
496130803Smarcel     memory reads and writes, etc.  This size includes padding.  For
497130803Smarcel     example, an i386 extended-precision floating point value really
498130803Smarcel     only occupies ten bytes, but most ABI's declare its size to be
499130803Smarcel     12 bytes, to preserve alignment.  A `struct type' representing
500130803Smarcel     such a floating-point type would have a `length' value of 12,
501130803Smarcel     even though the last two bytes are unused.
502130803Smarcel
503130803Smarcel     There's a bit of a host/target mess here, if you're concerned
504130803Smarcel     about machines whose bytes aren't eight bits long, or who don't
505130803Smarcel     have byte-addressed memory.  Various places pass this to memcpy
506130803Smarcel     and such, meaning it must be in units of host bytes.  Various
507130803Smarcel     other places expect they can calculate addresses by adding it
508130803Smarcel     and such, meaning it must be in units of target bytes.  For
509130803Smarcel     some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
510130803Smarcel     and TARGET_CHAR_BIT will be (say) 32, this is a problem.
511130803Smarcel
512130803Smarcel     One fix would be to make this field in bits (requiring that it
513130803Smarcel     always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
514130803Smarcel     the other choice would be to make it consistently in units of
515130803Smarcel     HOST_CHAR_BIT.  However, this would still fail to address
516130803Smarcel     machines based on a ternary or decimal representation.  */
517130803Smarcel
518130803Smarcel  unsigned length;
519130803Smarcel
520130803Smarcel  /* Core type, shared by a group of qualified types.  */
521130803Smarcel  struct main_type *main_type;
522130803Smarcel};
523130803Smarcel
52419370Spst#define	NULL_TYPE ((struct type *) 0)
52519370Spst
52619370Spst/* C++ language-specific information for TYPE_CODE_STRUCT and TYPE_CODE_UNION
52719370Spst   nodes.  */
52819370Spst
52919370Spststruct cplus_struct_type
53098944Sobrien  {
53198944Sobrien    /* Number of base classes this type derives from.  The baseclasses are
53298944Sobrien       stored in the first N_BASECLASSES fields (i.e. the `fields' field of
53398944Sobrien       the struct type).  I think only the `type' field of such a field has
53498944Sobrien       any meaning.  */
53519370Spst
53698944Sobrien    short n_baseclasses;
53719370Spst
53898944Sobrien    /* Number of methods with unique names.  All overloaded methods with
53998944Sobrien       the same name count only once. */
54019370Spst
54198944Sobrien    short nfn_fields;
54219370Spst
54398944Sobrien    /* Number of methods described for this type, not including the
54498944Sobrien       methods that it derives from.  */
54519370Spst
54698944Sobrien    short nfn_fields_total;
54719370Spst
54898944Sobrien    /* The "declared_type" field contains a code saying how the
54998944Sobrien       user really declared this type, e.g., "class s", "union s",
55098944Sobrien       "struct s".
55198944Sobrien       The 3 above things come out from the C++ compiler looking like classes,
55298944Sobrien       but we keep track of the real declaration so we can give
55398944Sobrien       the correct information on "ptype". (Note: TEMPLATE may not
55498944Sobrien       belong in this list...)  */
55546283Sdfr
55646283Sdfr#define DECLARED_TYPE_CLASS 0
55746283Sdfr#define DECLARED_TYPE_UNION 1
55846283Sdfr#define DECLARED_TYPE_STRUCT 2
55946283Sdfr#define DECLARED_TYPE_TEMPLATE 3
56098944Sobrien    short declared_type;	/* One of the above codes */
56119370Spst
56298944Sobrien    /* For derived classes, the number of base classes is given by n_baseclasses
56398944Sobrien       and virtual_field_bits is a bit vector containing one bit per base class.
56498944Sobrien       If the base class is virtual, the corresponding bit will be set.
56598944Sobrien       I.E, given:
56619370Spst
56798944Sobrien       class A{};
56898944Sobrien       class B{};
56998944Sobrien       class C : public B, public virtual A {};
57019370Spst
57198944Sobrien       B is a baseclass of C; A is a virtual baseclass for C.
57298944Sobrien       This is a C++ 2.0 language feature. */
57319370Spst
57498944Sobrien    B_TYPE *virtual_field_bits;
57519370Spst
57698944Sobrien    /* For classes with private fields, the number of fields is given by
57798944Sobrien       nfields and private_field_bits is a bit vector containing one bit
57898944Sobrien       per field.
57998944Sobrien       If the field is private, the corresponding bit will be set. */
58019370Spst
58198944Sobrien    B_TYPE *private_field_bits;
58219370Spst
58398944Sobrien    /* For classes with protected fields, the number of fields is given by
58498944Sobrien       nfields and protected_field_bits is a bit vector containing one bit
58598944Sobrien       per field.
58698944Sobrien       If the field is private, the corresponding bit will be set. */
58719370Spst
58898944Sobrien    B_TYPE *protected_field_bits;
58919370Spst
59098944Sobrien    /* for classes with fields to be ignored, either this is optimized out
59198944Sobrien       or this field has length 0 */
59219370Spst
59398944Sobrien    B_TYPE *ignore_field_bits;
59419370Spst
59598944Sobrien    /* For classes, structures, and unions, a description of each field,
59698944Sobrien       which consists of an overloaded name, followed by the types of
59798944Sobrien       arguments that the method expects, and then the name after it
59898944Sobrien       has been renamed to make it distinct.
59919370Spst
60098944Sobrien       fn_fieldlists points to an array of nfn_fields of these. */
60119370Spst
60298944Sobrien    struct fn_fieldlist
60398944Sobrien      {
60419370Spst
60598944Sobrien	/* The overloaded name.  */
60619370Spst
60798944Sobrien	char *name;
60819370Spst
60998944Sobrien	/* The number of methods with this name.  */
61019370Spst
61198944Sobrien	int length;
61219370Spst
61398944Sobrien	/* The list of methods.  */
61419370Spst
61598944Sobrien	struct fn_field
61698944Sobrien	  {
61719370Spst
61898944Sobrien	    /* If is_stub is clear, this is the mangled name which we can
61998944Sobrien	       look up to find the address of the method (FIXME: it would
62098944Sobrien	       be cleaner to have a pointer to the struct symbol here
62198944Sobrien	       instead).  */
62219370Spst
62398944Sobrien	    /* If is_stub is set, this is the portion of the mangled
62498944Sobrien	       name which specifies the arguments.  For example, "ii",
62598944Sobrien	       if there are two int arguments, or "" if there are no
62698944Sobrien	       arguments.  See gdb_mangle_name for the conversion from this
62798944Sobrien	       format to the one used if is_stub is clear.  */
62819370Spst
62998944Sobrien	    char *physname;
63019370Spst
63198944Sobrien	    /* The function type for the method.
63298944Sobrien	       (This comment used to say "The return value of the method",
63398944Sobrien	       but that's wrong. The function type
63498944Sobrien	       is expected here, i.e. something with TYPE_CODE_FUNC,
63598944Sobrien	       and *not* the return-value type). */
63619370Spst
63798944Sobrien	    struct type *type;
63819370Spst
63998944Sobrien	    /* For virtual functions.
64098944Sobrien	       First baseclass that defines this virtual function.   */
64119370Spst
64298944Sobrien	    struct type *fcontext;
64319370Spst
64498944Sobrien	    /* Attributes. */
64519370Spst
64698944Sobrien	    unsigned int is_const:1;
64798944Sobrien	    unsigned int is_volatile:1;
64898944Sobrien	    unsigned int is_private:1;
64998944Sobrien	    unsigned int is_protected:1;
65098944Sobrien	    unsigned int is_public:1;
65198944Sobrien	    unsigned int is_abstract:1;
65298944Sobrien	    unsigned int is_static:1;
65398944Sobrien	    unsigned int is_final:1;
65498944Sobrien	    unsigned int is_synchronized:1;
65598944Sobrien	    unsigned int is_native:1;
65698944Sobrien	    unsigned int is_artificial:1;
65719370Spst
65898944Sobrien	    /* A stub method only has some fields valid (but they are enough
65998944Sobrien	       to reconstruct the rest of the fields).  */
66098944Sobrien	    unsigned int is_stub:1;
66146283Sdfr
66298944Sobrien	    /* C++ method that is inlined */
66398944Sobrien	    unsigned int is_inlined:1;
66419370Spst
66598944Sobrien	    /* Unused.  */
66698944Sobrien	    unsigned int dummy:3;
66719370Spst
66898944Sobrien	    /* Index into that baseclass's virtual function table,
66998944Sobrien	       minus 2; else if static: VOFFSET_STATIC; else: 0.  */
67019370Spst
67198944Sobrien	    unsigned int voffset:16;
67219370Spst
67398944Sobrien#define VOFFSET_STATIC 1
67419370Spst
67598944Sobrien	  }
67698944Sobrien	 *fn_fields;
67719370Spst
67898944Sobrien      }
67998944Sobrien     *fn_fieldlists;
68098944Sobrien
68146283Sdfr    /* If this "struct type" describes a template, then it
68246283Sdfr     * has arguments. "template_args" points to an array of
68346283Sdfr     * template arg descriptors, of length "ntemplate_args".
68446283Sdfr     * The only real information in each of these template arg descriptors
68546283Sdfr     * is a name. "type" will typically just point to a "struct type" with
68646283Sdfr     * the placeholder TYPE_CODE_TEMPLATE_ARG type.
68746283Sdfr     */
68846283Sdfr    short ntemplate_args;
68946283Sdfr    struct template_arg
69098944Sobrien      {
69198944Sobrien	char *name;
69298944Sobrien	struct type *type;
69398944Sobrien      }
69498944Sobrien     *template_args;
69546283Sdfr
69646283Sdfr    /* If this "struct type" describes a template, it has a list
69746283Sdfr     * of instantiations. "instantiations" is a pointer to an array
69846283Sdfr     * of type's, one representing each instantiation. There
69946283Sdfr     * are "ninstantiations" elements in this array.
70046283Sdfr     */
70146283Sdfr    short ninstantiations;
70246283Sdfr    struct type **instantiations;
70346283Sdfr
70446283Sdfr    /* The following points to information relevant to the runtime model
70546283Sdfr     * of the compiler.
70646283Sdfr     * Currently being used only for HP's ANSI C++ compiler.
70746283Sdfr     * (This type may have to be changed/enhanced for other compilers.)
70846283Sdfr     *
70946283Sdfr     * RUNTIME_PTR is NULL if there is no runtime information (currently
71046283Sdfr     * this means the type was not compiled by HP aCC).
71146283Sdfr     *
71246283Sdfr     * Fields in structure pointed to:
71346283Sdfr     * ->HAS_VTABLE : 0 => no virtual table, 1 => vtable present
71446283Sdfr     *
71546283Sdfr     * ->PRIMARY_BASE points to the first non-virtual base class that has
71646283Sdfr     * a virtual table.
71746283Sdfr     *
71846283Sdfr     * ->VIRTUAL_BASE_LIST points to a list of struct type * pointers that
71946283Sdfr     * point to the type information for all virtual bases among this type's
72046283Sdfr     * ancestors.
72146283Sdfr     */
72298944Sobrien    struct runtime_info
72398944Sobrien      {
72498944Sobrien	short has_vtable;
72598944Sobrien	struct type *primary_base;
72698944Sobrien	struct type **virtual_base_list;
72798944Sobrien      }
72898944Sobrien     *runtime_ptr;
72946283Sdfr
73046283Sdfr    /* Pointer to information about enclosing scope, if this is a
73146283Sdfr     * local type.  If it is not a local type, this is NULL
73246283Sdfr     */
73398944Sobrien    struct local_type_info
73498944Sobrien      {
73598944Sobrien	char *file;
73698944Sobrien	int line;
73798944Sobrien      }
73898944Sobrien     *localtype_ptr;
73998944Sobrien  };
74019370Spst
74146283Sdfr/* Struct used in computing virtual base list */
74246283Sdfrstruct vbase
74398944Sobrien  {
74498944Sobrien    struct type *vbasetype;	/* pointer to virtual base */
74598944Sobrien    struct vbase *next;		/* next in chain */
74698944Sobrien  };
74746283Sdfr
74846283Sdfr/* Struct used for ranking a function for overload resolution */
74998944Sobrienstruct badness_vector
75098944Sobrien  {
75198944Sobrien    int length;
75298944Sobrien    int *rank;
75398944Sobrien  };
75446283Sdfr
75519370Spst/* The default value of TYPE_CPLUS_SPECIFIC(T) points to the
75619370Spst   this shared static structure. */
75719370Spst
75819370Spstextern const struct cplus_struct_type cplus_struct_default;
75919370Spst
76098944Sobrienextern void allocate_cplus_struct_type (struct type *);
76119370Spst
76219370Spst#define INIT_CPLUS_SPECIFIC(type) \
76319370Spst  (TYPE_CPLUS_SPECIFIC(type)=(struct cplus_struct_type*)&cplus_struct_default)
76419370Spst#define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
76519370Spst#define HAVE_CPLUS_STRUCT(type) \
76619370Spst  (TYPE_CPLUS_SPECIFIC(type) != &cplus_struct_default)
76719370Spst
768130803Smarcel#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
769130803Smarcel#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
770130803Smarcel#define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name
771130803Smarcel#define TYPE_TAG_NAME(type) TYPE_MAIN_TYPE(type)->tag_name
772130803Smarcel#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
77319370Spst#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
77419370Spst#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
775130803Smarcel#define TYPE_CHAIN(thistype) (thistype)->chain
77619370Spst/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
77719370Spst   But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
77819370Spst   so you only have to call check_typedef once.  Since allocate_value
77919370Spst   calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe.  */
78019370Spst#define TYPE_LENGTH(thistype) (thistype)->length
781130803Smarcel#define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile
782130803Smarcel#define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags
78398944Sobrien/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
78419370Spst   type, you need to do TYPE_CODE (check_type (this_type)). */
785130803Smarcel#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
786130803Smarcel#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
787130803Smarcel#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->fields
78846283Sdfr#define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
78946283Sdfr#define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations
79019370Spst
79119370Spst#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
79219370Spst#define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0)
79319370Spst#define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1)
79419370Spst
79519370Spst/* Moto-specific stuff for FORTRAN arrays */
79619370Spst
797130803Smarcel#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) \
798130803Smarcel	TYPE_MAIN_TYPE(thistype)->upper_bound_type
799130803Smarcel#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \
800130803Smarcel	TYPE_MAIN_TYPE(thistype)->lower_bound_type
80119370Spst
80219370Spst#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
80319370Spst   (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1))
80419370Spst
80519370Spst#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
80619370Spst   (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0))
80719370Spst
80819370Spst/* C++ */
80919370Spst
810130803Smarcel#define TYPE_VPTR_BASETYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype
811130803Smarcel#define TYPE_DOMAIN_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype
812130803Smarcel#define TYPE_VPTR_FIELDNO(thistype) TYPE_MAIN_TYPE(thistype)->vptr_fieldno
81319370Spst#define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields
81419370Spst#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
81519370Spst#define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total
81646283Sdfr#define TYPE_NTEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ntemplate_args
81746283Sdfr#define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations
81846283Sdfr#define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type
819130803Smarcel#define	TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific
820130803Smarcel#define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
821130803Smarcel#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
822130803Smarcel#define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type
82319370Spst#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
824130803Smarcel#define TYPE_BASECLASS_NAME(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].name
82546283Sdfr#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
82646283Sdfr#define BASETYPE_VIA_PUBLIC(thistype, index) \
82746283Sdfr  ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
82846283Sdfr
82919370Spst#define BASETYPE_VIA_VIRTUAL(thistype, index) \
83046283Sdfr  (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
83146283Sdfr    : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
83219370Spst
83346283Sdfr#define FIELD_TYPE(thisfld) ((thisfld).type)
83446283Sdfr#define FIELD_NAME(thisfld) ((thisfld).name)
83546283Sdfr#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
836130803Smarcel#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
83746283Sdfr#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
838130803Smarcel#define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind)
83946283Sdfr#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname)
84046283Sdfr#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
84146283Sdfr#define SET_FIELD_PHYSNAME(thisfld, name) \
842130803Smarcel  ((thisfld).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name))
84346283Sdfr#define SET_FIELD_PHYSADDR(thisfld, name) \
844130803Smarcel  ((thisfld).static_kind = 2, FIELD_PHYSADDR(thisfld) = (name))
845130803Smarcel#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n]
84646283Sdfr#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
84746283Sdfr#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
84846283Sdfr#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
84998944Sobrien#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
85046283Sdfr#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
85146283Sdfr#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
85246283Sdfr#define TYPE_TEMPLATE_ARG(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->template_args[n]
85346283Sdfr#define TYPE_INSTANTIATION(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->instantiations[n]
85419370Spst
85519370Spst#define TYPE_FIELD_PRIVATE_BITS(thistype) \
85619370Spst  TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
85719370Spst#define TYPE_FIELD_PROTECTED_BITS(thistype) \
85819370Spst  TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
85919370Spst#define TYPE_FIELD_IGNORE_BITS(thistype) \
86019370Spst  TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
86119370Spst#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
86219370Spst  TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
86319370Spst#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
86419370Spst  B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
86519370Spst#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
86619370Spst  B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
86719370Spst#define SET_TYPE_FIELD_IGNORE(thistype, n) \
86819370Spst  B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
86919370Spst#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
87019370Spst  B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
87119370Spst#define TYPE_FIELD_PRIVATE(thistype, n) \
87219370Spst  (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
87319370Spst    : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
87419370Spst#define TYPE_FIELD_PROTECTED(thistype, n) \
87519370Spst  (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
87619370Spst    : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
87719370Spst#define TYPE_FIELD_IGNORE(thistype, n) \
87819370Spst  (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
87919370Spst    : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
88019370Spst#define TYPE_FIELD_VIRTUAL(thistype, n) \
88146283Sdfr  (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
88246283Sdfr    : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
88319370Spst
884130803Smarcel#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0)
885130803Smarcel#define TYPE_FIELD_STATIC_KIND(thistype, n) TYPE_MAIN_TYPE (thistype)->fields[n].static_kind
886130803Smarcel#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind == 2)
88746283Sdfr#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n))
88846283Sdfr#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n))
88919370Spst
89019370Spst#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
89119370Spst#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
89219370Spst#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
89319370Spst#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
89419370Spst#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
89519370Spst
89619370Spst#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
89719370Spst#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
89819370Spst#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
899130803Smarcel#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_FIELDS ((thisfn)[n].type)
90019370Spst#define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
90119370Spst#define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
90219370Spst#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
90319370Spst#define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
90446283Sdfr#define TYPE_FN_FIELD_PUBLIC(thisfn, n) ((thisfn)[n].is_public)
90546283Sdfr#define TYPE_FN_FIELD_STATIC(thisfn, n) ((thisfn)[n].is_static)
90646283Sdfr#define TYPE_FN_FIELD_FINAL(thisfn, n) ((thisfn)[n].is_final)
90746283Sdfr#define TYPE_FN_FIELD_SYNCHRONIZED(thisfn, n) ((thisfn)[n].is_synchronized)
90846283Sdfr#define TYPE_FN_FIELD_NATIVE(thisfn, n) ((thisfn)[n].is_native)
90998944Sobrien#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
91046283Sdfr#define TYPE_FN_FIELD_ABSTRACT(thisfn, n) ((thisfn)[n].is_abstract)
91119370Spst#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
91246283Sdfr#define TYPE_FN_FIELD_INLINED(thisfn, n) ((thisfn)[n].is_inlined)
91319370Spst#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
91419370Spst#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
91519370Spst#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
91619370Spst#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
91719370Spst
91846283Sdfr#define TYPE_RUNTIME_PTR(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->runtime_ptr)
91946283Sdfr#define TYPE_VTABLE(thistype) (TYPE_RUNTIME_PTR(thistype)->has_vtable)
92046283Sdfr#define TYPE_HAS_VTABLE(thistype) (TYPE_RUNTIME_PTR(thistype) && TYPE_VTABLE(thistype))
92146283Sdfr#define TYPE_PRIMARY_BASE(thistype) (TYPE_RUNTIME_PTR(thistype)->primary_base)
92246283Sdfr#define TYPE_VIRTUAL_BASE_LIST(thistype) (TYPE_RUNTIME_PTR(thistype)->virtual_base_list)
92398944Sobrien
92446283Sdfr#define TYPE_LOCALTYPE_PTR(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr)
92546283Sdfr#define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
92646283Sdfr#define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
92798944Sobrien
92846283Sdfr#define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) ||        \
92946283Sdfr                                   (TYPE_CODE (thistype) == TYPE_CODE_UNION))        && \
93046283Sdfr                                  (TYPE_NFIELDS (thistype) == 0)                     && \
93146283Sdfr                                  (TYPE_CPLUS_SPECIFIC (thistype) && (TYPE_NFN_FIELDS (thistype) == 0)))
93298944Sobrien
93398944Sobrien
93498944Sobrien
93546283Sdfr/* Implicit sizes */
93619370Spstextern struct type *builtin_type_void;
93719370Spstextern struct type *builtin_type_char;
93819370Spstextern struct type *builtin_type_short;
93919370Spstextern struct type *builtin_type_int;
94019370Spstextern struct type *builtin_type_long;
94119370Spstextern struct type *builtin_type_signed_char;
94219370Spstextern struct type *builtin_type_unsigned_char;
94319370Spstextern struct type *builtin_type_unsigned_short;
94419370Spstextern struct type *builtin_type_unsigned_int;
94519370Spstextern struct type *builtin_type_unsigned_long;
94619370Spstextern struct type *builtin_type_float;
94719370Spstextern struct type *builtin_type_double;
94819370Spstextern struct type *builtin_type_long_double;
94919370Spstextern struct type *builtin_type_complex;
95019370Spstextern struct type *builtin_type_double_complex;
95119370Spstextern struct type *builtin_type_string;
95246283Sdfrextern struct type *builtin_type_bool;
95319370Spst
95498944Sobrien/* Address/pointer types: */
95598944Sobrien/* (C) Language `pointer to data' type.  Some target platforms use an
95698944Sobrien   implicitly {sign,zero} -extended 32 bit C language pointer on a 64
95798944Sobrien   bit ISA.  */
95898944Sobrienextern struct type *builtin_type_void_data_ptr;
95998944Sobrien
96098944Sobrien/* (C) Language `pointer to function returning void' type.  Since
96198944Sobrien   ANSI, C standards have explicitly said that pointers to functions
96298944Sobrien   and pointers to data are not interconvertible --- that is, you
96398944Sobrien   can't cast a function pointer to void * and back, and expect to get
96498944Sobrien   the same value.  However, all function pointer types are
96598944Sobrien   interconvertible, so void (*) () can server as a generic function
96698944Sobrien   pointer.  */
96798944Sobrienextern struct type *builtin_type_void_func_ptr;
96898944Sobrien
96998944Sobrien/* The target CPU's address type.  This is the ISA address size. */
97098944Sobrienextern struct type *builtin_type_CORE_ADDR;
97198944Sobrien/* The symbol table address type.  Some object file formats have a 32
97298944Sobrien   bit address type even though the TARGET has a 64 bit pointer type
97398944Sobrien   (cf MIPS). */
97498944Sobrienextern struct type *builtin_type_bfd_vma;
97598944Sobrien
976130803Smarcel/* Explicit sizes - see C9X <intypes.h> for naming scheme.  The "int0"
977130803Smarcel   is for when an architecture needs to describe a register that has
978130803Smarcel   no size.  */
979130803Smarcelextern struct type *builtin_type_int0;
98046283Sdfrextern struct type *builtin_type_int8;
98146283Sdfrextern struct type *builtin_type_uint8;
98246283Sdfrextern struct type *builtin_type_int16;
98346283Sdfrextern struct type *builtin_type_uint16;
98446283Sdfrextern struct type *builtin_type_int32;
98546283Sdfrextern struct type *builtin_type_uint32;
98646283Sdfrextern struct type *builtin_type_int64;
98746283Sdfrextern struct type *builtin_type_uint64;
98898944Sobrienextern struct type *builtin_type_int128;
98998944Sobrienextern struct type *builtin_type_uint128;
99046283Sdfr
99198944Sobrien/* SIMD types.  We inherit these names from GCC.  */
99298944Sobrienextern struct type *builtin_type_v4sf;
99398944Sobrienextern struct type *builtin_type_v4si;
99498944Sobrienextern struct type *builtin_type_v16qi;
99598944Sobrienextern struct type *builtin_type_v8qi;
99698944Sobrienextern struct type *builtin_type_v8hi;
99798944Sobrienextern struct type *builtin_type_v4hi;
99898944Sobrienextern struct type *builtin_type_v2si;
99998944Sobrien
1000130803Smarcel/* Type for 64 bit vectors. */
1001130803Smarcelextern struct type *builtin_type_vec64;
1002130803Smarcelextern struct type *builtin_type_vec64i;
1003130803Smarcel
100498944Sobrien/* Type for 128 bit vectors. */
100598944Sobrienextern struct type *builtin_type_vec128;
1006130803Smarcelextern struct type *builtin_type_vec128i;
100798944Sobrien
100898944Sobrien/* Explicit floating-point formats.  See "floatformat.h".  */
100998944Sobrienextern struct type *builtin_type_ieee_single_big;
101098944Sobrienextern struct type *builtin_type_ieee_single_little;
101198944Sobrienextern struct type *builtin_type_ieee_double_big;
101298944Sobrienextern struct type *builtin_type_ieee_double_little;
101398944Sobrienextern struct type *builtin_type_ieee_double_littlebyte_bigword;
101498944Sobrienextern struct type *builtin_type_i387_ext;
101598944Sobrienextern struct type *builtin_type_m68881_ext;
101698944Sobrienextern struct type *builtin_type_i960_ext;
101798944Sobrienextern struct type *builtin_type_m88110_ext;
101898944Sobrienextern struct type *builtin_type_m88110_harris_ext;
101998944Sobrienextern struct type *builtin_type_arm_ext_big;
102098944Sobrienextern struct type *builtin_type_arm_ext_littlebyte_bigword;
102198944Sobrienextern struct type *builtin_type_ia64_spill_big;
102298944Sobrienextern struct type *builtin_type_ia64_spill_little;
102398944Sobrienextern struct type *builtin_type_ia64_quad_big;
102498944Sobrienextern struct type *builtin_type_ia64_quad_little;
102598944Sobrien
102698944Sobrien/* We use this for the '/c' print format, because builtin_type_char is
102798944Sobrien   just a one-byte integral type, which languages less laid back than
102898944Sobrien   C will print as ... well, a one-byte integral type.  */
102998944Sobrienextern struct type *builtin_type_true_char;
103098944Sobrien
103119370Spst/* This type represents a type that was unrecognized in symbol
103219370Spst   read-in.  */
103319370Spst
103419370Spstextern struct type *builtin_type_error;
103519370Spst
103619370Spstextern struct type *builtin_type_long_long;
103719370Spstextern struct type *builtin_type_unsigned_long_long;
103819370Spst
103919370Spst/* Modula-2 types */
104019370Spst
104119370Spstextern struct type *builtin_type_m2_char;
104219370Spstextern struct type *builtin_type_m2_int;
104319370Spstextern struct type *builtin_type_m2_card;
104419370Spstextern struct type *builtin_type_m2_real;
104519370Spstextern struct type *builtin_type_m2_bool;
104619370Spst
104719370Spst/* Fortran (F77) types */
104819370Spst
104919370Spstextern struct type *builtin_type_f_character;
105019370Spstextern struct type *builtin_type_f_integer;
105198944Sobrienextern struct type *builtin_type_f_integer_s2;
105219370Spstextern struct type *builtin_type_f_logical;
105319370Spstextern struct type *builtin_type_f_logical_s1;
105419370Spstextern struct type *builtin_type_f_logical_s2;
105519370Spstextern struct type *builtin_type_f_real;
105619370Spstextern struct type *builtin_type_f_real_s8;
105719370Spstextern struct type *builtin_type_f_real_s16;
105819370Spstextern struct type *builtin_type_f_complex_s8;
105919370Spstextern struct type *builtin_type_f_complex_s16;
106019370Spstextern struct type *builtin_type_f_complex_s32;
106119370Spstextern struct type *builtin_type_f_void;
106219370Spst
106346283Sdfr/* RTTI for C++ */
106498944Sobrien/* extern struct type *builtin_type_cxx_typeinfo; */
106546283Sdfr
106619370Spst/* Maximum and minimum values of built-in types */
106719370Spst
106819370Spst#define	MAX_OF_TYPE(t)	\
106998944Sobrien   (TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) \
107098944Sobrien    : MAX_OF_SIZE(TYPE_LENGTH(t)))
107119370Spst
107219370Spst#define MIN_OF_TYPE(t)	\
107398944Sobrien   (TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
107498944Sobrien    : MIN_OF_SIZE(TYPE_LENGTH(t)))
107519370Spst
107619370Spst/* Allocate space for storing data associated with a particular type.
107719370Spst   We ensure that the space is allocated using the same mechanism that
107819370Spst   was used to allocate the space for the type structure itself.  I.E.
1079130803Smarcel   if the type is on an objfile's objfile_obstack, then the space for data
1080130803Smarcel   associated with that type will also be allocated on the objfile_obstack.
108119370Spst   If the type is not associated with any particular objfile (such as
108219370Spst   builtin types), then the data space will be allocated with xmalloc,
108319370Spst   the same as for the type structure. */
108419370Spst
108519370Spst#define TYPE_ALLOC(t,size)  \
108619370Spst   (TYPE_OBJFILE (t) != NULL  \
1087130803Smarcel    ? obstack_alloc (&TYPE_OBJFILE (t) -> objfile_obstack, size) \
108819370Spst    : xmalloc (size))
108919370Spst
109098944Sobrienextern struct type *alloc_type (struct objfile *);
109119370Spst
109298944Sobrienextern struct type *init_type (enum type_code, int, int, char *,
109398944Sobrien			       struct objfile *);
109419370Spst
1095130803Smarcel/* Helper functions to construct a struct or record type.  An
1096130803Smarcel   initially empty type is created using init_composite_type().
1097130803Smarcel   Fields are then added using append_struct_type_field().  A union
1098130803Smarcel   type has its size set to the largest field.  A struct type has each
1099130803Smarcel   field packed against the previous.  */
1100130803Smarcel
1101130803Smarcelextern struct type *init_composite_type (char *name, enum type_code code);
1102130803Smarcelextern void append_composite_type_field (struct type *t, char *name,
1103130803Smarcel					 struct type *field);
1104130803Smarcel
110598944Sobrienextern struct type *lookup_reference_type (struct type *);
110619370Spst
110798944Sobrienextern struct type *make_reference_type (struct type *, struct type **);
110819370Spst
1109244437Semasteextern struct type *make_cvr_type (int, int, int, struct type *,
1110244437Semaste                                   struct type **);
111146283Sdfr
111298944Sobrienextern void replace_type (struct type *, struct type *);
111398944Sobrien
111498944Sobrienextern int address_space_name_to_int (char *);
111598944Sobrien
1116130803Smarcelextern const char *address_space_int_to_name (int);
111798944Sobrien
111898944Sobrienextern struct type *make_type_with_address_space (struct type *type,
111998944Sobrien						  int space_identifier);
112098944Sobrien
112198944Sobrienextern struct type *lookup_member_type (struct type *, struct type *);
112298944Sobrien
112319370Spstextern void
1124130803Smarcelsmash_to_method_type (struct type *type, struct type *domain,
1125130803Smarcel		      struct type *to_type, struct field *args,
1126130803Smarcel		      int nargs, int varargs);
112719370Spst
1128130803Smarcelextern void smash_to_member_type (struct type *, struct type *, struct type *);
112919370Spst
113098944Sobrienextern struct type *allocate_stub_method (struct type *);
113119370Spst
113298944Sobrienextern char *type_name_no_tag (const struct type *);
113319370Spst
113498944Sobrienextern struct type *lookup_struct_elt_type (struct type *, char *, int);
113519370Spst
113698944Sobrienextern struct type *make_pointer_type (struct type *, struct type **);
113719370Spst
113898944Sobrienextern struct type *lookup_pointer_type (struct type *);
113919370Spst
114098944Sobrienextern struct type *make_function_type (struct type *, struct type **);
114119370Spst
114298944Sobrienextern struct type *lookup_function_type (struct type *);
114319370Spst
114498944Sobrienextern struct type *create_range_type (struct type *, struct type *, int,
114598944Sobrien				       int);
114619370Spst
114798944Sobrienextern struct type *create_array_type (struct type *, struct type *,
114898944Sobrien				       struct type *);
114919370Spst
115098944Sobrienextern struct type *create_string_type (struct type *, struct type *);
115119370Spst
115298944Sobrienextern struct type *create_set_type (struct type *, struct type *);
115319370Spst
115498944Sobrienextern struct type *lookup_unsigned_typename (char *);
115519370Spst
115698944Sobrienextern struct type *lookup_signed_typename (char *);
115719370Spst
115898944Sobrienextern struct type *check_typedef (struct type *);
115919370Spst
116019370Spst#define CHECK_TYPEDEF(TYPE) (TYPE) = check_typedef (TYPE)
116119370Spst
1162130803Smarcelextern void check_stub_method_group (struct type *, int);
116319370Spst
116498944Sobrienextern struct type *lookup_primitive_typename (char *);
116519370Spst
116698944Sobrienextern char *gdb_mangle_name (struct type *, int, int);
116719370Spst
116898944Sobrienextern struct type *builtin_type (char **);
116919370Spst
117098944Sobrienextern struct type *lookup_typename (char *, struct block *, int);
117119370Spst
117298944Sobrienextern struct type *lookup_template_type (char *, struct type *,
117398944Sobrien					  struct block *);
117419370Spst
117598944Sobrienextern struct type *lookup_fundamental_type (struct objfile *, int);
117619370Spst
117798944Sobrienextern void fill_in_vptr_fieldno (struct type *);
117819370Spst
117998944Sobrienextern int get_destructor_fn_field (struct type *, int *, int *);
118046283Sdfr
118198944Sobrienextern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *);
118219370Spst
118398944Sobrienextern int is_ancestor (struct type *, struct type *);
118446283Sdfr
118598944Sobrienextern int has_vtable (struct type *);
118646283Sdfr
118798944Sobrienextern struct type *primary_base_class (struct type *);
118846283Sdfr
118998944Sobrienextern struct type **virtual_base_list (struct type *);
119046283Sdfr
119198944Sobrienextern int virtual_base_list_length (struct type *);
119298944Sobrienextern int virtual_base_list_length_skip_primaries (struct type *);
119346283Sdfr
119498944Sobrienextern int virtual_base_index (struct type *, struct type *);
119598944Sobrienextern int virtual_base_index_skip_primaries (struct type *, struct type *);
119646283Sdfr
119746283Sdfr
119898944Sobrienextern int class_index_in_primary_list (struct type *);
119946283Sdfr
120098944Sobrienextern int count_virtual_fns (struct type *);
120146283Sdfr
120246283Sdfr/* Constants for HP/Taligent ANSI C++ runtime model */
120346283Sdfr
120446283Sdfr/* Where virtual function entries begin in the
120546283Sdfr * virtual table, in the non-RRBC vtable format.
120646283Sdfr * First 4 are the metavtable pointer, top offset,
120746283Sdfr * typeinfo pointer, and dup base info pointer */
120846283Sdfr#define HP_ACC_VFUNC_START        4
120946283Sdfr
121046283Sdfr/* (Negative) Offset where virtual base offset entries begin
121146283Sdfr * in the virtual table. Skips over metavtable pointer and
121246283Sdfr * the self-offset entry.
121346283Sdfr * NOTE: NEGATE THIS BEFORE USING! The virtual base offsets
121446283Sdfr * appear before the address point of the vtable (the slot
121546283Sdfr * pointed to by the object's vtable pointer), i.e. at lower
121646283Sdfr * addresses than the vtable pointer. */
121746283Sdfr#define HP_ACC_VBASE_START        2
121846283Sdfr
121946283Sdfr/* (Positive) Offset where the pointer to the typeinfo
122046283Sdfr * object is present in the virtual table */
122146283Sdfr#define HP_ACC_TYPEINFO_OFFSET    2
122246283Sdfr
122346283Sdfr/* (Positive) Offset where the ``top offset'' entry of
122446283Sdfr * the virtual table is */
122546283Sdfr#define HP_ACC_TOP_OFFSET_OFFSET  1
122646283Sdfr
122746283Sdfr/* Overload resolution */
122846283Sdfr
122946283Sdfr#define LENGTH_MATCH(bv) ((bv)->rank[0])
123046283Sdfr
123198944Sobrien/* Badness if parameter list length doesn't match arg list length */
123246283Sdfr#define LENGTH_MISMATCH_BADNESS      100
123398944Sobrien/* Dummy badness value for nonexistent parameter positions */
123446283Sdfr#define TOO_FEW_PARAMS_BADNESS       100
123546283Sdfr/* Badness if no conversion among types */
123646283Sdfr#define INCOMPATIBLE_TYPE_BADNESS    100
123746283Sdfr
123846283Sdfr/* Badness of integral promotion */
123946283Sdfr#define INTEGER_PROMOTION_BADNESS      1
124046283Sdfr/* Badness of floating promotion */
124146283Sdfr#define FLOAT_PROMOTION_BADNESS        1
124246283Sdfr/* Badness of integral conversion */
124346283Sdfr#define INTEGER_CONVERSION_BADNESS     2
124446283Sdfr/* Badness of floating conversion */
124546283Sdfr#define FLOAT_CONVERSION_BADNESS       2
124646283Sdfr/* Badness of integer<->floating conversions */
124746283Sdfr#define INT_FLOAT_CONVERSION_BADNESS   2
124846283Sdfr/* Badness of converting to a boolean */
124946283Sdfr#define BOOLEAN_CONVERSION_BADNESS     2
125046283Sdfr/* Badness of pointer conversion */
125146283Sdfr#define POINTER_CONVERSION_BADNESS     2
125246283Sdfr/* Badness of conversion of pointer to void pointer */
125346283Sdfr#define VOID_PTR_CONVERSION_BADNESS    2
125498944Sobrien/* Badness of converting derived to base class */
125546283Sdfr#define BASE_CONVERSION_BADNESS        2
125698944Sobrien/* Badness of converting from non-reference to reference */
125798944Sobrien#define REFERENCE_CONVERSION_BADNESS   2
125846283Sdfr
125946283Sdfr/* Non-standard conversions allowed by the debugger */
126046283Sdfr/* Converting a pointer to an int is usually OK */
126146283Sdfr#define NS_POINTER_CONVERSION_BADNESS 10
126246283Sdfr
126346283Sdfr
126498944Sobrienextern int compare_badness (struct badness_vector *, struct badness_vector *);
126546283Sdfr
126698944Sobrienextern struct badness_vector *rank_function (struct type **, int,
126798944Sobrien					     struct type **, int);
126846283Sdfr
126998944Sobrienextern int rank_one_type (struct type *, struct type *);
127046283Sdfr
127198944Sobrienextern void recursive_dump_type (struct type *, int);
127246283Sdfr
127319370Spst/* printcmd.c */
127419370Spst
1275130803Smarcelextern void print_scalar_formatted (void *, struct type *, int, int,
127698944Sobrien				    struct ui_file *);
127719370Spst
127898944Sobrienextern int can_dereference (struct type *);
127919370Spst
128098944Sobrienextern int is_integral_type (struct type *);
128119370Spst
128298944Sobrienextern void maintenance_print_type (char *, int);
128346283Sdfr
128498944Sobrien#endif /* GDBTYPES_H */
1285