diff options
author | J. Brobecker <brobecker@gnat.com> | 2004-01-17 05:30:48 +0000 |
---|---|---|
committer | Joel Brobecker <brobecke@gcc.gnu.org> | 2004-01-17 05:30:48 +0000 |
commit | e7d23ce3b5d32958e32f57dd291d0068ed2b5849 (patch) | |
tree | e517b60a446030d1672b32891c55247f48c9405e /gcc | |
parent | cf5da2b9d8ff2725bc2eb90795ff8472c0102b80 (diff) | |
download | gcc-e7d23ce3b5d32958e32f57dd291d0068ed2b5849.zip gcc-e7d23ce3b5d32958e32f57dd291d0068ed2b5849.tar.gz gcc-e7d23ce3b5d32958e32f57dd291d0068ed2b5849.tar.bz2 |
dwarf2out.c (is_subrange_type): Renamed from is_ada_subrange_type().
* dwarf2out.c (is_subrange_type): Renamed from is_ada_subrange_type().
Remove checks for is_ada() and TREE_UNSIGNED.
(subrange_type_die): Emit a byte_size attribute if the subrange
type size is different from the base type size.
(modified_type_die): Replace call to is_ada_subrange_type() by
call to is_subrange_type().
From-SVN: r76025
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 30 |
2 files changed, 23 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 72abddb..943fd3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-01-17 J. Brobecker <brobecker at gnat dot com> + + * dwarf2out.c (is_subrange_type): Renamed from is_ada_subrange_type(). + Remove checks for is_ada() and TREE_UNSIGNED. + (subrange_type_die): Emit a byte_size attribute if the subrange + type size is different from the base type size. + (modified_type_die): Replace call to is_ada_subrange_type() by + call to is_subrange_type(). + 2004-01-16 Andrew Pinski <pinskia@physics.uc.edu> * config/sh/sh.c: Include ggc.h. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 77d5fd2..51c0f1c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3703,7 +3703,7 @@ static void output_file_names (void); static dw_die_ref base_type_die (tree); static tree root_type (tree); static int is_base_type (tree); -static bool is_ada_subrange_type (tree); +static bool is_subrange_type (tree); static dw_die_ref subrange_type_die (tree, dw_die_ref); static dw_die_ref modified_type_die (tree, int, int, dw_die_ref); static int type_is_enum (tree); @@ -7812,24 +7812,14 @@ simple_type_size_in_bits (tree type) emitted as a subrange type. */ static inline bool -is_ada_subrange_type (tree type) -{ - /* We should use a subrange type in the following situations: - - For Ada modular types: These types are stored as integer subtypes - of an unsigned integer type; - - For subtypes of an Ada enumeration type: These types are stored - as integer subtypes of enumeral types. - - This subrange type is mostly for the benefit of debugger users. - A nameless type would therefore not be very useful, so no need - to generate a subrange type in these cases. */ +is_subrange_type (tree type) +{ tree subtype = TREE_TYPE (type); - if (is_ada () - && TREE_CODE (type) == INTEGER_TYPE + if (TREE_CODE (type) == INTEGER_TYPE && subtype != NULL_TREE) { - if (TREE_CODE (subtype) == INTEGER_TYPE && TREE_UNSIGNED (subtype)) + if (TREE_CODE (subtype) == INTEGER_TYPE) return true; if (TREE_CODE (subtype) == ENUMERAL_TYPE) return true; @@ -7846,6 +7836,7 @@ subrange_type_die (tree type, dw_die_ref context_die) dw_die_ref subtype_die; dw_die_ref subrange_die; tree name = TYPE_NAME (type); + const HOST_WIDE_INT size_in_bytes = int_size_in_bytes (type); if (context_die == NULL) context_die = comp_unit_die; @@ -7864,6 +7855,13 @@ subrange_type_die (tree type, dw_die_ref context_die) add_name_attribute (subrange_die, IDENTIFIER_POINTER (name)); } + if (int_size_in_bytes (TREE_TYPE (type)) != size_in_bytes) + { + /* The size of the subrange type and its base type do not match, + so we need to generate a size attribute for the subrange type. */ + add_AT_unsigned (subrange_die, DW_AT_byte_size, size_in_bytes); + } + if (TYPE_MIN_VALUE (type) != NULL) add_bound_info (subrange_die, DW_AT_lower_bound, TYPE_MIN_VALUE (type)); @@ -7966,7 +7964,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, #endif item_type = TREE_TYPE (type); } - else if (is_ada_subrange_type (type)) + else if (is_subrange_type (type)) mod_type_die = subrange_type_die (type, context_die); else if (is_base_type (type)) mod_type_die = base_type_die (type); |