diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-10-22 20:11:56 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-10-22 20:11:56 +0000 |
commit | 4af8819895fd82c3bfad1163e988f9e9fdc689d6 (patch) | |
tree | 00a13e97c123eea52e76fd7e0d9f25060b453dcd /gdb/gdbtypes.c | |
parent | 20924a554d8569f81a83381e50a5c8057f635870 (diff) | |
download | binutils-gdb-4af8819895fd82c3bfad1163e988f9e9fdc689d6.tar.gz |
* gdbtypes.c (copy_type): New function.
* gdbtypes.h (copy_type): Add declaration.
* ada-lang.c (ada_to_fixed_type_1): If there is a parallel XVZ
variable, then use it.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 2029d5d20aa..b5a5de0e5ee 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3040,6 +3040,28 @@ copy_type_recursive (struct objfile *objfile, return new_type; } +/* Make a copy of the given TYPE, except that the pointer & reference + types are not preserved. + + This function assumes that the given type has an associated objfile. + This objfile is used to allocate the new type. */ + +struct type * +copy_type (const struct type *type) +{ + struct type *new_type; + + gdb_assert (TYPE_OBJFILE (type) != NULL); + + new_type = alloc_type (TYPE_OBJFILE (type)); + TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); + TYPE_LENGTH (new_type) = TYPE_LENGTH (type); + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), + sizeof (struct main_type)); + + return new_type; +} + static struct type * build_flt (int bit, char *name, const struct floatformat **floatformats) { |