hp merge changes -- too numerous to mention here; see ChangeLog and
[deliverable/binutils-gdb.git] / gdb / gdbtypes.h
CommitLineData
1ab3bf1b 1/* Internal type definitions for GDB.
a46d92a7 2 Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
1ab3bf1b
JG
3 Contributed by Cygnus Support, using pieces from other GDB modules.
4
5This file is part of GDB.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
6c9638b4 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1ab3bf1b
JG
20
21#if !defined (GDBTYPES_H)
22#define GDBTYPES_H 1
23
dda398c3
JK
24/* Codes for `fundamental types'. This is a monstrosity based on the
25 bogus notion that there are certain compiler-independent
26 `fundamental types'. None of these is well-defined (how big is
27 FT_SHORT? Does it depend on the language? How does the
28 language-specific code know which type to correlate to FT_SHORT?) */
1ab3bf1b
JG
29
30#define FT_VOID 0
31#define FT_BOOLEAN 1
4ef1f467
DT
32#define FT_CHAR 2 /* we use this for not-unsigned C/C++ chars */
33#define FT_SIGNED_CHAR 3 /* we use this for C++ signed chars */
34#define FT_UNSIGNED_CHAR 4 /* we use this for C/C++ unsigned chars */
1ab3bf1b
JG
35#define FT_SHORT 5
36#define FT_SIGNED_SHORT 6
37#define FT_UNSIGNED_SHORT 7
38#define FT_INTEGER 8
39#define FT_SIGNED_INTEGER 9
40#define FT_UNSIGNED_INTEGER 10
41#define FT_LONG 11
42#define FT_SIGNED_LONG 12
43#define FT_UNSIGNED_LONG 13
44#define FT_LONG_LONG 14
45#define FT_SIGNED_LONG_LONG 15
46#define FT_UNSIGNED_LONG_LONG 16
47#define FT_FLOAT 17
48#define FT_DBL_PREC_FLOAT 18
49#define FT_EXT_PREC_FLOAT 19
50#define FT_COMPLEX 20
51#define FT_DBL_PREC_COMPLEX 21
52#define FT_EXT_PREC_COMPLEX 22
53#define FT_STRING 23
4a11eef2
FF
54#define FT_FIXED_DECIMAL 24
55#define FT_FLOAT_DECIMAL 25
bf229b4e
FF
56#define FT_BYTE 26
57#define FT_UNSIGNED_BYTE 27
4ef1f467 58#define FT_TEMPLATE_ARG 28
1ab3bf1b 59
4ef1f467 60#define FT_NUM_MEMBERS 29 /* Highest FT_* above, plus one. */
1ab3bf1b 61
2e4964ad
FF
62/* Some macros for char-based bitfields. */
63
64#define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
65#define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
66#define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
67#define B_TYPE unsigned char
68#define B_BYTES(x) ( 1 + ((x)>>3) )
69#define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
70
1ab3bf1b
JG
71/* Different kinds of data types are distinguished by the `code' field. */
72
73enum type_code
74{
75 TYPE_CODE_UNDEF, /* Not used; catches errors */
76 TYPE_CODE_PTR, /* Pointer type */
85f0a848 77 TYPE_CODE_ARRAY, /* Array type with lower & upper bounds. */
1ab3bf1b
JG
78 TYPE_CODE_STRUCT, /* C struct or Pascal record */
79 TYPE_CODE_UNION, /* C union or Pascal variant part */
80 TYPE_CODE_ENUM, /* Enumeration type */
81 TYPE_CODE_FUNC, /* Function type */
82 TYPE_CODE_INT, /* Integer type */
f52bde21 83
a91a6192 84 /* Floating type. This is *NOT* a complex type. Beware, there are parts
f52bde21
JK
85 of GDB which bogusly assume that TYPE_CODE_FLT can mean complex. */
86 TYPE_CODE_FLT,
87
2f3b7d8e
JK
88 /* Void type. The length field specifies the length (probably always
89 one) which is used in pointer arithmetic involving pointers to
90 this type, but actually dereferencing such a pointer is invalid;
91 a void type has no length and no actual representation in memory
92 or registers. A pointer to a void type is a generic pointer. */
f52bde21
JK
93 TYPE_CODE_VOID,
94
1ab3bf1b
JG
95 TYPE_CODE_SET, /* Pascal sets */
96 TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */
666e7e41
JK
97
98 /* A string type which is like an array of character but prints
99 differently (at least for CHILL). It does not contain a length
100 field as Pascal strings (for many Pascals, anyway) do; if we want
101 to deal with such strings, we should use a new type code. */
102 TYPE_CODE_STRING,
103
104 /* String of bits; like TYPE_CODE_SET but prints differently (at least
105 for CHILL). */
106 TYPE_CODE_BITSTRING,
f52bde21
JK
107
108 /* Unknown type. The length field is valid if we were able to
109 deduce that much about the type, or 0 if we don't even know that. */
110 TYPE_CODE_ERROR,
1ab3bf1b
JG
111
112 /* C++ */
113 TYPE_CODE_MEMBER, /* Member type */
114 TYPE_CODE_METHOD, /* Method type */
115 TYPE_CODE_REF, /* C++ Reference types */
116
1ab3bf1b 117 TYPE_CODE_CHAR, /* *real* character type */
61932a8e
JK
118
119 /* Boolean type. 0 is false, 1 is true, and other values are non-boolean
120 (e.g. FORTRAN "logical" used as unsigned int). */
a91a6192
SS
121 TYPE_CODE_BOOL,
122
123 /* Fortran */
d1f4065e
PB
124 TYPE_CODE_COMPLEX, /* Complex float */
125
4ef1f467
DT
126 TYPE_CODE_TYPEDEF,
127 TYPE_CODE_TEMPLATE, /* C++ template */
128 TYPE_CODE_TEMPLATE_ARG /* C++ template arg */
129
1ab3bf1b
JG
130};
131
95ff889e 132/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
61932a8e
JK
133 alias for TYPE_CODE_STRUCT. This is for DWARF, which has a distinct
134 "class" attribute. Perhaps we should actually have a separate TYPE_CODE
135 so that we can print "class" or "struct" depending on what the debug
136 info said. It's not clear we should bother. */
95ff889e
FF
137
138#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
139
1ab3bf1b
JG
140/* Some bits for the type's flags word. */
141
dda398c3 142/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
4ef1f467 143 type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
1ab3bf1b
JG
144
145#define TYPE_FLAG_UNSIGNED (1 << 0)
146
4ef1f467
DT
147/* No sign for this type. In C++, "char", "signed char", and "unsigned
148 char" are distinct types; so we need an extra flag to indicate the
149 absence ofa sign! */
150
151#define TYPE_FLAG_NOSIGN (1 << 1)
152
065525e3 153/* This appears in a type's flags word if it is a stub type (e.g., if
1ab3bf1b
JG
154 someone referenced a type that wasn't defined in a source file
155 via (struct sir_not_appearing_in_this_film *)). */
156
157#define TYPE_FLAG_STUB (1 << 2)
158
dda398c3 159/* The target type of this type is a stub type, and this type needs to
d1f4065e
PB
160 be updated if it gets un-stubbed in check_typedef.
161 Used for arrays and ranges, in which TYPE_LENGTH of the array/range
162 gets set based on the TYPE_LENGTH of the target type.
163 Also, set for TYPE_CODE_TYPEDEF. */
dda398c3
JK
164
165#define TYPE_FLAG_TARGET_STUB (1 << 3)
4a11eef2 166
4ef1f467
DT
167/* Static type. If this is set, the corresponding type had
168 * a static modifier.
169 * Note: This may be unnecessary, since static data members
170 * are indicated by other means (bitpos == -1)
171 */
172
173#define TYPE_FLAG_STATIC (1 << 4)
174
175/* Constant type. If this is set, the corresponding type has a
176 * const modifier.
177 */
178
179#define TYPE_FLAG_CONST (1 << 5)
180
181/* Volatile type. If this is set, the corresponding type has a
182 * volatile modifier.
183 */
184
185#define TYPE_FLAG_VOLATILE (1 << 6)
186
187
ac954805
SG
188/* This is a function type which appears to have a prototype. We need this
189 for function calls in order to tell us if it's necessary to coerce the args,
4ef1f467
DT
190 or to just do the standard conversions. This is used with a short field. */
191
192#define TYPE_FLAG_PROTOTYPED (1 << 7)
193
194/* This flag is used to indicate that processing for this type
195 is incomplete.
196
197 (Mostly intended for HP platforms, where class methods, for
198 instance, can be encountered before their classes in the debug
199 info; the incomplete type has to be marked so that the class and
200 the method can be assigned correct types.) */
201
202#define TYPE_FLAG_INCOMPLETE (1 << 8)
ac954805 203
ac954805 204
1ab3bf1b
JG
205struct type
206{
207
208 /* Code for kind of type */
209
210 enum type_code code;
211
212 /* Name of this type, or NULL if none.
b4c2267b 213
1ab3bf1b 214 This is used for printing only, except by poorly designed C++ code.
b4c2267b 215 For looking up a name, look for a symbol in the VAR_NAMESPACE. */
1ab3bf1b
JG
216
217 char *name;
218
b4c2267b
JK
219 /* Tag name for this type, or NULL if none. This means that the
220 name of the type consists of a keyword followed by the tag name.
221 Which keyword is determined by the type code ("struct" for
222 TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only languages
223 with this feature.
224
225 This is used for printing only, except by poorly designed C++ code.
065525e3
JK
226 For looking up a name, look for a symbol in the STRUCT_NAMESPACE.
227 One more legitimate use is that if TYPE_FLAG_STUB is set, this is
228 the name to use to look for definitions in other files. */
b2bebdb0
JK
229
230 char *tag_name;
231
a3012272
JK
232 /* Length of storage for a value of this type. Various places pass
233 this to memcpy and such, meaning it must be in units of
234 HOST_CHAR_BIT. Various other places expect they can calculate
235 addresses by adding it and such, meaning it must be in units of
236 TARGET_CHAR_BIT. For some DSP targets, in which HOST_CHAR_BIT
237 will (presumably) be 8 and TARGET_CHAR_BIT will be (say) 32, this
238 is a problem. One fix would be to make this field in bits
239 (requiring that it always be a multiple of HOST_CHAR_BIT and
240 TARGET_CHAR_BIT)--the other choice would be to make it
241 consistently in units of HOST_CHAR_BIT. */
1ab3bf1b
JG
242
243 unsigned length;
244
a91a6192
SS
245 /* FIXME, these should probably be restricted to a Fortran-specific
246 field in some fashion. */
247#define BOUND_CANNOT_BE_DETERMINED 5
248#define BOUND_BY_REF_ON_STACK 4
249#define BOUND_BY_VALUE_ON_STACK 3
250#define BOUND_BY_REF_IN_REG 2
251#define BOUND_BY_VALUE_IN_REG 1
252#define BOUND_SIMPLE 0
253 int upper_bound_type;
254 int lower_bound_type;
255
1ab3bf1b
JG
256 /* Every type is now associated with a particular objfile, and the
257 type is allocated on the type_obstack for that objfile. One problem
258 however, is that there are times when gdb allocates new types while
259 it is not in the process of reading symbols from a particular objfile.
260 Fortunately, these happen when the type being created is a derived
261 type of an existing type, such as in lookup_pointer_type(). So
262 we can just allocate the new type using the same objfile as the
263 existing type, but to do this we need a backpointer to the objfile
264 from the existing type. Yes this is somewhat ugly, but without
265 major overhaul of the internal type system, it can't be avoided
266 for now. */
267
268 struct objfile *objfile;
269
270 /* For a pointer type, describes the type of object pointed to.
271 For an array type, describes the type of the elements.
5c8d3927 272 For a function or method type, describes the type of the return value.
1ab3bf1b 273 For a range type, describes the type of the full range.
ead95f8a 274 For a complex type, describes the type of each coordinate.
1ab3bf1b
JG
275 Unused otherwise. */
276
277 struct type *target_type;
278
279 /* Type that is a pointer to this type.
280 NULL if no such pointer-to type is known yet.
281 The debugger may add the address of such a type
282 if it has to construct one later. */
283
284 struct type *pointer_type;
285
286 /* C++: also need a reference type. */
287
288 struct type *reference_type;
289
4ef1f467
DT
290 /* C-v variant chain. This points to a type that
291 differs from this one only in a const or volatile
292 attribute (or both). The various c-v variants
293 are chained together in a ring. */
294 struct type *cv_type;
295
1ab3bf1b
JG
296 /* Flags about this type. */
297
4ef1f467 298 int flags;
1ab3bf1b
JG
299
300 /* Number of fields described for this type */
301
302 short nfields;
303
304 /* For structure and union types, a description of each field.
305 For set and pascal array types, there is one "field",
306 whose type is the domain type of the set or array.
307 For range types, there are two "fields",
308 the minimum and maximum values (both inclusive).
309 For enum types, each possible value is described by one "field".
27202b6a 310 For a function type, a "field" for each parameter type.
cd46ffad
FF
311 For C++ classes, there is one field for each base class (if it is
312 a derived class) plus one field for each class data member. Member
313 functions are recorded elsewhere.
1ab3bf1b
JG
314
315 Using a pointer to a separate array of fields
316 allows all types to have the same size, which is useful
317 because we can allocate the space for a type before
318 we know what to put in it. */
319
320 struct field
321 {
322
1ab3bf1b 323
f7f37388
PB
324
325 union field_location
326 {
327 /* Position of this field, counting in bits from start of
328 containing structure.
329 For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB.
330 For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB.
331 For a function type, this is the position in the argument list
332 of this argument.
333 For a range bound or enum value, this is the value itself. */
334
335 int bitpos;
336
337 /* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
338 is the location (in the target) of the static field.
339 Otherwise, physname is the mangled label of the static field. */
340
341 CORE_ADDR physaddr;
342 char* physname;
343 } loc;
1ab3bf1b
JG
344
345 /* Size of this field, in bits, or zero if not packed.
346 For an unpacked field, the field's type's length
f7f37388
PB
347 says how many bytes the field occupies.
348 A value of -1 or -2 indicates a static field; -1 means the location
349 is specified by the label loc.physname; -2 means that loc.physaddr
350 specifies the actual address. */
1ab3bf1b 351
f7f37388 352 int bitsize;
1ab3bf1b 353
f7f37388 354 /* In a struct or union type, type of this field.
1ab3bf1b
JG
355 In a function type, type of this argument.
356 In an array type, the domain-type of the array. */
357
358 struct type *type;
359
360 /* Name of field, value or argument.
361 NULL for range bounds and array domains. */
362
363 char *name;
364
365 } *fields;
366
a46d92a7
PS
367 /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE
368 is the base class which defined the virtual function table pointer.
1ab3bf1b 369
a46d92a7
PS
370 For types that are pointer to member types (TYPE_CODE_MEMBER),
371 VPTR_BASETYPE is the type that this pointer is a member of.
372
373 For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate
374 type that contains the method.
1ab3bf1b
JG
375
376 Unused otherwise. */
377
378 struct type *vptr_basetype;
379
ac88287f
JK
380 /* Field number of the virtual function table pointer in
381 VPTR_BASETYPE. If -1, we were unable to find the virtual
382 function table pointer in initial symbol reading, and
383 fill_in_vptr_fieldno should be called to find it if possible.
384
385 Unused if this type does not have virtual functions. */
386
1ab3bf1b
JG
387 int vptr_fieldno;
388
389 /* Slot to point to additional language-specific fields of this type. */
390
391 union type_specific
392 {
393
a46d92a7
PS
394 /* ARG_TYPES is for TYPE_CODE_METHOD.
395 Contains the type of each argument, ending with a void type
396 after the last argument for normal member functions or a NULL
397 pointer after the last argument for functions with variable
398 arguments. */
1ab3bf1b
JG
399
400 struct type **arg_types;
401
8050a57b
FF
402 /* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to
403 cplus_struct_default, a default static instance of a struct
404 cplus_struct_type. */
1ab3bf1b
JG
405
406 struct cplus_struct_type *cplus_stuff;
407
408 } type_specific;
409};
410
411#define NULL_TYPE ((struct type *) 0)
412
413/* C++ language-specific information for TYPE_CODE_STRUCT and TYPE_CODE_UNION
414 nodes. */
415
416struct cplus_struct_type
417{
eec03ebb
JK
418 /* Number of base classes this type derives from. The baseclasses are
419 stored in the first N_BASECLASSES fields (i.e. the `fields' field of
420 the struct type). I think only the `type' field of such a field has
421 any meaning. */
c0f1085b
FF
422
423 short n_baseclasses;
424
425 /* Number of methods with unique names. All overloaded methods with
426 the same name count only once. */
427
428 short nfn_fields;
429
9ed8604f 430 /* Number of methods described for this type, not including the
c0f1085b
FF
431 methods that it derives from. */
432
4ef1f467
DT
433 short nfn_fields_total;
434
435 /* The "declared_type" field contains a code saying how the
436 user really declared this type, e.g., "class s", "union s",
437 "struct s".
438 The 3 above things come out from the C++ compiler looking like classes,
439 but we keep track of the real declaration so we can give
440 the correct information on "ptype". (Note: TEMPLATE may not
441 belong in this list...) */
442
443#define DECLARED_TYPE_CLASS 0
444#define DECLARED_TYPE_UNION 1
445#define DECLARED_TYPE_STRUCT 2
446#define DECLARED_TYPE_TEMPLATE 3
447 short declared_type; /* One of the above codes */
448
cd46ffad
FF
449 /* For derived classes, the number of base classes is given by n_baseclasses
450 and virtual_field_bits is a bit vector containing one bit per base class.
451 If the base class is virtual, the corresponding bit will be set.
452 I.E, given:
453
454 class A{};
455 class B{};
456 class C : public B, public virtual A {};
457
458 B is a baseclass of C; A is a virtual baseclass for C.
459 This is a C++ 2.0 language feature. */
1ab3bf1b 460
8050a57b
FF
461 B_TYPE *virtual_field_bits;
462
463 /* For classes with private fields, the number of fields is given by
464 nfields and private_field_bits is a bit vector containing one bit
465 per field.
466 If the field is private, the corresponding bit will be set. */
1ab3bf1b
JG
467
468 B_TYPE *private_field_bits;
469
8050a57b
FF
470 /* For classes with protected fields, the number of fields is given by
471 nfields and protected_field_bits is a bit vector containing one bit
472 per field.
473 If the field is private, the corresponding bit will be set. */
474
1ab3bf1b
JG
475 B_TYPE *protected_field_bits;
476
024f65b1
KH
477 /* for classes with fields to be ignored, either this is optimized out
478 or this field has length 0 */
479
480 B_TYPE *ignore_field_bits;
481
1ab3bf1b
JG
482 /* For classes, structures, and unions, a description of each field,
483 which consists of an overloaded name, followed by the types of
484 arguments that the method expects, and then the name after it
c0f1085b
FF
485 has been renamed to make it distinct.
486
487 fn_fieldlists points to an array of nfn_fields of these. */
1ab3bf1b
JG
488
489 struct fn_fieldlist
490 {
491
492 /* The overloaded name. */
493
494 char *name;
495
496 /* The number of methods with this name. */
497
498 int length;
499
500 /* The list of methods. */
501
502 struct fn_field
503 {
504
eec03ebb
JK
505 /* If is_stub is clear, this is the mangled name which we can
506 look up to find the address of the method (FIXME: it would
507 be cleaner to have a pointer to the struct symbol here
508 instead). */
509
510 /* If is_stub is set, this is the portion of the mangled
511 name which specifies the arguments. For example, "ii",
512 if there are two int arguments, or "" if there are no
513 arguments. See gdb_mangle_name for the conversion from this
514 format to the one used if is_stub is clear. */
c0f1085b
FF
515
516 char *physname;
517
4ef1f467
DT
518 /* The function type for the method.
519 (This comment used to say "The return value of the method",
520 but that's wrong. The function type
521 is expected here, i.e. something with TYPE_CODE_FUNC,
522 and *not* the return-value type). */
1ab3bf1b
JG
523
524 struct type *type;
525
4ef1f467
DT
526 /* The argument list. Only valid if is_stub is clear. Contains
527 the type of each argument, including `this', and ending with
528 a NULL pointer after the last argument. Should not contain
529 a `this' pointer for static member functions. */
530
531 struct type **args;
532
c0f1085b
FF
533 /* For virtual functions.
534 First baseclass that defines this virtual function. */
1ab3bf1b
JG
535
536 struct type *fcontext;
537
c0f1085b
FF
538 /* Attributes. */
539
1ab3bf1b
JG
540 unsigned int is_const : 1;
541 unsigned int is_volatile : 1;
542 unsigned int is_private : 1;
543 unsigned int is_protected : 1;
eec03ebb
JK
544
545 /* A stub method only has some fields valid (but they are enough
546 to reconstruct the rest of the fields). */
1ab3bf1b 547 unsigned int is_stub : 1;
eec03ebb 548
4ef1f467
DT
549 /* C++ method that is inlined */
550 unsigned int is_inlined : 1;
551
eec03ebb 552 /* Unused. */
4ef1f467 553 unsigned int dummy : 2;
1ab3bf1b
JG
554
555 /* Index into that baseclass's virtual function table,
556 minus 2; else if static: VOFFSET_STATIC; else: 0. */
557
c0f1085b 558 unsigned int voffset : 24;
1ab3bf1b
JG
559
560# define VOFFSET_STATIC 1
561
562 } *fn_fields;
563
564 } *fn_fieldlists;
565
4ef1f467
DT
566 /* If this "struct type" describes a template, then it
567 * has arguments. "template_args" points to an array of
568 * template arg descriptors, of length "ntemplate_args".
569 * The only real information in each of these template arg descriptors
570 * is a name. "type" will typically just point to a "struct type" with
571 * the placeholder TYPE_CODE_TEMPLATE_ARG type.
572 */
573 short ntemplate_args;
574 struct template_arg
575 {
576 char *name;
577 struct type *type;
578 } *template_args;
579
580 /* If this "struct type" describes a template, it has a list
581 * of instantiations. "instantiations" is a pointer to an array
582 * of type's, one representing each instantiation. There
583 * are "ninstantiations" elements in this array.
584 */
585 short ninstantiations;
586 struct type **instantiations;
587
588 /* The following points to information relevant to the runtime model
589 * of the compiler.
590 * Currently being used only for HP's ANSI C++ compiler.
591 * (This type may have to be changed/enhanced for other compilers.)
592 *
593 * RUNTIME_PTR is NULL if there is no runtime information (currently
594 * this means the type was not compiled by HP aCC).
595 *
596 * Fields in structure pointed to:
597 * ->HAS_VTABLE : 0 => no virtual table, 1 => vtable present
598 *
599 * ->PRIMARY_BASE points to the first non-virtual base class that has
600 * a virtual table.
601 *
602 * ->VIRTUAL_BASE_LIST points to a list of struct type * pointers that
603 * point to the type information for all virtual bases among this type's
604 * ancestors.
605 */
606 struct runtime_info {
607 short has_vtable;
608 struct type * primary_base;
609 struct type ** virtual_base_list;
610 } * runtime_ptr;
611
612 /* Pointer to information about enclosing scope, if this is a
613 * local type. If it is not a local type, this is NULL
614 */
615 struct local_type_info {
616 char * file;
617 int line;
618 } * localtype_ptr;
619};
620
621/* Struct used in computing virtual base list */
622struct vbase
623{
624 struct type * vbasetype; /* pointer to virtual base */
625 struct vbase * next; /* next in chain */
626};
627
628/* Struct used for ranking a function for overload resolution */
629struct badness_vector {
630 int length;
631 int * rank;
1ab3bf1b
JG
632};
633
634/* The default value of TYPE_CPLUS_SPECIFIC(T) points to the
635 this shared static structure. */
636
0213d96f 637extern const struct cplus_struct_type cplus_struct_default;
1ab3bf1b
JG
638
639extern void
640allocate_cplus_struct_type PARAMS ((struct type *));
641
642#define INIT_CPLUS_SPECIFIC(type) \
643 (TYPE_CPLUS_SPECIFIC(type)=(struct cplus_struct_type*)&cplus_struct_default)
644#define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
645#define HAVE_CPLUS_STRUCT(type) \
646 (TYPE_CPLUS_SPECIFIC(type) != &cplus_struct_default)
647
648#define TYPE_NAME(thistype) (thistype)->name
b2bebdb0 649#define TYPE_TAG_NAME(type) ((type)->tag_name)
1ab3bf1b
JG
650#define TYPE_TARGET_TYPE(thistype) (thistype)->target_type
651#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
652#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
4ef1f467 653#define TYPE_CV_TYPE(thistype) (thistype)->cv_type
d1f4065e
PB
654/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
655 But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
656 so you only have to call check_typedef once. Since allocate_value
657 calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
1ab3bf1b
JG
658#define TYPE_LENGTH(thistype) (thistype)->length
659#define TYPE_OBJFILE(thistype) (thistype)->objfile
660#define TYPE_FLAGS(thistype) (thistype)->flags
661#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
4ef1f467
DT
662#define TYPE_NOSIGN(thistype) ((thistype)->flags & TYPE_FLAG_NOSIGN)
663#define TYPE_CONST(thistype) ((thistype)->flags & TYPE_FLAG_CONST)
664#define TYPE_VOLATILE(thistype) ((thistype)->flags & TYPE_FLAG_VOLATILE)
665#define TYPE_INCOMPLETE(thistype) ((thistype)->flags & TYPE_FLAG_INCOMPLETE)
d1f4065e
PB
666/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you wan the real
667 type, you need to do TYPE_CODE (check_type (this_type)). */
1ab3bf1b
JG
668#define TYPE_CODE(thistype) (thistype)->code
669#define TYPE_NFIELDS(thistype) (thistype)->nfields
670#define TYPE_FIELDS(thistype) (thistype)->fields
4ef1f467
DT
671#define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
672#define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations
1ab3bf1b 673
6f52d064 674#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
cba00921
PB
675#define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0)
676#define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1)
cba00921 677
a91a6192
SS
678/* Moto-specific stuff for FORTRAN arrays */
679
680#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) (thistype)->upper_bound_type
681#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) (thistype)->lower_bound_type
682
683#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
684 (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1))
685
686#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
687 (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0))
688
1ab3bf1b
JG
689/* C++ */
690
691#define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype
692#define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype
693#define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno
694#define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields
695#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
696#define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total
4ef1f467
DT
697#define TYPE_NTEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ntemplate_args
698#define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations
699#define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type
1ab3bf1b
JG
700#define TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific
701#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types
702#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff
703#define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type
704#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
705#define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name
f7f37388 706#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
4ef1f467
DT
707#define BASETYPE_VIA_PUBLIC(thistype, index) \
708 ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
709
1ab3bf1b 710#define BASETYPE_VIA_VIRTUAL(thistype, index) \
4ef1f467
DT
711 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
712 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
1ab3bf1b 713
f7f37388
PB
714#define FIELD_TYPE(thisfld) ((thisfld).type)
715#define FIELD_NAME(thisfld) ((thisfld).name)
716#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
717#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
718#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname)
719#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
720#define SET_FIELD_PHYSNAME(thisfld, name) \
721 ((thisfld).bitsize = -1, FIELD_PHYSNAME(thisfld) = (name))
722#define SET_FIELD_PHYSADDR(thisfld, name) \
723 ((thisfld).bitsize = -2, FIELD_PHYSADDR(thisfld) = (name))
1ab3bf1b 724#define TYPE_FIELD(thistype, n) (thistype)->fields[n]
f7f37388
PB
725#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
726#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
727#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
728#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
729#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
4ef1f467
DT
730#define TYPE_TEMPLATE_ARG(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->template_args[n]
731#define TYPE_INSTANTIATION(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->instantiations[n]
1ab3bf1b
JG
732
733#define TYPE_FIELD_PRIVATE_BITS(thistype) \
734 TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
735#define TYPE_FIELD_PROTECTED_BITS(thistype) \
736 TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
024f65b1
KH
737#define TYPE_FIELD_IGNORE_BITS(thistype) \
738 TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
1ab3bf1b
JG
739#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
740 TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
741#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
742 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
743#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
744 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
024f65b1
KH
745#define SET_TYPE_FIELD_IGNORE(thistype, n) \
746 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
1ab3bf1b
JG
747#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
748 B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
749#define TYPE_FIELD_PRIVATE(thistype, n) \
750 (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
751 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
752#define TYPE_FIELD_PROTECTED(thistype, n) \
753 (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
754 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
024f65b1
KH
755#define TYPE_FIELD_IGNORE(thistype, n) \
756 (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
757 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
1ab3bf1b 758#define TYPE_FIELD_VIRTUAL(thistype, n) \
4ef1f467
DT
759 (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
760 : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
1ab3bf1b 761
f7f37388
PB
762#define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitsize < 0)
763#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) ((thistype)->fields[n].bitsize == -2)
764#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n))
765#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n))
1ab3bf1b
JG
766
767#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
768#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
769#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
770#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
771#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
772
773#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
c0f1085b 774#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
1ab3bf1b
JG
775#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
776#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type)
c0f1085b
FF
777#define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
778#define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
1ab3bf1b
JG
779#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
780#define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
c0f1085b 781#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
4ef1f467 782#define TYPE_FN_FIELD_INLINED(thisfn, n) ((thisfn)[n].is_inlined)
c0f1085b
FF
783#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
784#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
785#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
786#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
1ab3bf1b 787
4ef1f467
DT
788#define TYPE_RUNTIME_PTR(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->runtime_ptr)
789#define TYPE_VTABLE(thistype) (TYPE_RUNTIME_PTR(thistype)->has_vtable)
790#define TYPE_HAS_VTABLE(thistype) (TYPE_RUNTIME_PTR(thistype) && TYPE_VTABLE(thistype))
791#define TYPE_PRIMARY_BASE(thistype) (TYPE_RUNTIME_PTR(thistype)->primary_base)
792#define TYPE_VIRTUAL_BASE_LIST(thistype) (TYPE_RUNTIME_PTR(thistype)->virtual_base_list)
793
794#define TYPE_LOCALTYPE_PTR(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr)
795#define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
796#define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
797
798#define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) || \
799 (TYPE_CODE (thistype) == TYPE_CODE_UNION)) && \
800 (TYPE_NFIELDS (thistype) == 0) && \
801 (TYPE_CPLUS_SPECIFIC (thistype) && (TYPE_NFN_FIELDS (thistype) == 0)))
802
803
804
980714f9 805/* Implicit sizes */
1ab3bf1b
JG
806extern struct type *builtin_type_void;
807extern struct type *builtin_type_char;
808extern struct type *builtin_type_short;
809extern struct type *builtin_type_int;
810extern struct type *builtin_type_long;
04f27ddc 811extern struct type *builtin_type_signed_char;
1ab3bf1b
JG
812extern struct type *builtin_type_unsigned_char;
813extern struct type *builtin_type_unsigned_short;
814extern struct type *builtin_type_unsigned_int;
815extern struct type *builtin_type_unsigned_long;
816extern struct type *builtin_type_float;
817extern struct type *builtin_type_double;
818extern struct type *builtin_type_long_double;
819extern struct type *builtin_type_complex;
820extern struct type *builtin_type_double_complex;
c4413e2c 821extern struct type *builtin_type_string;
4ef1f467 822extern struct type *builtin_type_bool;
1ab3bf1b 823
980714f9
AC
824/* Explicit sizes - see <intypes.h> for naming schema */
825extern struct type *builtin_type_int8;
826extern struct type *builtin_type_uint8;
827extern struct type *builtin_type_int16;
828extern struct type *builtin_type_uint16;
829extern struct type *builtin_type_int32;
830extern struct type *builtin_type_uint32;
831extern struct type *builtin_type_int64;
832extern struct type *builtin_type_uint64;
833/* start-sanitize-r5900 */
834extern struct type *builtin_type_int128;
835extern struct type *builtin_type_uint128;
836/* end-sanitize-r5900 */
837
1ab3bf1b
JG
838/* This type represents a type that was unrecognized in symbol
839 read-in. */
840
841extern struct type *builtin_type_error;
842
843extern struct type *builtin_type_long_long;
844extern struct type *builtin_type_unsigned_long_long;
845
846/* Modula-2 types */
847
848extern struct type *builtin_type_m2_char;
849extern struct type *builtin_type_m2_int;
850extern struct type *builtin_type_m2_card;
851extern struct type *builtin_type_m2_real;
852extern struct type *builtin_type_m2_bool;
853
e58de8a2
FF
854/* Chill types */
855
856extern struct type *builtin_type_chill_bool;
2e66cf7d 857extern struct type *builtin_type_chill_char;
e58de8a2
FF
858extern struct type *builtin_type_chill_long;
859extern struct type *builtin_type_chill_ulong;
860extern struct type *builtin_type_chill_real;
861
a91a6192
SS
862/* Fortran (F77) types */
863
864extern struct type *builtin_type_f_character;
865extern struct type *builtin_type_f_integer;
866extern struct type *builtin_type_f_logical;
867extern struct type *builtin_type_f_logical_s1;
868extern struct type *builtin_type_f_logical_s2;
869extern struct type *builtin_type_f_integer;
870extern struct type *builtin_type_f_integer_s2;
871extern struct type *builtin_type_f_real;
872extern struct type *builtin_type_f_real_s8;
873extern struct type *builtin_type_f_real_s16;
874extern struct type *builtin_type_f_complex_s8;
875extern struct type *builtin_type_f_complex_s16;
876extern struct type *builtin_type_f_complex_s32;
877extern struct type *builtin_type_f_void;
878
4ef1f467
DT
879/* RTTI for C++ */
880/* extern struct type *builtin_type_cxx_typeinfo; */
881
1ab3bf1b
JG
882/* Maximum and minimum values of built-in types */
883
884#define MAX_OF_TYPE(t) \
885 TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) \
886 : MAX_OF_SIZE(TYPE_LENGTH(t))
887
888#define MIN_OF_TYPE(t) \
889 TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
890 : MIN_OF_SIZE(TYPE_LENGTH(t))
891
dac9734e
FF
892/* Allocate space for storing data associated with a particular type.
893 We ensure that the space is allocated using the same mechanism that
894 was used to allocate the space for the type structure itself. I.E.
895 if the type is on an objfile's type_obstack, then the space for data
896 associated with that type will also be allocated on the type_obstack.
897 If the type is not associated with any particular objfile (such as
898 builtin types), then the data space will be allocated with xmalloc,
899 the same as for the type structure. */
900
901#define TYPE_ALLOC(t,size) \
92a87f6a 902 (TYPE_OBJFILE (t) != NULL \
dac9734e 903 ? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \
92a87f6a 904 : xmalloc (size))
dac9734e 905
1ab3bf1b
JG
906extern struct type *
907alloc_type PARAMS ((struct objfile *));
908
909extern struct type *
910init_type PARAMS ((enum type_code, int, int, char *, struct objfile *));
911
912extern struct type *
913lookup_reference_type PARAMS ((struct type *));
914
ea1549b3
JG
915extern struct type *
916make_reference_type PARAMS ((struct type *, struct type **));
917
4ef1f467
DT
918extern struct type *
919make_cv_type PARAMS ((int, int, struct type *, struct type **));
920
1ab3bf1b
JG
921extern struct type *
922lookup_member_type PARAMS ((struct type *, struct type *));
923
924extern void
925smash_to_method_type PARAMS ((struct type *, struct type *, struct type *,
926 struct type **));
927
928extern void
929smash_to_member_type PARAMS ((struct type *, struct type *, struct type *));
930
931extern struct type *
932allocate_stub_method PARAMS ((struct type *));
933
934extern char *
935type_name_no_tag PARAMS ((const struct type *));
936
937extern struct type *
938lookup_struct_elt_type PARAMS ((struct type *, char *, int));
939
ea1549b3
JG
940extern struct type *
941make_pointer_type PARAMS ((struct type *, struct type **));
942
1ab3bf1b
JG
943extern struct type *
944lookup_pointer_type PARAMS ((struct type *));
945
ea1549b3
JG
946extern struct type *
947make_function_type PARAMS ((struct type *, struct type **));
948
1ab3bf1b
JG
949extern struct type *
950lookup_function_type PARAMS ((struct type *));
951
952extern struct type *
a8a69e63
FF
953create_range_type PARAMS ((struct type *, struct type *, int, int));
954
955extern struct type *
956create_array_type PARAMS ((struct type *, struct type *, struct type *));
1ab3bf1b 957
c4413e2c
FF
958extern struct type *
959create_string_type PARAMS ((struct type *, struct type *));
960
e44075d3
JK
961extern struct type *create_set_type PARAMS ((struct type *, struct type *));
962
f91a9e05
PB
963extern int chill_varying_type PARAMS ((struct type*));
964
1ab3bf1b
JG
965extern struct type *
966lookup_unsigned_typename PARAMS ((char *));
967
a252e715
PB
968extern struct type *
969lookup_signed_typename PARAMS ((char *));
970
d1f4065e
PB
971extern struct type *
972check_typedef PARAMS ((struct type *));
973
974#define CHECK_TYPEDEF(TYPE) (TYPE) = check_typedef (TYPE)
1ab3bf1b
JG
975
976extern void
977check_stub_method PARAMS ((struct type *, int, int));
978
979extern struct type *
980lookup_primitive_typename PARAMS ((char *));
981
982extern char *
983gdb_mangle_name PARAMS ((struct type *, int, int));
984
985extern struct type *
986builtin_type PARAMS ((char **));
987
1ab3bf1b
JG
988extern struct type *
989lookup_typename PARAMS ((char *, struct block *, int));
990
991extern struct type *
992lookup_template_type PARAMS ((char *, struct type *, struct block *));
993
994extern struct type *
995lookup_fundamental_type PARAMS ((struct objfile *, int));
996
be772100
JG
997extern void
998fill_in_vptr_fieldno PARAMS ((struct type *));
999
a46d92a7
PS
1000extern int get_destructor_fn_field PARAMS ((struct type *, int *, int *));
1001
706bfe5a
PB
1002extern int get_discrete_bounds PARAMS ((struct type*, LONGEST*, LONGEST*));
1003
4ef1f467
DT
1004extern int
1005get_discrete_bounds PARAMS ((struct type*, LONGEST*, LONGEST*));
1006
1007extern int
1008is_ancestor PARAMS ((struct type *, struct type *));
1009
1010extern int
1011has_vtable PARAMS ((struct type *));
1012
1013extern struct type *
1014primary_base_class PARAMS ((struct type *));
1015
1016extern struct type **
1017virtual_base_list PARAMS ((struct type *));
1018
1019extern int
1020virtual_base_list_length PARAMS ((struct type *));
1021extern int
1022virtual_base_list_length_skip_primaries PARAMS ((struct type *));
1023
1024extern int
1025virtual_base_index PARAMS ((struct type *, struct type *));
1026extern int
1027virtual_base_index_skip_primaries PARAMS ((struct type *, struct type *));
1028
1029
1030extern int
1031class_index_in_primary_list PARAMS ((struct type *));
1032
1033extern int
1034count_virtual_fns PARAMS ((struct type*));
1035
1036/* Constants for HP/Taligent ANSI C++ runtime model */
1037
1038/* Where virtual function entries begin in the
1039 * virtual table, in the non-RRBC vtable format.
1040 * First 4 are the metavtable pointer, top offset,
1041 * typeinfo pointer, and dup base info pointer */
1042#define HP_ACC_VFUNC_START 4
1043
1044/* (Negative) Offset where virtual base offset entries begin
1045 * in the virtual table. Skips over metavtable pointer and
1046 * the self-offset entry.
1047 * NOTE: NEGATE THIS BEFORE USING! The virtual base offsets
1048 * appear before the address point of the vtable (the slot
1049 * pointed to by the object's vtable pointer), i.e. at lower
1050 * addresses than the vtable pointer. */
1051#define HP_ACC_VBASE_START 2
1052
1053/* (Positive) Offset where the pointer to the typeinfo
1054 * object is present in the virtual table */
1055#define HP_ACC_TYPEINFO_OFFSET 2
1056
1057/* (Positive) Offset where the ``top offset'' entry of
1058 * the virtual table is */
1059#define HP_ACC_TOP_OFFSET_OFFSET 1
1060
1061/* Overload resolution */
1062
1063#define LENGTH_MATCH(bv) ((bv)->rank[0])
1064
1065/* Badness if parameter list length doesn't match arg list length */
1066#define LENGTH_MISMATCH_BADNESS 100
1067/* Dummy badness value for nonexistent parameter positions */
1068#define TOO_FEW_PARAMS_BADNESS 100
1069/* Badness if no conversion among types */
1070#define INCOMPATIBLE_TYPE_BADNESS 100
1071/* Badness of coercing large integer to smaller size */
1072#define INTEGER_COERCION_BADNESS 100
1073/* Badness of coercing large floating type to smaller size */
1074#define FLOAT_COERCION_BADNESS 100
1075
1076/* Badness of integral promotion */
1077#define INTEGER_PROMOTION_BADNESS 1
1078/* Badness of floating promotion */
1079#define FLOAT_PROMOTION_BADNESS 1
1080/* Badness of integral conversion */
1081#define INTEGER_CONVERSION_BADNESS 2
1082/* Badness of floating conversion */
1083#define FLOAT_CONVERSION_BADNESS 2
1084/* Badness of integer<->floating conversions */
1085#define INT_FLOAT_CONVERSION_BADNESS 2
1086/* Badness of converting to a boolean */
1087#define BOOLEAN_CONVERSION_BADNESS 2
1088/* Badness of pointer conversion */
1089#define POINTER_CONVERSION_BADNESS 2
1090/* Badness of conversion of pointer to void pointer */
1091#define VOID_PTR_CONVERSION_BADNESS 2
1092/* Badness of convering derived to base class */
1093#define BASE_CONVERSION_BADNESS 2
1094
1095/* Non-standard conversions allowed by the debugger */
1096/* Converting a pointer to an int is usually OK */
1097#define NS_POINTER_CONVERSION_BADNESS 10
1098
1099
1100extern int
1101compare_badness PARAMS ((struct badness_vector *, struct badness_vector *));
1102
1103extern struct badness_vector *
1104rank_function PARAMS ((struct type **, int, struct type **, int));
1105
1106extern int
1107rank_one_type PARAMS ((struct type *, struct type *));
1108
1109
0239d9b3
FF
1110#if MAINTENANCE_CMDS
1111extern void recursive_dump_type PARAMS ((struct type *, int));
1112#endif
1113
1ab3bf1b
JG
1114/* printcmd.c */
1115
1116extern void
199b2450 1117print_scalar_formatted PARAMS ((char *, struct type *, int, int, GDB_FILE *));
1ab3bf1b 1118
9c036bd8
JK
1119extern int can_dereference PARAMS ((struct type *));
1120
0239d9b3
FF
1121#if MAINTENANCE_CMDS
1122extern void maintenance_print_type PARAMS ((char *, int));
1123#endif
1124
b607efe7
FF
1125/* typeprint.c */
1126
1127extern void print_type_scalar PARAMS ((struct type *, LONGEST, GDB_FILE *));
1128
1ab3bf1b 1129#endif /* GDBTYPES_H */
This page took 0.458506 seconds and 4 git commands to generate.