OSDN Git Service

Emit DWARF for template parameters (PR debug/30161)
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Aug 2009 21:48:04 +0000 (21:48 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Aug 2009 21:48:04 +0000 (21:48 +0000)
commit7c48f38c8ad8ed966b78d9d9518f06219beff3bc
treee200e788bb350c1d9043fd4bea07ad60134978d6
parent142c2869afed1b0178018c706387f30f5e39ff1d
Emit DWARF for template parameters (PR debug/30161)

ChangeLog:
PR debug/30161
* include/dwarf2.h (enum dwarf_tag): Added
DW_TAG_GNU_template_template_param
(enum dwarf_attribute): Added DW_AT_GNU_template_name.

gcc/ChangeLog:
PR debug/30161
* cgraph.h (cgraph_get_node): Declare ...
* cgraph.c (cgraph_get_node): ... new function.
* dwarf2out.c (gen_generic_params_dies,
generic_parameter_die, tree_add_const_value_attribute_for_decl,
make_ith_pack_parameter_name,
append_entry_to_tmpl_value_parm_die_table,
gen_remaining_tmpl_value_param_die_attribute): New functions.
(gen_subprogram_die): Generate debug info for template parameters
if debug info level is higher than DINFO_LEVEL_TERSE.
Use tree_add_const_value_attribute_for_decl instead of
tree_add_const_value_attribute.
(gen_const_die): Use tree_add_const_value_attribute_for_decl
instead of tree_add_const_value_attribute.
(gen_struct_or_union_type_die): Generate debug
info for template parameters if debug info level is higher than
DINFO_LEVEL_TERSE.
(tree_add_const_value_attribute): Handle integral and pointer
constants. Update comment.
(dwarf_tag_name): Support DW_TAG_GNU_template_template_param.
(dwarf_attr_name): Support DW_AT_GNU_template_name.
(reference_to_unused): Fix thinko. Remove redundant predicates from
tests.
(tree_add_const_value_attribute): Make this work for constant
expressions only.
tree_add_const_value_attribute_for_decl is to be used for variable
DECLs now.
(add_location_or_const_value_attribute): Use
tree_add_const_value_attribute_for_decl now.
(dwarf2out_finish): Emit the DW_AT_const_value attribute of
DW_TAG_template_value_param DIEs after function DIEs have been
emitted.
* langhooks.h (lang_hooks_for_types): Add
get_argument_pack_elems.
(lang_hooks_for_decls): Add generic_generic_parameter_decl_p.
(lang_hooks): Added get_innermost_generic_parms,
get_innermost_generic_args.
* langhooks-def.h (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS,
LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS,
LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS,
LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P): New language hooks.

gcc/cp/ChangeLog:
PR debug/30161
* cp-tree.h (get_template_info): Parameter should be const.
(CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): Fix typo.
(get_template_argument_pack_elems,
get_primary_template_innermost_parameters,
get_template_innermost_arguments, template_template_parameter_p):
Declare ...
* pt.c (get_template_argument_pack_elems,
get_template_innermost_parameters, get_template_innermost_arguments,
template_template_parameter_p):
... New C++ front end implementation of new language hooks.
(primary_template_instantiation_p): New private helper.
(make_ith_pack_parameter_name): Use snprintf and strnlen instead of
printf and strlen.
(get_template_info): Const-ify parameter.
* cp-lang.c (LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS,
LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS,
LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS,
LANG_HOOKS_GENERIC_TYPE_PARAMETER_DECL_P): Initialize these
interfaces for the C++ front-end.

gcc/testsuite/ChangeLog:
PR debug/30161
* g++.dg/debug/dwarf2/template-params-1.C: New test.
* g++.dg/debug/dwarf2/template-params-2.C: Likewise.
* g++.dg/debug/dwarf2/template-params-3.C: Likewise.
* g++.dg/debug/dwarf2/template-params-4.C: Likewise.
* g++.dg/debug/dwarf2/template-params-5.C: Likewise.
* g++.dg/debug/dwarf2/template-params-6.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-1.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-2.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-3.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-4.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-5.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-6.C: Likewise.
* g++.dg/debug/dwarf2/template-func-params-7.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151249 138bc75d-0d04-0410-961f-82ee72b054a4
26 files changed:
ChangeLog
gcc/ChangeLog
gcc/cgraph.c
gcc/cgraph.h
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/dwarf2out.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-6.C [new file with mode: 0644]
include/dwarf2.h