aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-01-28 12:06:40 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-01-28 12:06:40 -0500
commit2e5e7103a39315664f9a625bea42981f5251c27e (patch)
tree4b8efc5521262ece0ec8b7addd7251990e3344e2 /gcc/dwarf2out.c
parentd5d618b5da3494c1e8037863b626f57ebb78975c (diff)
downloadgcc-2e5e7103a39315664f9a625bea42981f5251c27e.zip
gcc-2e5e7103a39315664f9a625bea42981f5251c27e.tar.gz
gcc-2e5e7103a39315664f9a625bea42981f5251c27e.tar.bz2
re PR c++/53756 ([C++1y] ICE: in gen_type_die_with_usage, at dwarf2out.c:18774 with -g and operator auto ())
PR c++/53756 gcc/ * dwarf2out.c (auto_die): New static. (gen_type_die_with_usage): Handle C++1y 'auto'. (gen_subprogram_die): If in-class DIE had 'auto', emit type again on definition. gcc/cp/ * mangle.c (write_unqualified_name): Handle operator auto. From-SVN: r207197
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 22282d8..f6efd1f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -247,6 +247,9 @@ static GTY(()) bool cold_text_section_used = false;
/* The default cold text section. */
static GTY(()) section *cold_text_section;
+/* The DIE for C++1y 'auto' in a function return type. */
+static GTY(()) dw_die_ref auto_die;
+
/* Forward declarations for functions defined in this file. */
static char *stripattributes (const char *);
@@ -17999,6 +18002,13 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
add_AT_file (subr_die, DW_AT_decl_file, file_index);
if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
add_AT_unsigned (subr_die, DW_AT_decl_line, s.line);
+
+ /* If the prototype had an 'auto' return type, emit the real
+ type on the definition die. */
+ if (is_cxx() && debug_info_level > DINFO_LEVEL_TERSE
+ && get_AT_ref (old_die, DW_AT_type) == auto_die)
+ add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)),
+ 0, 0, context_die);
}
}
else
@@ -19820,6 +19830,25 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
break;
default:
+ // A C++ function with deduced return type can have
+ // a TEMPLATE_TYPE_PARM named 'auto' in its type.
+ if (is_cxx ())
+ {
+ tree name = TYPE_NAME (type);
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+ if (name == get_identifier ("auto"))
+ {
+ if (!auto_die)
+ {
+ auto_die = new_die (DW_TAG_unspecified_type,
+ comp_unit_die (), NULL_TREE);
+ add_name_attribute (auto_die, "auto");
+ }
+ equate_type_number_to_die (type, auto_die);
+ break;
+ }
+ }
gcc_unreachable ();
}