/* Else cv-qualified version of named type; fall through. */
}
- if (is_const_type)
+ if (is_const_type
+ /* If both is_const_type and is_volatile_type, prefer the path
+ which leads to a qualified type. */
+ && (!is_volatile_type
+ || get_qualified_type (type, TYPE_QUAL_CONST) == NULL_TREE
+ || get_qualified_type (type, TYPE_QUAL_VOLATILE) != NULL_TREE))
{
mod_type_die = new_die (DW_TAG_const_type, comp_unit_die (), type);
sub_die = modified_type_die (type, 0, is_volatile_type, context_die);
else if (is_volatile_type)
{
mod_type_die = new_die (DW_TAG_volatile_type, comp_unit_die (), type);
- sub_die = modified_type_die (type, 0, 0, context_die);
+ sub_die = modified_type_die (type, is_const_type, 0, context_die);
}
else if (code == POINTER_TYPE)
{
/* FALLTHRU */
case PARM_DECL:
+ case RESULT_DECL:
if (DECL_HAS_VALUE_EXPR_P (loc))
return loc_list_from_tree (DECL_VALUE_EXPR (loc),
want_address);
/* FALLTHRU */
- case RESULT_DECL:
case FUNCTION_DECL:
{
rtx rtl;
add_prototyped_attribute (dw_die_ref die, tree func_type)
{
if (get_AT_unsigned (comp_unit_die (), DW_AT_language) == DW_LANG_C89
- && TYPE_ARG_TYPES (func_type) != NULL)
+ && prototype_p (func_type))
add_AT_flag (die, DW_AT_prototyped, 1);
}
char label_id[MAX_ARTIFICIAL_LABEL_BYTES];
tree origin = decl_ultimate_origin (decl);
dw_die_ref subr_die;
- tree fn_arg_types;
tree outer_scope;
dw_die_ref old_die = lookup_decl_die (decl);
int declaration = (current_function_decl != decl
void_type_node 2) an unprototyped function declaration (not a
definition). This just means that we have no info about the
parameters at all. */
- fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
- if (fn_arg_types != NULL)
+ if (prototype_p (TREE_TYPE (decl)))
{
/* This is the prototyped case, check for.... */
if (stdarg_p (TREE_TYPE (decl)))
out yet, use a NULL context for now; it will be fixed up in
decls_for_scope. */
context_die = lookup_decl_die (TYPE_CONTEXT (type));
+ /* A declaration DIE doesn't count; nested types need to go in the
+ specification. */
+ if (context_die && is_declaration_die (context_die))
+ context_die = NULL;
need_pop = 0;
}
else
static void
gen_type_die_with_usage (tree type, dw_die_ref context_die,
- enum debug_info_usage usage)
+ enum debug_info_usage usage)
{
struct array_descr_info info;
if (type == NULL_TREE || type == error_mark_node)
return;
+ if (TYPE_NAME (type) != NULL_TREE
+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && is_redundant_typedef (TYPE_NAME (type))
+ && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
+ /* The DECL of this type is a typedef we don't want to emit debug
+ info for but we want debug info for its underlying typedef.
+ This can happen for e.g, the injected-class-name of a C++
+ type. */
+ type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
+
/* If TYPE is a typedef type variant, let's generate debug info
for the parent typedef which TYPE is a type of. */
if (typedef_variant_p (type))