enum pad { none, before, after };
-/* These constants can used as bit flags in the process of tree formatting.
-
- TFF_PLAIN_IDENTIFER: unqualified part of a name.
- TFF_NAMESPACE_SCOPE: the complete qualified-id form of a name.
- TFF_CLASS_SCOPE: if possible, include the class-name part of a
- qualified-id. This flag may be implied in some circumstances by
- TFF_NAMESPACE_SCOPE.
- TFF_SCOPE: the combinaison of the two above.
- TFF_CHASE_TYPDEF: print the original type-id instead of the typedef-name.
- TFF_DECL_SPECIFIERS: print decl-specifiers.
- TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
- a class-key (resp. `enum').
- TFF_RETURN_TYPE: include function return type.
- TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
- TFF_EXCEPTION_SPECIFICATION: show function exception specification.
- TFF_TEMPLATE_HEADER: show the template<...> hearder in a
- template-declaration.
- TFF_TEMPLATE_DEFAULT_ARGUMENTS: show template paramter default values. */
-
-#define TFF_PLAIN_IDENTIFIER (0)
-#define TFF_NAMESPACE_SCOPE (1)
-#define TFF_CLASS_SCOPE (1 << 1)
-#define TFF_CHASE_NAMESPACE_ALIAS (1 << 2)
-#define TFF_CHASE_TYPEDEF (1 << 3)
-#define TFF_DECL_SPECIFIERS (1 << 4)
-#define TFF_CLASS_KEY_OR_ENUM (1 << 5)
-#define TFF_RETURN_TYPE (1 << 6)
-#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 7)
-#define TFF_EXCEPTION_SPECIFICATION (1 << 8)
-#define TFF_TEMPLATE_HEADER (1 << 9)
-#define TFF_TEMPLATE_DEFAULT_ARGUMENTS (1 << 10)
-#define TFF_SCOPE (TFF_NAMESPACE_SCOPE | TFF_CLASS_SCOPE)
-
/* This data structure bundles altogether, all the information necessary
for pretty-printing a C++ source-level entity represented by a tree. */
typedef struct
static const char *parm_to_string PARAMS ((int, int));
static const char *type_to_string PARAMS ((tree, int));
-static void dump_type PARAMS ((tree, enum tree_string_flags));
-static void dump_typename PARAMS ((tree, enum tree_string_flags));
-static void dump_simple_decl PARAMS ((tree, tree, enum tree_string_flags));
-static void dump_decl PARAMS ((tree, enum tree_string_flags));
-static void dump_template_decl PARAMS ((tree, enum tree_string_flags));
-static void dump_function_decl PARAMS ((tree, enum tree_string_flags));
-static void dump_expr PARAMS ((tree, enum tree_string_flags));
-static void dump_unary_op PARAMS ((const char *, tree, enum tree_string_flags));
-static void dump_binary_op PARAMS ((const char *, tree, enum tree_string_flags));
-static void dump_aggr_type PARAMS ((tree, enum tree_string_flags));
-static enum pad dump_type_prefix PARAMS ((tree, enum tree_string_flags));
-static void dump_type_suffix PARAMS ((tree, enum tree_string_flags));
-static void dump_function_name PARAMS ((tree, enum tree_string_flags));
-static void dump_expr_list PARAMS ((tree, enum tree_string_flags));
+static void dump_type PARAMS ((tree, int));
+static void dump_typename PARAMS ((tree, int));
+static void dump_simple_decl PARAMS ((tree, tree, int));
+static void dump_decl PARAMS ((tree, int));
+static void dump_template_decl PARAMS ((tree, int));
+static void dump_function_decl PARAMS ((tree, int));
+static void dump_expr PARAMS ((tree, int));
+static void dump_unary_op PARAMS ((const char *, tree, int));
+static void dump_binary_op PARAMS ((const char *, tree, int));
+static void dump_aggr_type PARAMS ((tree, int));
+static enum pad dump_type_prefix PARAMS ((tree, int));
+static void dump_type_suffix PARAMS ((tree, int));
+static void dump_function_name PARAMS ((tree, int));
+static void dump_expr_list PARAMS ((tree, int));
static void dump_global_iord PARAMS ((tree));
static enum pad dump_qualifiers PARAMS ((tree, enum pad));
static void dump_char PARAMS ((int));
-static void dump_parameters PARAMS ((tree, enum tree_string_flags));
-static void dump_exception_spec PARAMS ((tree, enum tree_string_flags));
+static void dump_parameters PARAMS ((tree, int));
+static void dump_exception_spec PARAMS ((tree, int));
static const char *class_key_or_enum PARAMS ((tree));
static tree ident_fndecl PARAMS ((tree));
-static void dump_template_argument PARAMS ((tree, enum tree_string_flags));
-static void dump_template_argument_list PARAMS ((tree, enum tree_string_flags));
-static void dump_template_parameter PARAMS ((tree, enum tree_string_flags));
+static void dump_template_argument PARAMS ((tree, int));
+static void dump_template_argument_list PARAMS ((tree, int));
+static void dump_template_parameter PARAMS ((tree, int));
static void dump_template_bindings PARAMS ((tree, tree));
-static void dump_scope PARAMS ((tree, enum tree_string_flags));
-static void dump_template_parms PARAMS ((tree, int, enum tree_string_flags));
+static void dump_scope PARAMS ((tree, int));
+static void dump_template_parms PARAMS ((tree, int, int));
static const char *function_category PARAMS ((tree));
static void lang_print_error_function PARAMS ((const char *));
static void
dump_scope (scope, flags)
tree scope;
- enum tree_string_flags flags;
+ int flags;
{
+ int f = ~TFF_RETURN_TYPE & (TFF_DECL_SPECIFIERS
+ | (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF)));
+
if (scope == NULL_TREE)
return;
{
if (scope != global_namespace)
{
- dump_decl (scope, (flags & (TS_PEDANTIC_NAME | TS_FUNC_SCOPE | TS_CHASE_TYPEDEFS))
- | TS_FUNC_NORETURN | TS_DECL_TYPE);
+ dump_decl (scope, f);
print_scope_operator (scratch_buffer);
}
- else if (flags & TS_PEDANTIC_NAME)
- print_scope_operator (scratch_buffer);
}
else if (AGGREGATE_TYPE_P (scope))
{
- dump_type (scope, (flags & (TS_PEDANTIC_NAME | TS_FUNC_SCOPE | TS_CHASE_TYPEDEFS))
- | TS_FUNC_NORETURN | TS_DECL_TYPE);
+ dump_type (scope, f);
print_scope_operator (scratch_buffer);
}
- else if ((flags & (TS_PEDANTIC_NAME | TS_FUNC_SCOPE))
- && TREE_CODE (scope) == FUNCTION_DECL)
+ else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL)
{
- dump_function_decl (scope, (flags & (TS_PEDANTIC_NAME | TS_FUNC_SCOPE | TS_CHASE_TYPEDEFS))
- | TS_FUNC_NORETURN | TS_DECL_TYPE);
+ dump_function_decl (scope, f);
print_scope_operator (scratch_buffer);
}
}
static void
dump_template_argument (arg, flags)
tree arg;
- enum tree_string_flags flags;
+ int flags;
{
if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
- dump_type (arg, flags & ~TS_AGGR_TAGS);
+ dump_type (arg, flags & ~TFF_CLASS_KEY_OR_ENUM);
else
- dump_expr (arg, (flags | TS_EXPR_PARENS) & ~TS_AGGR_TAGS);
+ dump_expr (arg, (flags | TFF_EXPR_IN_PARENS) & ~TFF_CLASS_KEY_OR_ENUM);
}
/* Dump a template-argument-list ARGS (always a TREE_VEC) under control
static void
dump_template_argument_list (args, flags)
tree args;
- enum tree_string_flags flags;
+ int flags;
{
int n = TREE_VEC_LENGTH (args);
int need_comma = 0;
static void
dump_template_parameter (parm, flags)
tree parm;
- enum tree_string_flags flags;
+ int flags;
{
tree p = TREE_VALUE (parm);
tree a = TREE_PURPOSE (parm);
if (TREE_CODE (p) == TYPE_DECL)
{
- if (flags & TS_DECL_TYPE)
+ if (flags & TFF_DECL_SPECIFIERS)
{
print_identifier (scratch_buffer, "class");
if (DECL_NAME (p))
print_identifier (scratch_buffer, "{template default argument error}");
}
else
- dump_decl (p, flags | TS_DECL_TYPE);
+ dump_decl (p, flags | TFF_DECL_SPECIFIERS);
- if ((flags & TS_PARM_DEFAULTS) && a != NULL_TREE)
+ if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
{
output_add_string (scratch_buffer, " = ");
if (TREE_CODE (a) == TYPE_DECL || TREE_CODE (a) == TEMPLATE_DECL)
- dump_type (a, flags & ~TS_CHASE_TYPEDEFS);
+ dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
else
- dump_expr (a, flags | TS_EXPR_PARENS);
+ dump_expr (a, flags | TFF_EXPR_IN_PARENS);
}
}
if (need_comma)
separate_with_comma (scratch_buffer);
- dump_template_parameter (TREE_VEC_ELT (p, i), TS_PLAIN);
+ dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER);
output_add_string (scratch_buffer, " = ");
if (arg)
- dump_template_argument (arg, TS_PLAIN);
+ dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
else
print_identifier (scratch_buffer, "<missing>");
static void
dump_type (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
if (t == NULL_TREE)
return;
break;
case TYPE_DECL:
- if (flags & TS_CHASE_TYPEDEFS)
+ if (flags & TFF_CHASE_TYPEDEF)
{
dump_type (DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
case TEMPLATE_DECL:
case NAMESPACE_DECL:
- dump_decl (t, flags & ~TS_DECL_TYPE);
+ dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
break;
case COMPLEX_TYPE:
{
tree type;
dump_qualifiers (t, after);
- type = flags & TS_CHASE_TYPEDEFS ? TYPE_MAIN_VARIANT (t) : t;
+ type = flags & TFF_CHASE_TYPEDEF ? TYPE_MAIN_VARIANT (t) : t;
if (TYPE_NAME (type) && TYPE_IDENTIFIER (type))
print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (type));
else
case TYPEOF_TYPE:
output_add_string (scratch_buffer, "__typeof (");
- dump_expr (TYPE_FIELDS (t), flags & ~TS_EXPR_PARENS);
+ dump_expr (TYPE_FIELDS (t), flags & ~TFF_EXPR_IN_PARENS);
print_left_paren (scratch_buffer);
break;
static void
dump_typename (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
tree ctx = TYPE_CONTEXT (t);
if (TREE_CODE (ctx) == TYPENAME_TYPE)
dump_typename (ctx, flags);
else
- dump_type (ctx, flags & ~TS_AGGR_TAGS);
+ dump_type (ctx, flags & ~TFF_CLASS_KEY_OR_ENUM);
print_scope_operator (scratch_buffer);
dump_decl (TYPENAME_TYPE_FULLNAME (t), flags);
}
static void
dump_aggr_type (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
tree name;
const char *variety = class_key_or_enum (t);
dump_qualifiers (t, after);
- if (flags & TS_AGGR_TAGS)
+ if (flags & TFF_CLASS_KEY_OR_ENUM)
{
print_identifier (scratch_buffer, variety);
output_add_space (scratch_buffer);
}
- if (flags & TS_CHASE_TYPEDEFS)
+ if (flags & TFF_CHASE_TYPEDEF)
t = TYPE_MAIN_VARIANT (t);
name = TYPE_NAME (t);
|| TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
|| DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t))
|| PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
- dump_scope (CP_DECL_CONTEXT (name), flags | TS_FUNC_SCOPE);
+ dump_scope (CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
if (tmplate)
{
/* Because the template names are mangled, we have to locate
if (name == 0 || ANON_AGGRNAME_P (name))
{
- if (flags & TS_AGGR_TAGS)
+ if (flags & TFF_CLASS_KEY_OR_ENUM)
print_identifier (scratch_buffer, "<anonymous>");
else
output_printf (scratch_buffer, "<anonymous %s>", variety);
if (tmplate)
dump_template_parms (TYPE_TEMPLATE_INFO (t),
!CLASSTYPE_USE_TEMPLATE (t),
- flags & ~TS_TEMPLATE_PREFIX);
+ flags & ~TFF_TEMPLATE_HEADER);
}
/* Dump into the obstack the initial part of the output for a given type.
static enum pad
dump_type_prefix (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
enum pad padding = before;
static void
dump_type_suffix (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
if (TYPE_PTRMEMFUNC_P (t))
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
/* Function pointers don't have default args. Not in standard C++,
anyway; they may in g++, but we'll just pretend otherwise. */
- dump_parameters (arg, flags & ~TS_PARM_DEFAULTS);
+ dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
if (TREE_CODE (t) == METHOD_TYPE)
dump_qualifiers
tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1);
else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR)
dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0),
- flags & ~TS_EXPR_PARENS);
+ flags & ~TFF_EXPR_IN_PARENS);
else
dump_expr (fold (cp_build_binary_op
(PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
integer_one_node)),
- flags & ~TS_EXPR_PARENS);
+ flags & ~TFF_EXPR_IN_PARENS);
}
print_right_bracket (scratch_buffer);
dump_type_suffix (TREE_TYPE (t), flags);
dump_simple_decl (t, type, flags)
tree t;
tree type;
- enum tree_string_flags flags;
+ int flags;
{
- if (flags & TS_DECL_TYPE)
+ if (flags & TFF_DECL_SPECIFIERS)
{
if (dump_type_prefix (type, flags) != none)
output_add_space (scratch_buffer);
dump_decl (DECL_NAME (t), flags);
else
print_identifier (scratch_buffer, "<anonymous>");
- if (flags & TS_DECL_TYPE)
+ if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (type, flags);
}
static void
dump_decl (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
if (t == NULL_TREE)
return;
/* Don't say 'typedef class A' */
if (DECL_ARTIFICIAL (t))
{
- if ((flags & TS_DECL_TYPE)
+ if ((flags & TFF_DECL_SPECIFIERS)
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
/* Say `class T' not just `T'. */
output_add_string (scratch_buffer, "class ");
break;
}
}
- if (flags & TS_DECORATE)
+ if (flags & TFF_DECL_SPECIFIERS)
output_add_string (scratch_buffer, "typedef ");
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
break;
case SCOPE_REF:
- dump_decl (TREE_OPERAND (t, 0), flags & ~TS_DECL_TYPE);
+ dump_decl (TREE_OPERAND (t, 0), flags & ~TFF_DECL_SPECIFIERS);
print_scope_operator (scratch_buffer);
dump_decl (TREE_OPERAND (t, 1), flags);
break;
dump_global_iord (DECL_ASSEMBLER_NAME (t));
else if (! DECL_LANG_SPECIFIC (t))
print_identifier (scratch_buffer, "<internal>");
- else if (flags & TS_PEDANTIC_NAME)
- dump_function_decl (t, flags | TS_FUNC_NORETURN | TS_DECL_TYPE);
else
dump_function_decl (t, flags);
break;
case TEMPLATE_DECL:
- if (flags & TS_PEDANTIC_NAME)
- dump_template_decl (t, flags | TS_FUNC_NORETURN | TS_DECL_TYPE);
- else
dump_template_decl (t, flags);
break;
else if (DECL_NAME (t))
dump_decl (DECL_NAME (t), flags);
else if (DECL_INITIAL (t))
- dump_expr (DECL_INITIAL (t), flags | TS_EXPR_PARENS);
+ dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
print_identifier (scratch_buffer, "enumerator");
break;
static void
dump_template_decl (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
tree orig_parms = DECL_TEMPLATE_PARMS (t);
tree parms;
int i;
- if (flags & TS_TEMPLATE_PREFIX)
+ if (flags & TFF_TEMPLATE_HEADER)
{
for (parms = orig_parms = nreverse (orig_parms);
parms;
nreverse(orig_parms);
/* If we've shown the template<args> prefix, we'd better show the
decl's type too. */
- flags |= TS_DECL_TYPE;
+ flags |= TFF_DECL_SPECIFIERS;
}
if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
dump_type (TREE_TYPE (t),
- ((flags & ~TS_AGGR_TAGS) | TS_TEMPLATE_PLAIN
- | (flags & TS_DECL_TYPE ? TS_AGGR_TAGS : 0)));
+ ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
+ | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
- dump_decl (DECL_TEMPLATE_RESULT (t), flags | TS_TEMPLATE_PLAIN);
+ dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
else if (TREE_TYPE (t) == NULL_TREE)
my_friendly_abort (353);
else
{
case METHOD_TYPE:
case FUNCTION_TYPE:
- dump_function_decl (t, flags | TS_TEMPLATE_PLAIN);
+ dump_function_decl (t, flags | TFF_TEMPLATE_NAME);
break;
default:
/* This case can occur with some illegal code. */
dump_type (TREE_TYPE (t),
- (flags & ~TS_AGGR_TAGS) | TS_TEMPLATE_PLAIN
- | (flags & TS_DECL_TYPE ? TS_AGGR_TAGS : 0));
+ (flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
+ | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0));
}
}
/* Pretty print a function decl. There are several ways we want to print a
- function declaration. The TS_FUNC bits in FLAGS tells us how to behave.
+ function declaration. The TFF_ bits in FLAGS tells us how to behave.
As cp_error can only apply the '#' flag once to give 0 and 1 for V, there
is %D which doesn't print the throw specs, and %F which does. */
static void
dump_function_decl (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
tree fntype;
tree parmtypes;
tree cname = NULL_TREE;
tree template_args = NULL_TREE;
tree template_parms = NULL_TREE;
- int show_return = !(flags & TS_FUNC_NORETURN) && (flags & TS_DECL_TYPE);
+ int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS;
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
else if (TREE_CODE (fntype) == METHOD_TYPE)
cname = TREE_TYPE (TREE_VALUE (parmtypes));
- if (!(flags & TS_DECORATE))
+ if (!(flags & TFF_DECL_SPECIFIERS))
/* OK */;
else if (DECL_STATIC_FUNCTION_P (t))
print_identifier (scratch_buffer, "static ");
dump_function_name (t, flags);
- if (flags & TS_DECL_TYPE)
+ if (flags & TFF_DECL_SPECIFIERS)
{
if (TREE_CODE (fntype) == METHOD_TYPE && parmtypes)
/* Skip "this" parameter. */
dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))),
before);
- if (flags & TS_FUNC_THROW)
+ if (flags & TFF_EXCEPTION_SPECIFICATION)
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
}
static void
dump_parameters (parmtypes, flags)
tree parmtypes;
- enum tree_string_flags flags;
+ int flags;
{
int first;
}
dump_type (TREE_VALUE (parmtypes), flags);
- if ((flags & TS_PARM_DEFAULTS) && TREE_PURPOSE (parmtypes))
+ if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes))
{
output_add_string (scratch_buffer, " = ");
- dump_expr (TREE_PURPOSE (parmtypes), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
}
}
static void
dump_exception_spec (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
if (t)
{
static void
dump_function_name (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
tree name = DECL_NAME (t);
if (DECL_DESTRUCTOR_P (t))
{
output_add_character (scratch_buffer, '~');
- dump_decl (name, TS_PLAIN);
+ dump_decl (name, TFF_PLAIN_IDENTIFIER);
}
else if (DECL_CONV_FN_P (t))
{
dump_template_parms (info, primary, flags)
tree info;
int primary;
- enum tree_string_flags flags;
+ int flags;
{
tree args = info ? TI_ARGS (info) : NULL_TREE;
- if (primary && flags & TS_TEMPLATE_PLAIN)
+ if (primary && flags & TFF_TEMPLATE_NAME)
return;
- flags &= ~(TS_AGGR_TAGS | TS_TEMPLATE_PLAIN);
+ flags &= ~(TFF_CLASS_KEY_OR_ENUM | TFF_TEMPLATE_NAME);
print_template_argument_list_start (scratch_buffer);
/* Be careful only to print things when we have them, so as not
if (ix)
separate_with_comma (scratch_buffer);
- dump_decl (parm, flags & ~TS_DECL_TYPE);
+ dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
}
}
print_template_argument_list_end (scratch_buffer);
static void
dump_expr_list (l, flags)
tree l;
- enum tree_string_flags flags;
+ int flags;
{
while (l)
{
- dump_expr (TREE_VALUE (l), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_VALUE (l), flags | TFF_EXPR_IN_PARENS);
l = TREE_CHAIN (l);
if (l)
separate_with_comma (scratch_buffer);
static void
dump_expr (t, flags)
tree t;
- enum tree_string_flags flags;
+ int flags;
{
switch (TREE_CODE (t))
{
case TEMPLATE_DECL:
case NAMESPACE_DECL:
case OVERLOAD:
- dump_decl (t, flags & ~TS_DECL_TYPE);
+ dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
break;
case INTEGER_CST:
case COMPOUND_EXPR:
print_left_paren (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
separate_with_comma (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
print_right_paren (scratch_buffer);
break;
case COND_EXPR:
print_left_paren (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, " ? ");
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, " : ");
- dump_expr (TREE_OPERAND (t, 2), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 2), flags | TFF_EXPR_IN_PARENS);
print_right_paren (scratch_buffer);
break;
}
else
{
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
}
break;
tree ob = TREE_VALUE (args);
if (TREE_CODE (ob) == ADDR_EXPR)
{
- dump_expr (TREE_OPERAND (ob, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
output_add_character (scratch_buffer, '.');
}
else if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
- dump_expr (ob, flags | TS_EXPR_PARENS);
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, "->");
}
args = TREE_CHAIN (args);
}
- dump_expr (fn, flags | TS_EXPR_PARENS);
+ dump_expr (fn, flags | TFF_EXPR_IN_PARENS);
print_left_paren (scratch_buffer);
dump_expr_list (args, flags);
print_right_paren (scratch_buffer);
default argument. Note we may have cleared out the first
operand in expand_expr, so don't go killing ourselves. */
if (TREE_OPERAND (t, 1))
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
break;
case INIT_EXPR:
if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
- dump_expr (ob, flags | TS_EXPR_PARENS);
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, "->");
}
}
else
{
- dump_expr (ob, flags | TS_EXPR_PARENS);
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
output_add_character (scratch_buffer, '.');
}
- dump_expr (TREE_OPERAND (t, 1), flags & ~TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
}
break;
case ARRAY_REF:
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
print_left_bracket (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
print_right_bracket (scratch_buffer);
break;
that the expression has pointer type. */
|| (TREE_TYPE (t)
&& TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE))
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
else
dump_unary_op ("&", t, flags);
break;
{
t = TREE_OPERAND (t, 0);
my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237);
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
print_left_paren (scratch_buffer);
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
print_right_paren (scratch_buffer);
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
print_left_paren (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
print_identifier
(scratch_buffer, operator_name_info[(int)TREE_CODE (t)].name);
print_right_paren (scratch_buffer);
if (TREE_CODE (next) == FUNCTION_TYPE)
{
- if (flags & TS_EXPR_PARENS)
+ if (flags & TFF_EXPR_IN_PARENS)
print_left_paren (scratch_buffer);
output_add_character (scratch_buffer, '*');
- dump_expr (TREE_OPERAND (t, 0), flags & ~TS_EXPR_PARENS);
- if (flags & TS_EXPR_PARENS)
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ if (flags & TFF_EXPR_IN_PARENS)
print_right_paren (scratch_buffer);
break;
}
/* else FALLTHRU */
}
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
break;
case NOP_EXPR:
if (integer_all_onesp (idx))
{
tree pfn = PFN_FROM_PTRMEMFUNC (t);
- dump_unary_op ("&", pfn, flags | TS_EXPR_PARENS);
+ dump_unary_op ("&", pfn, flags | TFF_EXPR_IN_PARENS);
break;
}
else if (TREE_CODE (idx) == INTEGER_CST
if (virtuals)
{
dump_expr (BV_FN (virtuals),
- flags | TS_EXPR_PARENS);
+ flags | TFF_EXPR_IN_PARENS);
break;
}
}
t = TREE_OPERAND (t, 1);
if (TREE_CODE (t) == FUNCTION_DECL)
/* A::f */
- dump_expr (t, flags | TS_EXPR_PARENS);
+ dump_expr (t, flags | TFF_EXPR_IN_PARENS);
else if (BASELINK_P (t))
- dump_expr (OVL_CURRENT (TREE_VALUE (t)), flags | TS_EXPR_PARENS);
+ dump_expr (OVL_CURRENT (TREE_VALUE (t)), flags | TFF_EXPR_IN_PARENS);
else
dump_decl (t, flags);
}
{
if (TREE_CODE (ob) == INDIRECT_REF)
{
- dump_expr (TREE_OPERAND (ob, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, "->*");
}
else
{
- dump_expr (ob, flags | TS_EXPR_PARENS);
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, ".*");
}
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
break;
}
case TEMPLATE_PARM_INDEX:
- dump_decl (TEMPLATE_PARM_DECL (t), flags & ~TS_DECL_TYPE);
+ dump_decl (TEMPLATE_PARM_DECL (t), flags & ~TFF_DECL_SPECIFIERS);
break;
case IDENTIFIER_NODE:
case SCOPE_REF:
dump_type (TREE_OPERAND (t, 0), flags);
print_scope_operator (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
break;
case CAST_EXPR:
if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (TREE_OPERAND (t, 0), flags);
else
- dump_unary_op ("*", t, flags | TS_EXPR_PARENS);
+ dump_unary_op ("*", t, flags | TFF_EXPR_IN_PARENS);
print_right_paren (scratch_buffer);
break;
case BIND_EXPR:
output_add_character (scratch_buffer, '}');
- dump_expr (TREE_OPERAND (t, 1), flags & ~TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
output_add_character (scratch_buffer, '}');
break;
case LOOP_EXPR:
output_add_string (scratch_buffer, "while (1) { ");
- dump_expr (TREE_OPERAND (t, 0), flags & ~TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
output_add_character (scratch_buffer, '}');
break;
case EXIT_EXPR:
output_add_string (scratch_buffer, "if (");
- dump_expr (TREE_OPERAND (t, 0), flags & ~TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
output_add_string (scratch_buffer, ") break; ");
break;
dump_binary_op (opstring, t, flags)
const char *opstring;
tree t;
- enum tree_string_flags flags;
+ int flags;
{
print_left_paren (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
output_add_space (scratch_buffer);
if (opstring)
print_identifier (scratch_buffer, opstring);
else
print_identifier (scratch_buffer, "<unknown operator>");
output_add_space (scratch_buffer);
- dump_expr (TREE_OPERAND (t, 1), flags | TS_EXPR_PARENS);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
print_right_paren (scratch_buffer);
}
dump_unary_op (opstring, t, flags)
const char *opstring;
tree t;
- enum tree_string_flags flags;
+ int flags;
{
- if (flags & TS_EXPR_PARENS)
+ if (flags & TFF_EXPR_IN_PARENS)
print_left_paren (scratch_buffer);
print_identifier (scratch_buffer, opstring);
- dump_expr (TREE_OPERAND (t, 0), flags & ~TS_EXPR_PARENS);
- if (flags & TS_EXPR_PARENS)
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ if (flags & TFF_EXPR_IN_PARENS)
print_right_paren (scratch_buffer);
}
-/* Exported interface to stringifying types, exprs and decls under TS_*
+/* Exported interface to stringifying types, exprs and decls under TFF_*
control. */
const char *
type_as_string (typ, flags)
tree typ;
- enum tree_string_flags flags;
+ int flags;
{
reinit_global_formatting_buffer ();
const char *
expr_as_string (decl, flags)
tree decl;
- enum tree_string_flags flags;
+ int flags;
{
reinit_global_formatting_buffer ();
const char *
decl_as_string (decl, flags)
tree decl;
- enum tree_string_flags flags;
+ int flags;
{
reinit_global_formatting_buffer ();
const char *
context_as_string (context, flags)
tree context;
- enum tree_string_flags flags;
+ int flags;
{
reinit_global_formatting_buffer ();
int v;
{
if (v >= 2)
- return decl_as_string (decl, TS_DECL_TYPE);
+ return decl_as_string (decl, TFF_DECL_SPECIFIERS);
reinit_global_formatting_buffer ();
if (v == 1 && DECL_CLASS_SCOPE_P (decl))
{
- dump_type (CP_DECL_CONTEXT (decl), TS_PLAIN);
+ dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
print_scope_operator (scratch_buffer);
}
if (TREE_CODE (decl) == FUNCTION_DECL)
- dump_function_name (decl, TS_PLAIN);
+ dump_function_name (decl, TFF_PLAIN_IDENTIFIER);
else
- dump_decl (DECL_NAME (decl), TS_PLAIN);
+ dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);
return output_finalize_message (scratch_buffer);
}
}
/* Now the interfaces from cp_error et al to dump_type et al. Each takes an
- on/off VERBOSE flag and supply the appropriate TS_ flags to a dump_
+ on/off VERBOSE flag and supply the appropriate TFF_ flags to a dump_
function. */
static const char *
tree decl;
int verbose;
{
- enum tree_string_flags flags = 0;
+ int flags = 0;
if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == RECORD_TYPE
|| TREE_CODE (decl) == UNION_TYPE || TREE_CODE (decl) == ENUMERAL_TYPE)
- flags = TS_AGGR_TAGS;
+ flags = TFF_CLASS_KEY_OR_ENUM;
if (verbose)
- flags |= TS_DECL_TYPE | TS_DECORATE | TS_PARM_DEFAULTS;
+ flags |= TFF_DECL_SPECIFIERS | TFF_FUNCTION_DEFAULT_ARGUMENTS;
else if (TREE_CODE (decl) == FUNCTION_DECL)
- flags |= TS_DECL_TYPE | TS_FUNC_NORETURN;
- flags |= TS_TEMPLATE_PREFIX;
+ flags |= TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE;
+ flags |= TFF_TEMPLATE_HEADER;
reinit_global_formatting_buffer ();
tree fndecl;
int verbose;
{
- enum tree_string_flags flags;
+ int flags;
- flags = TS_FUNC_THROW | TS_DECL_TYPE;
+ flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS;
if (verbose)
- flags |= TS_PARM_DEFAULTS;
+ flags |= TFF_FUNCTION_DEFAULT_ARGUMENTS;
reinit_global_formatting_buffer ();
dump_decl (fndecl, flags);
tree typ;
int verbose;
{
- enum tree_string_flags flags;
+ int flags;
flags = 0;
if (verbose)
- flags |= TS_AGGR_TAGS;
- flags |= TS_TEMPLATE_PREFIX;
+ flags |= TFF_CLASS_KEY_OR_ENUM;
+ flags |= TFF_TEMPLATE_HEADER;
reinit_global_formatting_buffer ();
tree p;
int verbose;
{
- enum tree_string_flags flags = 0;
+ int flags = 0;
if (verbose)
- flags |= TS_AGGR_TAGS;
+ flags |= TFF_CLASS_KEY_OR_ENUM;
if (p == NULL_TREE)
return "";
else
output_verbatim (buffer, "%s: In instantiation of `%s':\n", file,
decl_as_string (TINST_DECL (p),
- TS_DECL_TYPE | TS_FUNC_NORETURN));
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
line = TINST_LINE (p);
file = TINST_FILE (p);
{
output_verbatim
(buffer, "%s:%d: instantiated from `%s'\n", file, line,
- decl_as_string (TINST_DECL (t), TS_DECL_TYPE | TS_FUNC_NORETURN));
+ decl_as_string (TINST_DECL (t), TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
line = TINST_LINE (t);
file = TINST_FILE (t);
}