diff options
author | brobecke <brobecke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-17 05:30:48 +0000 |
---|---|---|
committer | brobecke <brobecke@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-17 05:30:48 +0000 |
commit | 6114cbf0b4176b895af5a8a380314a4cc6d84cb0 (patch) | |
tree | e517b60a446030d1672b32891c55247f48c9405e /gcc | |
parent | 774bee36d841eee94fed0322c584eebde6fa9630 (diff) | |
download | gcc-6114cbf0b4176b895af5a8a380314a4cc6d84cb0.tar.gz |
* 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().
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76025 138bc75d-0d04-0410-961f-82ee72b054a4
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 72abddbbb1a..943fd3e1ee2 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 77d5fd2bfb8..51c0f1c4297 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); |