Augment stringification of trees.

* cp-tree.h (tree_string_flags): New error stringifying enumeration.
	(fndecl_as_string, type_as_string_real, args_as_string,
	code_as_string, language_as_string, parm_as_string,
	op_as_string, assop_as_string, cv_as_string): Remove.
	(type_as_string, decl_as_string, expr_as_string): Adjust prototype.
	(context_as_string): Declare new function.
	* error.c (cp_printers): Move definition.
	(OB_UNPUT): Remove.
	(OB_END_TEMPLATE_ID): Adjust.
	(interesting_scope_p): Remove.
	(dump_scope): New static function.
	(dump_qualifiers): Adjust prototype, reimplement.
	(dump_template_value): Use tree_string_flags.
	(dump_type_real): Move back to dump_type.
	(dump_type): Adjust prototype. Use tree_string_flags.
	(dump_aggr_type): Likewise. Use dump_template_parms.
	(dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag.
	(dump_type_suffix): Adjust prototype. Use tree_string_flags.
	(dump_simple_decl): Likewise.
	(dump_decl): Likewise. Use dump_template_decl.
	(dump_template_decl): New static function broken out of dump_decl.
	(dump_function_decl): Adjust prototype. Use tree_string_flags.
	(dump_parameters): Likewise. Prefix space.
	(dump_exception_spec): Adjust prototype. Use tree_string_flags.
	(dump_function_name): Likewise. Use dump_template_parms.
	(dump_template_parms): New static function broken out of
	dump_function_name.
	(dump_expr_list): Adjust prototype. Use tree_string_flags.
	(dump_expr): Likewise.
	(fndecl_as_string): Removed
	(type_as_string_real): Removed
	(dump_binary_op): Adjust prototype. Use tree_string_flags.
	(dump_unary_op): Likewise.
	(type_as_string): Likewise.
	(expr_as_string): Likewise.
	(decl_as_string): Likewise.
	(context_as_string): New function.
	(lang_decl_name): Adjust.
	(decl_to_string): New static print callback.
	(expr_to_string): Likewise.
	(fndecl_to_string): Likewise.
	(code_as_string): Renamed to ...
	(code_to_string): ... here. Adjust.
	(language_as_string): Renamed to ...
	(language_to_string): ... here. Adjust.
	(parm_as_string): Renamed to ...
	(parm_to_string): ... here.
	(op_as_string): Renamed to ...
	(op_to_string): ... here.
	(assop_as_string): Renamed to ...
	(assop_to_string): ... here.
	(type_to_string): New static print callback.
	(args_as_string): Renamed to ...
	(args_to_string): ... here. Adjust.
	(cv_as_string): Renamed to ...
	(cv_to_string): ... here. Adjust.
	* pt.c (mangle_class_name_for_template): Use tree_string_flags.
	(print_template_context): Likewise.

From-SVN: r29673
This commit is contained in:
Nathan Sidwell 1999-09-27 08:26:00 +00:00 committed by Nathan Sidwell
parent cf9d61d569
commit 9e93bc9dcc
4 changed files with 917 additions and 644 deletions

View File

@ -1,3 +1,65 @@
1999-09-27 Nathan Sidwell <nathan@acm.org>
Augment stringification of trees.
* cp-tree.h (tree_string_flags): New error stringifying enumeration.
(fndecl_as_string, type_as_string_real, args_as_string,
code_as_string, language_as_string, parm_as_string,
op_as_string, assop_as_string, cv_as_string): Remove.
(type_as_string, decl_as_string, expr_as_string): Adjust prototype.
(context_as_string): Declare new function.
* error.c (cp_printers): Move definition.
(OB_UNPUT): Remove.
(OB_END_TEMPLATE_ID): Adjust.
(interesting_scope_p): Remove.
(dump_scope): New static function.
(dump_qualifiers): Adjust prototype, reimplement.
(dump_template_value): Use tree_string_flags.
(dump_type_real): Move back to dump_type.
(dump_type): Adjust prototype. Use tree_string_flags.
(dump_aggr_type): Likewise. Use dump_template_parms.
(dump_type_prefix): Adjust prototype. Use tree_string_flags. Return pad flag.
(dump_type_suffix): Adjust prototype. Use tree_string_flags.
(dump_simple_decl): Likewise.
(dump_decl): Likewise. Use dump_template_decl.
(dump_template_decl): New static function broken out of dump_decl.
(dump_function_decl): Adjust prototype. Use tree_string_flags.
(dump_parameters): Likewise. Prefix space.
(dump_exception_spec): Adjust prototype. Use tree_string_flags.
(dump_function_name): Likewise. Use dump_template_parms.
(dump_template_parms): New static function broken out of
dump_function_name.
(dump_expr_list): Adjust prototype. Use tree_string_flags.
(dump_expr): Likewise.
(fndecl_as_string): Removed
(type_as_string_real): Removed
(dump_binary_op): Adjust prototype. Use tree_string_flags.
(dump_unary_op): Likewise.
(type_as_string): Likewise.
(expr_as_string): Likewise.
(decl_as_string): Likewise.
(context_as_string): New function.
(lang_decl_name): Adjust.
(decl_to_string): New static print callback.
(expr_to_string): Likewise.
(fndecl_to_string): Likewise.
(code_as_string): Renamed to ...
(code_to_string): ... here. Adjust.
(language_as_string): Renamed to ...
(language_to_string): ... here. Adjust.
(parm_as_string): Renamed to ...
(parm_to_string): ... here.
(op_as_string): Renamed to ...
(op_to_string): ... here.
(assop_as_string): Renamed to ...
(assop_to_string): ... here.
(type_to_string): New static print callback.
(args_as_string): Renamed to ...
(args_to_string): ... here. Adjust.
(cv_as_string): Renamed to ...
(cv_to_string): ... here. Adjust.
* pt.c (mangle_class_name_for_template): Use tree_string_flags.
(print_template_context): Likewise.
1999-09-26 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (expand_throw): Remove prototype.

View File

@ -3122,6 +3122,30 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define TEMPLATE_TYPE_DECL(NODE) \
(TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
/* Control stringification of trees (types, decls & exprs).
Bit or them together. */
enum tree_string_flags
{
TS_PLAIN, /* nothing special */
TS_CHASE_TYPEDEFS = 1 << 0, /* look through typedefs */
TS_DECORATE = 1 << 1, /* decorate things */
TS_FUNC_NORETURN = 1 << 2, /* inhibit function return type */
TS_FUNC_THROW = 1 << 3, /* show throw spec */
TS_PARM_DEFAULTS = 1 << 4, /* show parm defaults */
TS_EXPR_PARENS = 1 << 5, /* enclose in parens */
TS_AGGR_TAGS = 1 << 6, /* show struct tags */
TS_DECL_TYPE = 1 << 7, /* show decl's type */
TS_FUNC_SCOPE = 1 << 8, /* show function scope */
TS_PEDANTIC_NAME = 1 << 9, /* pedantically name things */
TS_TEMPLATE_PREFIX= 1 << 10, /* show template <parms> prefix */
/* Internal use flags */
TS_TEMPLATE_PARM = 1 << 11, /* decl is really a non-type template parm */
TS_TEMPLATE_PLAIN = 1 << 12, /* don't decorate primary template_name */
TS_NEXT_BIT = 13 /* next available bit */
};
/* in lex.c */
/* Indexed by TREE_CODE, these tables give C-looking names to
operators represented by TREE_CODES. For example,
@ -3430,18 +3454,10 @@ extern void cp_deprecated PROTO((const char*));
/* in error.c */
extern void init_error PROTO((void));
extern const char *fndecl_as_string PROTO((tree, int));
extern const char *type_as_string PROTO((tree, int));
extern const char *type_as_string_real PROTO((tree, int, int));
extern const char *args_as_string PROTO((tree, int));
extern const char *decl_as_string PROTO((tree, int));
extern const char *expr_as_string PROTO((tree, int));
extern const char *code_as_string PROTO((enum tree_code, int));
extern const char *language_as_string PROTO((enum languages, int));
extern const char *parm_as_string PROTO((int, int));
extern const char *op_as_string PROTO((enum tree_code, int));
extern const char *assop_as_string PROTO((enum tree_code, int));
extern const char *cv_as_string PROTO((tree, int));
extern const char *type_as_string PROTO((tree, enum tree_string_flags));
extern const char *decl_as_string PROTO((tree, enum tree_string_flags));
extern const char *expr_as_string PROTO((tree, enum tree_string_flags));
extern const char *context_as_string PROTO((tree, enum tree_string_flags));
extern const char *lang_decl_name PROTO((tree, int));
extern const char *cp_file_of PROTO((tree));
extern int cp_line_of PROTO((tree));

File diff suppressed because it is too large Load Diff

View File

@ -3527,7 +3527,7 @@ mangle_class_name_for_template (name, parms, arglist)
if (TREE_CODE (parm) == TYPE_DECL)
{
cat (type_as_string_real (arg, 0, 1));
cat (type_as_string (arg, TS_CHASE_TYPEDEFS));
continue;
}
else if (TREE_CODE (parm) == TEMPLATE_DECL)
@ -3551,7 +3551,7 @@ mangle_class_name_for_template (name, parms, arglist)
}
else
/* Output the parameter declaration */
cat (type_as_string_real (arg, 0, 1));
cat (type_as_string (arg, TS_CHASE_TYPEDEFS));
continue;
}
else
@ -4401,7 +4401,7 @@ print_template_context (err)
/* Avoid redundancy with the the "In function" line. */;
else
fprintf (stderr, "%s: In instantiation of `%s':\n",
file, decl_as_string (p->decl, 0));
file, decl_as_string (p->decl, TS_DECL_TYPE | TS_FUNC_NORETURN));
line = p->line;
file = p->file;
@ -4412,7 +4412,7 @@ print_template_context (err)
for (; p; p = p->next)
{
fprintf (stderr, "%s:%d: instantiated from `%s'\n", file, line,
decl_as_string (p->decl, 0));
decl_as_string (p->decl, TS_DECL_TYPE | TS_FUNC_NORETURN));
line = p->line;
file = p->file;
}