ptree.c (cxx_print_type): Use formatting markup for integers when printing template parameter...

2007-03-15  Douglas Gregor  <doug.gregor@gmail.com>

	* ptree.c (cxx_print_type): Use formatting markup for integers
	when printing template parameter index/level/orig level.
	(cxx_print_xnode): Ditto.
	* cp-tree.h (TEMPLATE_PARM_PARAMETER_PACK): Use TREE_LANG_FLAG_0.
	(struct template_parm_index_s): Remove the PARAMETER_PACK member.
	Make INDEX, LEVEL, and ORIG_LEVEL integers instead of
	HOST_WIDE_INTs.
	(struct saved_scope): Make X_PROCESSING_TEMPLATE_DECL an int,
	rather than a HOST_WIDE_INT.
	Turn X_PROCESSING_EXPLICIT_INSTANTIATION, SKIP_EVALUATION, and
	NEED_POP_FUNCTION_CONTEXT into bool bitfields; reorder fields for
	better bit-packing.
	(struct language_function): Make RETURNS_VALUE, RETURNS_NULL,
	RETURNS_ABNORMALLY, IN_FUNCTION_TRY_HANDLER, and
	IN_BASE_INITIALIZER bool bitfields.
	(struct cp_declarator): Make KIND a 4-bit field. Make
	PARAMETER_PACK_P a bool bitfield just after KIND.
	* pt.c (uses_parameter_packs): Destroy the pointer set.
	(make_pack_expansion): Ditto.
	(check_for_bare_parameter_packs): Ditto.
	* name-lookup.c (push_to_top_level): Make need_pop a bool value.

From-SVN: r122955
This commit is contained in:
Douglas Gregor 2007-03-15 13:51:09 +00:00 committed by Doug Gregor
parent 868d75dbdc
commit 30bcc02890
5 changed files with 54 additions and 28 deletions

View File

@ -1,3 +1,27 @@
2007-03-15 Douglas Gregor <doug.gregor@gmail.com>
* ptree.c (cxx_print_type): Use formatting markup for integers
when printing template parameter index/level/orig level.
(cxx_print_xnode): Ditto.
* cp-tree.h (TEMPLATE_PARM_PARAMETER_PACK): Use TREE_LANG_FLAG_0.
(struct template_parm_index_s): Remove the PARAMETER_PACK member.
Make INDEX, LEVEL, and ORIG_LEVEL integers instead of
HOST_WIDE_INTs.
(struct saved_scope): Make X_PROCESSING_TEMPLATE_DECL an int,
rather than a HOST_WIDE_INT.
Turn X_PROCESSING_EXPLICIT_INSTANTIATION, SKIP_EVALUATION, and
NEED_POP_FUNCTION_CONTEXT into bool bitfields; reorder fields for
better bit-packing.
(struct language_function): Make RETURNS_VALUE, RETURNS_NULL,
RETURNS_ABNORMALLY, IN_FUNCTION_TRY_HANDLER, and
IN_BASE_INITIALIZER bool bitfields.
(struct cp_declarator): Make KIND a 4-bit field. Make
PARAMETER_PACK_P a bool bitfield just after KIND.
* pt.c (uses_parameter_packs): Destroy the pointer set.
(make_pack_expansion): Ditto.
(check_for_bare_parameter_packs): Ditto.
* name-lookup.c (push_to_top_level): Make need_pop a bool value.
2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c++/31165

View File

