+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.
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);
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;
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;
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));
#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);