diff options
author | Jason Merrill <jason@redhat.com> | 2013-03-16 22:33:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-03-16 22:33:50 -0400 |
commit | 98e8112376654ff5eae902ecd41a61bf0508ff73 (patch) | |
tree | bdbb93e0e0179f8a7b68019a9725114d134f69e3 /gcc | |
parent | 6721db5d154364ab7f9bf7af62bc1a2f30313a39 (diff) | |
download | gcc-98e8112376654ff5eae902ecd41a61bf0508ff73.zip gcc-98e8112376654ff5eae902ecd41a61bf0508ff73.tar.gz gcc-98e8112376654ff5eae902ecd41a61bf0508ff73.tar.bz2 |
re PR debug/49090 (provide a way to recognize defaulted template parameters)
PR debug/49090
* dwarf2out.c (gen_generic_params_dies): Indicate default arguments
with DW_AT_default_value.
From-SVN: r196723
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 18 | ||||
-rw-r--r-- | gcc/langhooks.h | 6 |
3 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c882536..c938984 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-03-16 Jason Merrill <jason@redhat.com> + + PR debug/49090 + * dwarf2out.c (gen_generic_params_dies): Indicate default arguments + with DW_AT_default_value. + 2013-03-16 Jakub Jelinek <jakub@redhat.com> * BASE-VER: Set to 4.9.0. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d7faaac..51e57378 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10238,6 +10238,7 @@ gen_generic_params_dies (tree t) tree parms, args; int parms_num, i; dw_die_ref die = NULL; + int non_default; if (!t || (TYPE_P (t) && !COMPLETE_TYPE_P (t))) return; @@ -10257,9 +10258,14 @@ gen_generic_params_dies (tree t) parms_num = TREE_VEC_LENGTH (parms); args = lang_hooks.get_innermost_generic_args (t); + if (TREE_CHAIN (args) && TREE_CODE (TREE_CHAIN (args)) == INTEGER_CST) + non_default = int_cst_value (TREE_CHAIN (args)); + else + non_default = TREE_VEC_LENGTH (args); for (i = 0; i < parms_num; i++) { tree parm, arg, arg_pack_elems; + dw_die_ref parm_die; parm = TREE_VEC_ELT (parms, i); arg = TREE_VEC_ELT (args, i); @@ -10274,12 +10280,14 @@ gen_generic_params_dies (tree t) pack elements of ARG. Note that ARG would then be an argument pack. */ if (arg_pack_elems) - template_parameter_pack_die (TREE_VALUE (parm), - arg_pack_elems, - die); + parm_die = template_parameter_pack_die (TREE_VALUE (parm), + arg_pack_elems, + die); else - generic_parameter_die (TREE_VALUE (parm), arg, - true /* Emit DW_AT_name */, die); + parm_die = generic_parameter_die (TREE_VALUE (parm), arg, + true /* emit name */, die); + if (i >= non_default) + add_AT_flag (parm_die, DW_AT_default_value, 1); } } } diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 4bc1bd5..80d4ef3 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -407,8 +407,10 @@ struct lang_hooks struct lang_hooks_for_lto lto; - /* Returns the generic parameters of an instantiation of - a generic type or decl, e.g. C++ template instantiation. */ + /* Returns a TREE_VEC of the generic parameters of an instantiation of + a generic type or decl, e.g. C++ template instantiation. If + TREE_CHAIN of the return value is set, it is an INTEGER_CST + indicating how many of the elements are non-default. */ tree (*get_innermost_generic_parms) (const_tree); /* Returns the TREE_VEC of arguments of an instantiation |