Commit d40a19da by Dodji Seketeli Committed by Dodji Seketeli

re PR debug/41266 (Emit DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack)

Fix for PR debug/41266

ChangeLog:

	* include/dwarf2.h (enum dwarf_tag): Add
	DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack.

gcc/ChangeLog:

	* dwarf2out.c (template_parameter_pack_die,
	gen_formal_parameter_pack_die ): New functions.
	(make_ith_pack_parameter_name): Remove this function.
	(dwarf_tag_name): Support printing DW_TAG_template_parameter_pack and
	DW_TAG_formal_parameter_pack.
	(gen_generic_params_dies): Represent each template parameter pack
	by a DW_TAG_template_parameter_pack DIE. Argument pack elements are
	represented by usual DW_TAG_template_*_parameter DIEs that are
	children of the DW_TAG_template_parameter_pack element DIE.
	(generic_parameter_die): This doesn't deal with parameter pack
	names anymore. Don't generate DW_AT_name for some DIEs, e.g. children of
	parameter pack DIEs.
	(gen_formal_parameter_die): Add a flag to not emit DW_AT_name
	in certain cases, e.g. for pack elements.
	(gen_formal_types_die, gen_decl_die): Adjust usage of
	gen_formal_parameter_die.
	(gen_subprogram_die): Represent each function parameter pack by a
	DW_TAG_formal_parameter_pack DIE. Arguments of of the pack are
	represented by usual DW_TAG_formal_parameter DIEs that are children
	of the DW_TAG_formal_parameter_pack DIE. Remove references to
	____builtin_va_alist decls as no part of the compiler uses those
	anymore.
	* langhooks.h (struct lang_hooks_for_decls): Add
	function_parm_expanded_from_pack_p, get_generic_function_decl
	and function_parameter_pack_p hooks.  Fix comment for
	get_innermost_generic_parms hook.
	* langhooks-def.h (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P,
	LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P ): Declare new hook
	macros and use them to initialize lang_hook.

gcc/cp/ChangeLog:

	* cp-lang.c (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P,
	LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P,
	LANG_HOOKS_GET_GENERIC_FUNCTION_DECL): Initialize these
	hooks for the c++ FE.
	* cp-tree.h (function_parameter_pack_p, get_function_template_decl,
	function_parameter_expanded_from_pack_p): Declare ...
	* pt.c (function_parameter_pack_p, get_function_template_decl,
	function_parameter_expanded_from_pack_p): ... new hooks.
	(get_template_info): Make this more robust.
	(template_args_variadic_p, make_ith_pack_parameter_name): Add a new
	line between comment and function.
	(get_template_argument_pack_elems): Fix comment.
	(tsubst_decl): Arguments of function parameter packs are not
	parameter packs themselves.

gcc/testsuite/ChangeLog:
	* g++.dg/debug/dwarf2/template-func-params-4.C: Adjust.
	* g++.dg/debug/dwarf2/template-func-params-7.C: Likewise.
	* g++.dg/debug/dwarf2/template-params-4.C: Likewise.

