diff options
author | Kevin Buettner <kevinb@redhat.com> | 2003-02-07 21:44:01 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2003-02-07 21:44:01 +0000 |
commit | ab5d3da63efa59d189371fb2caedf3ed20667e60 (patch) | |
tree | 5e04a6fb3628fc09f9c5ab5ce227883be2ecdee3 /gdb/gdbtypes.c | |
parent | 5e1e138d28f6dda01f3e049f399ad54bf69cabbd (diff) | |
download | binutils-gdb-ab5d3da63efa59d189371fb2caedf3ed20667e60.tar.gz |
Move ``length'' from struct main_type to struct type.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f93b36b083d..67567d9809c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -469,6 +469,9 @@ make_qualified_type (struct type *type, int new_flags, /* Now set the instance flags and return the new type. */ TYPE_INSTANCE_FLAGS (ntype) = new_flags; + /* Set length of new type to that of the original type. */ + TYPE_LENGTH (ntype) = TYPE_LENGTH (type); + return ntype; } @@ -556,10 +559,26 @@ make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr) void replace_type (struct type *ntype, struct type *type) { - struct type *cv_chain, *as_chain, *ptr, *ref; + struct type *chain; *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type); + /* The type length is not a part of the main type. Update it for each + type on the variant chain. */ + chain = ntype; + do { + /* Assert that this element of the chain has no address-class bits + set in its flags. Such type variants might have type lengths + which are supposed to be different from the non-address-class + variants. This assertion shouldn't ever be triggered because + symbol readers which do construct address-class variants don't + call replace_type(). */ + gdb_assert (TYPE_ADDRESS_CLASS_ALL (chain) == 0); + + TYPE_LENGTH (ntype) = TYPE_LENGTH (type); + chain = TYPE_CHAIN (chain); + } while (ntype != chain); + /* Assert that the two types have equivalent instance qualifiers. This should be true for at least all of our debug readers. */ gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type)); |