/* Internal type definitions for GDB.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
-/* Some bits for the type's flags word. */
+/* Some bits for the type's flags word, and macros to test them. */
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
#define TYPE_FLAG_UNSIGNED (1 << 0)
+#define TYPE_UNSIGNED(t) ((t)->flags & TYPE_FLAG_UNSIGNED)
/* No sign for this type. In C++, "char", "signed char", and "unsigned
char" are distinct types; so we need an extra flag to indicate the
absence of a sign! */
#define TYPE_FLAG_NOSIGN (1 << 1)
+#define TYPE_NOSIGN(t) ((t)->flags & TYPE_FLAG_NOSIGN)
/* This appears in a type's flags word if it is a stub type (e.g., if
someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
#define TYPE_FLAG_STUB (1 << 2)
+#define TYPE_STUB(t) ((t)->flags & TYPE_FLAG_STUB)
/* The target type of this type is a stub type, and this type needs to
be updated if it gets un-stubbed in check_typedef.
gets set based on the TYPE_LENGTH of the target type.
Also, set for TYPE_CODE_TYPEDEF. */
-#define TYPE_FLAG_TARGET_STUB (1 << 3)
+#define TYPE_FLAG_TARGET_STUB (1 << 3)
+#define TYPE_TARGET_STUB(t) ((t)->flags & TYPE_FLAG_TARGET_STUB)
/* Static type. If this is set, the corresponding type had
* a static modifier.
* are indicated by other means (bitpos == -1)
*/
-#define TYPE_FLAG_STATIC (1 << 4)
+#define TYPE_FLAG_STATIC (1 << 4)
+#define TYPE_STATIC(t) ((t)->flags & TYPE_FLAG_STATIC)
/* Constant type. If this is set, the corresponding type has a
* const modifier.
*/
-#define TYPE_FLAG_CONST (1 << 5)
+#define TYPE_FLAG_CONST (1 << 5)
+#define TYPE_CONST(t) ((t)->flags & TYPE_FLAG_CONST)
/* Volatile type. If this is set, the corresponding type has a
* volatile modifier.
*/
-#define TYPE_FLAG_VOLATILE (1 << 6)
+#define TYPE_FLAG_VOLATILE (1 << 6)
+#define TYPE_VOLATILE(t) ((t)->flags & TYPE_FLAG_VOLATILE)
/* This is a function type which appears to have a prototype. We need this
for function calls in order to tell us if it's necessary to coerce the args,
or to just do the standard conversions. This is used with a short field. */
-#define TYPE_FLAG_PROTOTYPED (1 << 7)
+#define TYPE_FLAG_PROTOTYPED (1 << 7)
+#define TYPE_PROTOTYPED(t) ((t)->flags & TYPE_FLAG_PROTOTYPED)
/* This flag is used to indicate that processing for this type
is incomplete.
info; the incomplete type has to be marked so that the class and
the method can be assigned correct types.) */
-#define TYPE_FLAG_INCOMPLETE (1 << 8)
+#define TYPE_FLAG_INCOMPLETE (1 << 8)
+#define TYPE_INCOMPLETE(t) ((t)->flags & TYPE_FLAG_INCOMPLETE)
+/* Instruction-space delimited type. This is for Harvard architectures
+ which have separate instruction and data address spaces (and perhaps
+ others).
+
+ GDB usually defines a flat address space that is a superset of the
+ architecture's two (or more) address spaces, but this is an extension
+ of the architecture's model.
+
+ If TYPE_FLAG_INST is set, an object of the corresponding type
+ resides in instruction memory, even if its address (in the extended
+ flat address space) does not reflect this.
+
+ Similarly, if TYPE_FLAG_DATA is set, then an object of the
+ corresponding type resides in the data memory space, even if
+ this is not indicated by its (flat address space) address.
+
+ If neither flag is set, the default space for functions / methods
+ is instruction space, and for data objects is data memory. */
+
+#define TYPE_FLAG_CODE_SPACE (1 << 9)
+#define TYPE_CODE_SPACE(t) ((t)->flags & TYPE_FLAG_CODE_SPACE)
+
+#define TYPE_FLAG_DATA_SPACE (1 << 10)
+#define TYPE_DATA_SPACE(t) ((t)->flags & TYPE_FLAG_DATA_SPACE)
+
+/* FIXME: Kludge to mark a varargs function type for C++ member
+ function argument processing. Currently only used in dwarf2read.c,
+ but put it here so we won't accidentally overload the bit with
+ another flag. */
+
+#define TYPE_FLAG_VARARGS (1 << 11)
+#define TYPE_VARARGS(t) ((t)->flags & TYPE_FLAG_VARARGS)
struct type
{
are chained together in a ring. */
struct type *cv_type;
+ /* Address-space delimited variant chain. This points to a type
+ that differs from this one only in an address-space qualifier
+ attribute. The otherwise-identical address-space delimited
+ types are chained together in a ring. */
+ struct type *as_type;
+
/* Flags about this type. */
int flags;
struct field
{
-
-
-
union field_location
{
/* Position of this field, counting in bits from start of
containing structure.
For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB.
For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB.
- For a function type, this is the position in the argument list
- of this argument.
For a range bound or enum value, this is the value itself. */
int bitpos;
CORE_ADDR physaddr;
char *physname;
+
+ /* For a function type, this is 1 if the argument is marked
+ artificial. Artificial arguments should not be shown to the
+ user. */
+ int artificial;
}
loc;
unsigned int is_final:1;
unsigned int is_synchronized:1;
unsigned int is_native:1;
+ unsigned int is_artificial:1;
/* A stub method only has some fields valid (but they are enough
to reconstruct the rest of the fields). */
unsigned int is_inlined:1;
/* Unused. */
- unsigned int dummy:4;
+ unsigned int dummy:3;
/* Index into that baseclass's virtual function table,
minus 2; else if static: VOFFSET_STATIC; else: 0. */
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_CV_TYPE(thistype) (thistype)->cv_type
+#define TYPE_AS_TYPE(thistype) (thistype)->as_type
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value
#define TYPE_LENGTH(thistype) (thistype)->length
#define TYPE_OBJFILE(thistype) (thistype)->objfile
#define TYPE_FLAGS(thistype) (thistype)->flags
-#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
-#define TYPE_NOSIGN(thistype) ((thistype)->flags & TYPE_FLAG_NOSIGN)
-#define TYPE_CONST(thistype) ((thistype)->flags & TYPE_FLAG_CONST)
-#define TYPE_VOLATILE(thistype) ((thistype)->flags & TYPE_FLAG_VOLATILE)
-#define TYPE_INCOMPLETE(thistype) ((thistype)->flags & TYPE_FLAG_INCOMPLETE)
-/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you wan the real
+/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
type, you need to do TYPE_CODE (check_type (this_type)). */
#define TYPE_CODE(thistype) (thistype)->code
#define TYPE_NFIELDS(thistype) (thistype)->nfields
#define FIELD_TYPE(thisfld) ((thisfld).type)
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+#define FIELD_ARTIFICIAL(thisfld) ((thisfld).loc.artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname)
#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
+#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
#define TYPE_TEMPLATE_ARG(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->template_args[n]
#define TYPE_FN_FIELD_FINAL(thisfn, n) ((thisfn)[n].is_final)
#define TYPE_FN_FIELD_SYNCHRONIZED(thisfn, n) ((thisfn)[n].is_synchronized)
#define TYPE_FN_FIELD_NATIVE(thisfn, n) ((thisfn)[n].is_native)
+#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
#define TYPE_FN_FIELD_ABSTRACT(thisfn, n) ((thisfn)[n].is_abstract)
#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
#define TYPE_FN_FIELD_INLINED(thisfn, n) ((thisfn)[n].is_inlined)
extern struct type *builtin_type_uint32;
extern struct type *builtin_type_int64;
extern struct type *builtin_type_uint64;
+extern struct type *builtin_type_int128;
+extern struct type *builtin_type_uint128;
/* SIMD types. We inherit these names from GCC. */
extern struct type *builtin_type_v4sf;
extern struct type *builtin_type_v4si;
+extern struct type *builtin_type_v16qi;
extern struct type *builtin_type_v8qi;
+extern struct type *builtin_type_v8hi;
extern struct type *builtin_type_v4hi;
extern struct type *builtin_type_v2si;
+/* Type for 128 bit vectors. */
+extern struct type *builtin_type_vec128;
+
/* Explicit floating-point formats. See "floatformat.h". */
extern struct type *builtin_type_ieee_single_big;
extern struct type *builtin_type_ieee_single_little;
extern struct type *make_cv_type (int, int, struct type *, struct type **);
+extern void finish_cv_type (struct type *);
+
+extern void replace_type (struct type *, struct type *);
+
+extern int address_space_name_to_int (char *);
+
+extern char *address_space_int_to_name (int);
+
+extern struct type *make_type_with_address_space (struct type *type,
+ int space_identifier);
+
extern struct type *lookup_member_type (struct type *, struct type *);
extern void