From-SVN: r152043
parent 82497700
2009-09-22 Dodji Seketeli <dodji@redhat.com>
* dwarf2out.c (template_parameter_pack_die,
gen_formal_parameter_pack_die ): New functions.
(make_ith_pack_parameter_name): Remove this function.
(dwarf_tag_name): Support printing DW_TAG_template_parameter_pack and
DW_TAG_formal_parameter_pack.
(gen_generic_params_dies): Represent each template parameter pack
by a DW_TAG_template_parameter_pack DIE. Argument pack elements are
represented by usual DW_TAG_template_*_parameter DIEs that are
children of the DW_TAG_template_parameter_pack element DIE.
(generic_parameter_die): This doesn't deal with parameter pack
names anymore. Don't generate DW_AT_name for some DIEs, e.g. children of
parameter pack DIEs.
(gen_formal_parameter_die): Add a flag to not emit DW_AT_name
in certain cases, e.g. for pack elements.
(gen_formal_types_die, gen_decl_die): Adjust usage of
gen_formal_parameter_die.
(gen_subprogram_die): Represent each function parameter pack by a
DW_TAG_formal_parameter_pack DIE. Arguments of of the pack are
represented by usual DW_TAG_formal_parameter DIEs that are children
of the DW_TAG_formal_parameter_pack DIE. Remove references to
____builtin_va_alist decls as no part of the compiler uses those
anymore.
* langhooks.h (struct lang_hooks_for_decls): Add
function_parm_expanded_from_pack_p, get_generic_function_decl
and function_parameter_pack_p hooks. Fix comment for
get_innermost_generic_parms hook.
* langhooks-def.h (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P,
LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P ): Declare new hook
macros and use them to initialize lang_hook.
2009-09-22 Richard Henderson <rth@redhat.com> 2009-09-22 Richard Henderson <rth@redhat.com>
* system.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): Poison. * system.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): Poison.
......
2009-09-22 Dodji Seketeli <dodji@redhat.com>
* cp-lang.c (LANG_HOOKS_FUNCTION_PARAMETER_PACK_P,
LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P,
LANG_HOOKS_GET_GENERIC_FUNCTION_DECL): Initialize these
hooks for the c++ FE.
* cp-tree.h (function_parameter_pack_p, get_function_template_decl,
function_parameter_expanded_from_pack_p): Declare ...
* pt.c (function_parameter_pack_p, get_function_template_decl,
function_parameter_expanded_from_pack_p): ... new hooks.
(get_template_info): Make this more robust.
(template_args_variadic_p, make_ith_pack_parameter_name): Add a new
line between comment and function.
(get_template_argument_pack_elems): Fix comment.
(tsubst_decl): Arguments of function parameter packs are not
parameter packs themselves.
2009-09-21 Jason Merrill <jason@redhat.com> 2009-09-21 Jason Merrill <jason@redhat.com>
PR c++/41421 PR c++/41421
......
...@@ -59,13 +59,20 @@ static tree cp_eh_personality (void); ...@@ -59,13 +59,20 @@ static tree cp_eh_personality (void);
#undef LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS #undef LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS
#define LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS \ #define LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS \
get_template_innermost_arguments get_template_innermost_arguments
#undef LANG_HOOKS_FUNCTION_PARAMETER_PACK_P
#define LANG_HOOKS_FUNCTION_PARAMETER_PACK_P \
function_parameter_pack_p
#undef LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS #undef LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS
#define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS \ #define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS \
get_template_argument_pack_elems get_template_argument_pack_elems
#undef LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P #undef LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P
#define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P \ #define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P \
template_template_parameter_p template_template_parameter_p
#undef LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P
#define LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P \
function_parameter_expanded_from_pack_p
#undef LANG_HOOKS_GET_GENERIC_FUNCTION_DECL
#define LANG_HOOKS_GET_GENERIC_FUNCTION_DECL get_function_template_decl
#undef LANG_HOOKS_DECL_PRINTABLE_NAME #undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
#undef LANG_HOOKS_DWARF_NAME #undef LANG_HOOKS_DWARF_NAME
......
...@@ -4643,6 +4643,8 @@ extern tree instantiate_decl (tree, int, bool); ...@@ -4643,6 +4643,8 @@ extern tree instantiate_decl (tree, int, bool);
extern int comp_template_parms (const_tree, const_tree); extern int comp_template_parms (const_tree, const_tree);
extern bool uses_parameter_packs (tree); extern bool uses_parameter_packs (tree);
extern bool template_parameter_pack_p (const_tree); extern bool template_parameter_pack_p (const_tree);
extern bool function_parameter_pack_p (const_tree);
extern bool function_parameter_expanded_from_pack_p (tree, tree);
extern tree make_pack_expansion (tree); extern tree make_pack_expansion (tree);
extern bool check_for_bare_parameter_packs (tree); extern bool check_for_bare_parameter_packs (tree);
extern tree get_template_info (const_tree); extern tree get_template_info (const_tree);
...@@ -4692,7 +4694,7 @@ bool template_template_parameter_p (const_tree); ...@@ -4692,7 +4694,7 @@ bool template_template_parameter_p (const_tree);
extern tree get_primary_template_innermost_parameters (const_tree); extern tree get_primary_template_innermost_parameters (const_tree);
extern tree get_template_innermost_arguments (const_tree); extern tree get_template_innermost_arguments (const_tree);
extern tree get_template_argument_pack_elems (const_tree); extern tree get_template_argument_pack_elems (const_tree);
extern tree get_function_template_decl (const_tree);
/* in repo.c */ /* in repo.c */
extern void init_repo (void); extern void init_repo (void);
extern int repo_emit_p (tree); extern int repo_emit_p (tree);
......
...@@ -294,6 +294,9 @@ get_template_info (const_tree t) ...@@ -294,6 +294,9 @@ get_template_info (const_tree t)
{ {
tree tinfo = NULL_TREE; tree tinfo = NULL_TREE;
if (!t || t == error_mark_node)
return NULL;
if (DECL_P (t) && DECL_LANG_SPECIFIC (t)) if (DECL_P (t) && DECL_LANG_SPECIFIC (t))
tinfo = DECL_TEMPLATE_INFO (t); tinfo = DECL_TEMPLATE_INFO (t);
...@@ -2617,6 +2620,7 @@ comp_template_parms (const_tree parms1, const_tree parms2) ...@@ -2617,6 +2620,7 @@ comp_template_parms (const_tree parms1, const_tree parms2)
} }
/* Determine whether PARM is a parameter pack. */ /* Determine whether PARM is a parameter pack. */
bool bool
template_parameter_pack_p (const_tree parm) template_parameter_pack_p (const_tree parm)
{ {
...@@ -2635,8 +2639,49 @@ template_parameter_pack_p (const_tree parm) ...@@ -2635,8 +2639,49 @@ template_parameter_pack_p (const_tree parm)
&& TEMPLATE_TYPE_PARAMETER_PACK (parm)); && TEMPLATE_TYPE_PARAMETER_PACK (parm));
} }
/* Determine if T is a function parameter pack. */
bool
function_parameter_pack_p (const_tree t)
{
if (t && TREE_CODE (t) == PARM_DECL)
return FUNCTION_PARAMETER_PACK_P (t);
return false;
}
/* Return the function template declaration of PRIMARY_FUNC_TMPL_INST.
PRIMARY_FUNC_TMPL_INST is a primary function template instantiation. */
tree
get_function_template_decl (const_tree primary_func_tmpl_inst)
{
if (! primary_func_tmpl_inst
|| TREE_CODE (primary_func_tmpl_inst) != FUNCTION_DECL
|| ! primary_template_instantiation_p (primary_func_tmpl_inst))
return NULL;
return DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (primary_func_tmpl_inst));
}
/* Return true iff the function parameter PARAM_DECL was expanded
from the function parameter pack PACK. */
bool
function_parameter_expanded_from_pack_p (tree param_decl, tree pack)
{
if (! function_parameter_pack_p (pack))
return false;
gcc_assert (DECL_NAME (param_decl) && DECL_NAME (pack));
/* The parameter pack and its pack arguments have the same
DECL_PARM_INDEX. */
return DECL_PARM_INDEX (pack) == DECL_PARM_INDEX (param_decl);
}
/* Determine whether ARGS describes a variadic template args list, /* Determine whether ARGS describes a variadic template args list,
i.e., one that is terminated by a template argument pack. */ i.e., one that is terminated by a template argument pack. */
static bool static bool
template_args_variadic_p (tree args) template_args_variadic_p (tree args)
{ {
...@@ -2659,6 +2704,7 @@ template_args_variadic_p (tree args) ...@@ -2659,6 +2704,7 @@ template_args_variadic_p (tree args)
/* Generate a new name for the parameter pack name NAME (an /* Generate a new name for the parameter pack name NAME (an
IDENTIFIER_NODE) that incorporates its */ IDENTIFIER_NODE) that incorporates its */
static tree static tree
make_ith_pack_parameter_name (tree name, int i) make_ith_pack_parameter_name (tree name, int i)
{ {
...@@ -2735,7 +2781,8 @@ get_template_innermost_arguments (const_tree t) ...@@ -2735,7 +2781,8 @@ get_template_innermost_arguments (const_tree t)
return args; return args;
} }
/* Return the arguments pack of T if T is a template, NULL otherwise. */ /* Return the argument pack elements of T if T is a template argument pack,
NULL otherwise. */
tree tree
get_template_argument_pack_elems (const_tree t) get_template_argument_pack_elems (const_tree t)
...@@ -8825,6 +8872,10 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -8825,6 +8872,10 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
if (DECL_TEMPLATE_PARM_P (t)) if (DECL_TEMPLATE_PARM_P (t))
SET_DECL_TEMPLATE_PARM_P (r); SET_DECL_TEMPLATE_PARM_P (r);
/* An argument of a function parameter pack is not a parameter
pack. */
FUNCTION_PARAMETER_PACK_P (r) = false;
if (expanded_types) if (expanded_types)
/* We're on the Ith parameter of the function parameter /* We're on the Ith parameter of the function parameter
pack. */ pack. */
......
...@@ -157,8 +157,12 @@ extern tree lhd_make_node (enum tree_code); ...@@ -157,8 +157,12 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false #define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false
#define LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS hook_tree_const_tree_null #define LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS hook_tree_const_tree_null
#define LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS hook_tree_const_tree_null #define LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS hook_tree_const_tree_null
#define LANG_HOOKS_FUNCTION_PARAMETER_PACK_P hook_bool_const_tree_false
#define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS hook_tree_const_tree_null #define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS hook_tree_const_tree_null
#define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P hook_bool_const_tree_false #define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P hook_bool_const_tree_false
#define LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P \
hook_bool_tree_tree_false
#define LANG_HOOKS_GET_GENERIC_FUNCTION_DECL hook_tree_const_tree_null
#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to #define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree #define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree
...@@ -214,6 +218,8 @@ extern tree lhd_make_node (enum tree_code); ...@@ -214,6 +218,8 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_GETDECLS, \ LANG_HOOKS_GETDECLS, \
LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P, \ LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P, \
LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P, \ LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P, \
LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P, \
LANG_HOOKS_GET_GENERIC_FUNCTION_DECL, \
LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \ LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
LANG_HOOKS_WRITE_GLOBALS, \ LANG_HOOKS_WRITE_GLOBALS, \
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \ LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
...@@ -268,6 +274,7 @@ extern tree lhd_make_node (enum tree_code); ...@@ -268,6 +274,7 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_FOR_TYPES_INITIALIZER, \ LANG_HOOKS_FOR_TYPES_INITIALIZER, \
LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, \ LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, \
LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, \ LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, \
LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, \
LANG_HOOKS_GIMPLIFY_EXPR, \ LANG_HOOKS_GIMPLIFY_EXPR, \
LANG_HOOKS_FOLD_OBJ_TYPE_REF, \ LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
LANG_HOOKS_BUILTIN_FUNCTION, \ LANG_HOOKS_BUILTIN_FUNCTION, \
......
...@@ -172,6 +172,13 @@ struct lang_hooks_for_decls ...@@ -172,6 +172,13 @@ struct lang_hooks_for_decls
of a generic type, e.g a template template parameter for the C++ FE. */ of a generic type, e.g a template template parameter for the C++ FE. */
bool (*generic_generic_parameter_decl_p) (const_tree); bool (*generic_generic_parameter_decl_p) (const_tree);
/* Determine if a function parameter got expanded from a
function parameter pack. */
bool (*function_parm_expanded_from_pack_p) (tree, tree);
/* Returns the generic declaration of a generic function instantiations. */
tree (*get_generic_function_decl) (const_tree);
/* Returns true when we should warn for an unused global DECL. /* Returns true when we should warn for an unused global DECL.
We will already have checked that it has static binding. */ We will already have checked that it has static binding. */
bool (*warn_unused_global) (const_tree); bool (*warn_unused_global) (const_tree);
...@@ -379,7 +386,7 @@ struct lang_hooks ...@@ -379,7 +386,7 @@ struct lang_hooks
struct lang_hooks_for_types types; struct lang_hooks_for_types types;
/* Retuns the generic parameters of an instantiation of /* Returns the generic parameters of an instantiation of
a generic type or decl, e.g. C++ template instantiation. */ a generic type or decl, e.g. C++ template instantiation. */
tree (*get_innermost_generic_parms) (const_tree); tree (*get_innermost_generic_parms) (const_tree);
...@@ -387,6 +394,9 @@ struct lang_hooks ...@@ -387,6 +394,9 @@ struct lang_hooks
of a generic type of decl, e.g. C++ template instantiation. */ of a generic type of decl, e.g. C++ template instantiation. */
tree (*get_innermost_generic_args) (const_tree); tree (*get_innermost_generic_args) (const_tree);
/* Determine if a tree is a function parameter pack. */
bool (*function_parameter_pack_p) (const_tree);
/* Perform language-specific gimplification on the argument. Returns an /* Perform language-specific gimplification on the argument. Returns an
enum gimplify_status, though we can't see that type here. */ enum gimplify_status, though we can't see that type here. */
int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *); int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *);
......
2009-09-22 Dodji Seketeli <dodji@redhat.com>
* g++.dg/debug/dwarf2/template-func-params-4.C: Adjust.
* g++.dg/debug/dwarf2/template-func-params-7.C: Likewise.
* g++.dg/debug/dwarf2/template-params-4.C: Likewise.
2009-09-22 Alexandre Oliva <aoliva@redhat.com> 2009-09-22 Alexandre Oliva <aoliva@redhat.com>
PR debug/41295 PR debug/41295
......
// Contributed by Dodji Seketeli <dodji@redhat.com> // Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR debug/30161 // Origin PR debug/30161
// { dg-options "-std=c++0x -g -dA" } // { dg-options "-std=c++0x -g -dA" }
// { dg-final { scan-assembler "DW_TAG_template_type_param" } } //
// { dg-final { scan-assembler "DW_AT_name.*P#0" } } // In theory the compiler instantiates count<int, char, long>,
// { dg-final { scan-assembler "DW_AT_name.*P#1" } } // count<char, long> and count<long>. In practice, only
// { dg-final { scan-assembler "DW_AT_name.*P#2" } } // count<int, char, long> is emitted, thanks to constant folding.
// So in theory, each of the 3 instances of count yields a
// DW_TAG_tempalate_parameter_pack DIE, but in practise, there is only one
// DW_TAG_template_parameter_pack as there is only count<int, char, long>
// is emitted.
// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_parameter_pack" 1} }
// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 3} }
template <typename... Args> struct count; template <typename... Args> struct count;
......
...@@ -16,17 +16,15 @@ ...@@ -16,17 +16,15 @@
// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } } // { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
// printf<int, char, int> and printf<char, int> have a pack expansion as // printf<int, char, int> and printf<char, int> have a pack expansion as
// function parameters. In the former, the elements of the parameter pack // function parameters. There should then be 3
// expansion are PackTypes#0, PackTypes#1 and the arguments are args#0 and // DW_TAG_template_parameter_pack and 3 DW_TAG_formal_parameter_pack DIEs
// args#1. In the later, the element of the parameter pack expansion // { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_parameter_pack" 3 } }
// is PackTypes#0 and the argument is args#0. // { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_formal_parameter_pack" 3 } }
// { dg-final {scan-assembler-times "DW_AT_name: \"PackTypes#0\"" 2 } } // These 3 function template instantiations has a total of 3 template
// { dg-final {scan-assembler-times "\"args#0.0\".*?DW_AT_name" 2 } } // parameters named T.
// { dg-final {scan-assembler-times "\"PackTypes#1.0\".*?DW_AT_name" 1 } }
// { dg-final {scan-assembler-times "\"args#1.0\".*?DW_AT_name" 1 } }
// { dg_final {scan-assembler-times "\.ascii \"T.0\"\[\t \]+.*?DW_AT_name" 3 } } // { dg_final {scan-assembler-times "\.ascii \"T.0\"\[\t \]+.*?DW_AT_name" 3 } }
void void
printf(const char* s) printf(const char* s)
{ {
......
// Contributed by Dodji Seketeli <dodji@redhat.com> // Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR debug/30161 // Origin PR debug/30161
// { dg-options "-std=c++0x -g -dA" } // { dg-options "-std=c++0x -g -dA" }
// { dg-final { scan-assembler "DW_TAG_template_type_param" } } //
// { dg-final { scan-assembler "DW_AT_name.*Args#0" } } // In theory the compiler instantiates count<int, char, long>,
// { dg-final { scan-assembler "DW_AT_name.*Args#1" } } // count<char, long> and count<long>. In practice, only
// { dg-final { scan-assembler "DW_AT_name.*Args#2" } } // count<int, char, long> is emitted, thanks to constant folding.
// So in theory, each of the 3 instances of count yields a
// DW_TAG_tempalate_parameter_pack DIE, but in practise, there is only one
// DW_TAG_template_parameter_pack as there is only count<int, char, long>
// is emitted.
// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_parameter_pack" 1} }
// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 3} }
template <typename... Args> struct count; template <typename... Args> struct count;
......
2009-09-22 Dodji Seketeli <dodji@redhat.com>
* dwarf2.h (enum dwarf_tag): Add
DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack.
2009-07-24 Ian Lance Taylor <iant@google.com> 2009-07-24 Ian Lance Taylor <iant@google.com>
PR bootstrap/40854 PR bootstrap/40854
......
...@@ -200,6 +200,14 @@ enum dwarf_tag ...@@ -200,6 +200,14 @@ enum dwarf_tag
DW_TAG_lo_user = 0x4080, DW_TAG_lo_user = 0x4080,
DW_TAG_hi_user = 0xffff, DW_TAG_hi_user = 0xffff,
/* DWARF 5? */
/* Template parameter pack extension, specified at
http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates
. */
DW_TAG_template_parameter_pack = 0x43,
DW_TAG_formal_parameter_pack = 0x44,
/* SGI/MIPS Extensions. */ /* SGI/MIPS Extensions. */
DW_TAG_MIPS_loop = 0x4081, DW_TAG_MIPS_loop = 0x4081,
/* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */ /* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment