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
This commit is contained in:
Jason Merrill 2013-03-16 22:33:50 -04:00 committed by Jason Merrill
parent 6721db5d15
commit 98e8112376
3 changed files with 23 additions and 7 deletions

View File

@ -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.

View File

@ -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);
}
}
}

View File

@ -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