@ -56,6 +56,7 @@ struct diagnostic_context;
OMP_FOR_GIMPLIFYING_P (in OMP_FOR)
BASELINK_QUALIFIED_P (in BASELINK)
TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
@ -219,14 +220,10 @@ struct lang_identifier GTY(())
struct template_parm_index_s GTY(())
{
struct tree_common common;
HOST_WIDE_INT index;
HOST_WIDE_INT level;
HOST_WIDE_INT orig_level;
int index;
int level;
int orig_level;
tree decl;
/* When true, indicates that this parameter is actually a parameter
pack, for variadic templates. */
BOOL_BITFIELD parameter_pack;
};
typedef struct template_parm_index_s template_parm_index;
@ -703,11 +700,11 @@ struct saved_scope GTY(())
struct cp_binding_level *x_previous_class_level;
tree x_saved_tree;
HOST_WIDE_INT x_processing_template_decl;
int x_processing_template_decl;
int x_processing_specialization;
bool x_processing_explicit_instantiation;
int need_pop_function_context;
bool skip_evaluation;
BOOL_BITFIELD x_processing_explicit_instantiation : 1;
BOOL_BITFIELD need_pop_function_context : 1;
BOOL_BITFIELD skip_evaluation : 1;
struct stmt_tree_s x_stmt_tree;
@ -786,11 +783,11 @@ struct language_function GTY(())
tree x_vtt_parm;
tree x_return_value;
int returns_value;
int returns_null;
int returns_abnormally;
int in_function_try_handler;
int in_base_initializer;
BOOL_BITFIELD returns_value : 1;
BOOL_BITFIELD returns_null : 1;
BOOL_BITFIELD returns_abnormally : 1;
BOOL_BITFIELD in_function_try_handler : 1;
BOOL_BITFIELD in_base_initializer : 1;
/* True if this function can throw an exception. */
BOOL_BITFIELD can_throw : 1;
@ -3705,7 +3702,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
#define TEMPLATE_PARM_PARAMETER_PACK(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->parameter_pack)
#define TEMPLATE_PARM_PARAMETER_PACK(NODE) \
(TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE)))
/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
@ -3901,16 +3899,16 @@ struct cp_parameter_declarator {
/* A declarator. */
struct cp_declarator {
/* The kind of declarator. */
cp_declarator_kind kind;
ENUM_BITFIELD (cp_declarator_kind) kind : 4;
/* Whether we parsed an ellipsis (`...') just before the declarator,
to indicate this is a parameter pack. */
BOOL_BITFIELD parameter_pack_p : 1;
/* Attributes that apply to this declarator. */
tree attributes;
/* For all but cdk_id and cdk_error, the contained declarator. For
cdk_id and cdk_error, guaranteed to be NULL. */
cp_declarator *declarator;
location_t id_loc; /* Currently only set for cdk_id. */
/* Whether we parsed an ellipsis (`...') just before the declarator,
to indicate this is a parameter pack. */
bool parameter_pack_p;
union {
/* For identifiers. */
struct {

View File

@ -5030,7 +5030,7 @@ push_to_top_level (void)
struct cp_binding_level *b;
cxx_saved_binding *sb;
size_t i;
int need_pop;
bool need_pop;
timevar_push (TV_NAME_LOOKUP);
s = GGC_CNEW (struct saved_scope);
@ -5040,11 +5040,11 @@ push_to_top_level (void)
/* If we're in the middle of some function, save our state. */
if (cfun)
{
need_pop = 1;
need_pop = true;
push_function_context_to (NULL_TREE);
}
else
need_pop = 0;
need_pop = false;
if (scope_chain && previous_class_level)
store_class_bindings (previous_class_level->class_shadowed,

View File

@ -2461,6 +2461,7 @@ uses_parameter_packs (tree t)
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
return parameter_packs != NULL_TREE;
}
@ -2515,6 +2516,7 @@ make_pack_expansion (tree arg)
if (parameter_packs == NULL_TREE)
{
error ("base initializer expansion %<%T%> contains no parameter packs", arg);
pointer_set_destroy (ppd.visited);
return error_mark_node;
}
@ -2531,6 +2533,8 @@ make_pack_expansion (tree arg)
}
}
pointer_set_destroy (ppd.visited);
/* Create the pack expansion type for the base type. */
purpose = make_node (TYPE_PACK_EXPANSION);
SET_PACK_EXPANSION_PATTERN (purpose, TREE_PURPOSE (arg));
@ -2564,6 +2568,7 @@ make_pack_expansion (tree arg)
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
walk_tree (&arg, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
/* Make sure we found some parameter packs. */
if (parameter_packs == NULL_TREE)
@ -2605,6 +2610,7 @@ check_for_bare_parameter_packs (tree t)
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
if (parameter_packs) {
error ("parameter packs not expanded with `...':");

View File

@ -68,8 +68,7 @@ cxx_print_type (FILE *file, tree node, int indent)
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
indent_to (file, indent + 3);
fprintf (file, "index " HOST_WIDE_INT_PRINT_DEC " level "
HOST_WIDE_INT_PRINT_DEC " orig_level " HOST_WIDE_INT_PRINT_DEC,
fprintf (file, "index %d level %d orig_level %d",
TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node),
TEMPLATE_TYPE_ORIG_LEVEL (node));
return;
@ -181,8 +180,7 @@ cxx_print_xnode (FILE *file, tree node, int indent)
break;
case TEMPLATE_PARM_INDEX:
indent_to (file, indent + 3);
fprintf (file, "index " HOST_WIDE_INT_PRINT_DEC " level "
HOST_WIDE_INT_PRINT_DEC " orig_level " HOST_WIDE_INT_PRINT_DEC,
fprintf (file, "index %d level %d orig_level %d",
TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL (node),
TEMPLATE_PARM_ORIG_LEVEL (node));
break;