X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fdwarf2out.c;h=9fe1e9c43693651698a8ad728a60c4799153a04d;hb=b7de3a95380bc054e113944886dac56caa025972;hp=75faec5e28ae53aeb0e0dcf8e81bda8e31750b3e;hpb=a641ee368e2614349084a9a7bda2ec2b0b2bc1cf;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 75faec5e28a..9fe1e9c4369 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -12907,7 +12907,12 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, /* 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); @@ -12915,7 +12920,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, 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) { @@ -15441,12 +15446,12 @@ loc_list_from_tree (tree loc, int want_address) /* 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; @@ -17646,7 +17651,7 @@ static inline void 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); } @@ -18895,7 +18900,6 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) 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 @@ -19233,8 +19237,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) 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))) @@ -20212,6 +20215,10 @@ gen_tagged_type_die (tree type, 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 @@ -20242,13 +20249,23 @@ gen_tagged_type_die (tree type, 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))