* [pushed 1/3] pretty_printer: rename instances named "buffer" to "pp"
@ 2024-06-12 13:37 David Malcolm
2024-06-12 13:37 ` [pushed 2/3] pretty_printer: make all fields private David Malcolm
2024-06-12 13:37 ` [pushed 3/3] pretty_printer: convert chunk_info into a class David Malcolm
0 siblings, 2 replies; 3+ messages in thread
From: David Malcolm @ 2024-06-12 13:37 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
Various pretty_printer instances are named "buffer", but a
pretty_printer *has* a buffer, rather than *is* a buffer.
For example,
pp_buffer (buffer)->digit_buffer
is referring to "buffer"'s buffer's digit_buffer.
This mechanical patch renames such variables to "pp", which I find much
clearer; the above becomes:
pp_buffer (pp)->digit_buffer
i.e. "pp's buffer's digit_buffer".
No functional change intended.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
Pushed to trunk as r15-1208-gfc47393acfae81.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/c-family/ChangeLog:
* c-ada-spec.cc: Rename pretty_printer "buffer" to "pp"
throughout.
gcc/ChangeLog:
* gimple-pretty-print.cc: Rename pretty_printer "buffer" to "pp"
throughout.
* print-tree.cc (print_node): Likewise.
* tree-loop-distribution.cc (dot_rdg_1): Likewise.
* tree-pretty-print.h (dump_location): Likewise.
* value-range.cc (vrange::dump): Likewise.
(irange_bitmask::dump): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
gcc/c-family/c-ada-spec.cc | 876 ++++++++--------
gcc/gimple-pretty-print.cc | 1774 ++++++++++++++++-----------------
gcc/print-tree.cc | 8 +-
gcc/tree-loop-distribution.cc | 10 +-
gcc/tree-pretty-print.h | 2 +-
gcc/value-range.cc | 26 +-
6 files changed, 1348 insertions(+), 1348 deletions(-)
diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index 0bea923220bb..e0e72493151b 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -40,7 +40,7 @@ static void dump_ada_structure (pretty_printer *, tree, tree, bool, int);
static char *to_ada_name (const char *, bool *);
#define INDENT(SPACE) \
- do { int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
+ do { int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
#define INDENT_INCR 3
@@ -910,9 +910,9 @@ dump_ada_nodes (pretty_printer *pp, const char *source_file)
/* Dump a newline and indent BUFFER by SPC chars. */
static void
-newline_and_indent (pretty_printer *buffer, int spc)
+newline_and_indent (pretty_printer *pp, int spc)
{
- pp_newline (buffer);
+ pp_newline (pp);
INDENT (spc);
}
@@ -1382,12 +1382,12 @@ separate_class_package (tree decl)
static bool package_prefix = true;
-/* Dump in BUFFER the name of an identifier NODE of type TYPE, following Ada
+/* Dump in PP the name of an identifier NODE of type TYPE, following Ada
syntax. LIMITED_ACCESS indicates whether NODE can be accessed through a
limited 'with' clause rather than a regular 'with' clause. */
static void
-pp_ada_tree_identifier (pretty_printer *buffer, tree node, tree type,
+pp_ada_tree_identifier (pretty_printer *pp, tree node, tree type,
bool limited_access)
{
const char *name = IDENTIFIER_POINTER (node);
@@ -1419,8 +1419,8 @@ pp_ada_tree_identifier (pretty_printer *buffer, tree node, tree type,
{
char *s1 = get_ada_package (xloc.file);
append_withs (s1, limited_access);
- pp_string (buffer, s1);
- pp_dot (buffer);
+ pp_string (pp, s1);
+ pp_dot (pp);
free (s1);
}
break;
@@ -1431,59 +1431,59 @@ pp_ada_tree_identifier (pretty_printer *buffer, tree node, tree type,
/* Generate the additional package prefix for C++ classes. */
if (separate_class_package (decl))
{
- pp_string (buffer, "Class_");
- pp_string (buffer, s);
- pp_dot (buffer);
+ pp_string (pp, "Class_");
+ pp_string (pp, s);
+ pp_dot (pp);
}
}
}
if (space_found)
if (!strcmp (s, "short_int"))
- pp_string (buffer, "short");
+ pp_string (pp, "short");
else if (!strcmp (s, "short_unsigned_int"))
- pp_string (buffer, "unsigned_short");
+ pp_string (pp, "unsigned_short");
else if (!strcmp (s, "unsigned_int"))
- pp_string (buffer, "unsigned");
+ pp_string (pp, "unsigned");
else if (!strcmp (s, "long_int"))
- pp_string (buffer, "long");
+ pp_string (pp, "long");
else if (!strcmp (s, "long_unsigned_int"))
- pp_string (buffer, "unsigned_long");
+ pp_string (pp, "unsigned_long");
else if (!strcmp (s, "long_long_int"))
- pp_string (buffer, "Long_Long_Integer");
+ pp_string (pp, "Long_Long_Integer");
else if (!strcmp (s, "long_long_unsigned_int"))
{
if (package_prefix)
{
append_withs ("Interfaces.C.Extensions", false);
- pp_string (buffer, "Extensions.unsigned_long_long");
+ pp_string (pp, "Extensions.unsigned_long_long");
}
else
- pp_string (buffer, "unsigned_long_long");
+ pp_string (pp, "unsigned_long_long");
}
else
- pp_string(buffer, s);
+ pp_string (pp, s);
else
if (!strcmp (s, "u_Bool") || !strcmp (s, "bool"))
{
if (package_prefix)
{
append_withs ("Interfaces.C.Extensions", false);
- pp_string (buffer, "Extensions.bool");
+ pp_string (pp, "Extensions.bool");
}
else
- pp_string (buffer, "bool");
+ pp_string (pp, "bool");
}
else
- pp_string(buffer, s);
+ pp_string (pp, s);
free (s);
}
-/* Dump in BUFFER the assembly name of T. */
+/* Dump in PP the assembly name of T. */
static void
-pp_asm_name (pretty_printer *buffer, tree t)
+pp_asm_name (pretty_printer *pp, tree t)
{
tree name = DECL_ASSEMBLER_NAME (t);
char *ada_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (name) + 1), *s;
@@ -1498,112 +1498,112 @@ pp_asm_name (pretty_printer *buffer, tree t)
}
*s = '\0';
- pp_string (buffer, ada_name);
+ pp_string (pp, ada_name);
}
-/* Dump in BUFFER the name of a DECL node if set, in Ada syntax.
+/* Dump in PP the name of a DECL node if set, in Ada syntax.
LIMITED_ACCESS indicates whether NODE can be accessed via a
limited 'with' clause rather than a regular 'with' clause. */
static void
-dump_ada_decl_name (pretty_printer *buffer, tree decl, bool limited_access)
+dump_ada_decl_name (pretty_printer *pp, tree decl, bool limited_access)
{
if (DECL_NAME (decl))
- pp_ada_tree_identifier (buffer, DECL_NAME (decl), decl, limited_access);
+ pp_ada_tree_identifier (pp, DECL_NAME (decl), decl, limited_access);
else
{
tree type_name = TYPE_NAME (TREE_TYPE (decl));
if (!type_name)
{
- pp_string (buffer, "anon");
+ pp_string (pp, "anon");
if (TREE_CODE (decl) == FIELD_DECL)
- pp_decimal_int (buffer, DECL_UID (decl));
+ pp_decimal_int (pp, DECL_UID (decl));
else
- pp_decimal_int (buffer, TYPE_UID (TREE_TYPE (decl)));
+ pp_decimal_int (pp, TYPE_UID (TREE_TYPE (decl)));
}
else if (TREE_CODE (type_name) == IDENTIFIER_NODE)
- pp_ada_tree_identifier (buffer, type_name, decl, limited_access);
+ pp_ada_tree_identifier (pp, type_name, decl, limited_access);
}
}
-/* Dump in BUFFER a name for the type T, which is a TYPE without TYPE_NAME. */
+/* Dump in PP a name for the type T, which is a TYPE without TYPE_NAME. */
static void
-dump_anonymous_type_name (pretty_printer *buffer, tree t)
+dump_anonymous_type_name (pretty_printer *pp, tree t)
{
- pp_string (buffer, "anon");
+ pp_string (pp, "anon");
switch (TREE_CODE (t))
{
case ARRAY_TYPE:
- pp_string (buffer, "_array");
+ pp_string (pp, "_array");
break;
case ENUMERAL_TYPE:
- pp_string (buffer, "_enum");
+ pp_string (pp, "_enum");
break;
case RECORD_TYPE:
- pp_string (buffer, "_struct");
+ pp_string (pp, "_struct");
break;
case UNION_TYPE:
- pp_string (buffer, "_union");
+ pp_string (pp, "_union");
break;
default:
- pp_string (buffer, "_unknown");
+ pp_string (pp, "_unknown");
break;
}
- pp_decimal_int (buffer, TYPE_UID (t));
+ pp_decimal_int (pp, TYPE_UID (t));
}
-/* Dump in BUFFER aspect Import on a given node T. SPC is the current
+/* Dump in PP aspect Import on a given node T. SPC is the current
indentation level. */
static void
-dump_ada_import (pretty_printer *buffer, tree t, int spc)
+dump_ada_import (pretty_printer *pp, tree t, int spc)
{
const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
const bool is_stdcall
= TREE_CODE (t) == FUNCTION_DECL
&& lookup_attribute ("stdcall", TYPE_ATTRIBUTES (TREE_TYPE (t)));
- pp_string (buffer, "with Import => True, ");
+ pp_string (pp, "with Import => True, ");
- newline_and_indent (buffer, spc + 5);
+ newline_and_indent (pp, spc + 5);
if (is_stdcall)
- pp_string (buffer, "Convention => Stdcall, ");
+ pp_string (pp, "Convention => Stdcall, ");
else if (name[0] == '_' && name[1] == 'Z')
- pp_string (buffer, "Convention => CPP, ");
+ pp_string (pp, "Convention => CPP, ");
else
- pp_string (buffer, "Convention => C, ");
+ pp_string (pp, "Convention => C, ");
- newline_and_indent (buffer, spc + 5);
+ newline_and_indent (pp, spc + 5);
tree sec = lookup_attribute ("section", DECL_ATTRIBUTES (t));
if (sec)
{
- pp_string (buffer, "Linker_Section => \"");
- pp_string (buffer, TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (sec))));
- pp_string (buffer, "\", ");
- newline_and_indent (buffer, spc + 5);
+ pp_string (pp, "Linker_Section => \"");
+ pp_string (pp, TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (sec))));
+ pp_string (pp, "\", ");
+ newline_and_indent (pp, spc + 5);
}
- pp_string (buffer, "External_Name => \"");
+ pp_string (pp, "External_Name => \"");
if (is_stdcall)
- pp_string (buffer, IDENTIFIER_POINTER (DECL_NAME (t)));
+ pp_string (pp, IDENTIFIER_POINTER (DECL_NAME (t)));
else
- pp_asm_name (buffer, t);
+ pp_asm_name (pp, t);
- pp_string (buffer, "\";");
+ pp_string (pp, "\";");
}
/* Check whether T and its type have different names, and append "the_"
- otherwise in BUFFER. */
+ otherwise in PP. */
static void
-check_type_name_conflict (pretty_printer *buffer, tree t)
+check_type_name_conflict (pretty_printer *pp, tree t)
{
tree tmp = TREE_TYPE (t);
@@ -1626,18 +1626,18 @@ check_type_name_conflict (pretty_printer *buffer, tree t)
s = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (tmp)));
if (!strcasecmp (IDENTIFIER_POINTER (DECL_NAME (t)), s))
- pp_string (buffer, "the_");
+ pp_string (pp, "the_");
}
}
-/* Dump in BUFFER a function declaration FUNC in Ada syntax.
+/* Dump in PP a function declaration FUNC in Ada syntax.
IS_METHOD indicates whether FUNC is a C++ method.
IS_CONSTRUCTOR whether FUNC is a C++ constructor.
IS_DESTRUCTOR whether FUNC is a C++ destructor.
SPC is the current indentation level. */
static void
-dump_ada_function_declaration (pretty_printer *buffer, tree func,
+dump_ada_function_declaration (pretty_printer *pp, tree func,
bool is_method, bool is_constructor,
bool is_destructor, int spc)
{
@@ -1670,12 +1670,12 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
num_args = 1;
if (num_args > 2)
- newline_and_indent (buffer, spc + 1);
+ newline_and_indent (pp, spc + 1);
if (num_args > 0)
{
- pp_space (buffer);
- pp_left_paren (buffer);
+ pp_space (pp);
+ pp_left_paren (pp);
}
/* For a function, see if we have the corresponding arguments. */
@@ -1707,24 +1707,24 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
{
if (DECL_NAME (arg))
{
- check_type_name_conflict (buffer, arg);
- pp_ada_tree_identifier (buffer, DECL_NAME (arg), NULL_TREE,
+ check_type_name_conflict (pp, arg);
+ pp_ada_tree_identifier (pp, DECL_NAME (arg), NULL_TREE,
false);
- pp_string (buffer, " : ");
+ pp_string (pp, " : ");
}
else
{
sprintf (buf, "arg%d : ", num);
- pp_string (buffer, buf);
+ pp_string (pp, buf);
}
- dump_ada_node (buffer, TREE_TYPE (arg), type, spc, false, true);
+ dump_ada_node (pp, TREE_TYPE (arg), type, spc, false, true);
}
else
{
sprintf (buf, "arg%d : ", num);
- pp_string (buffer, buf);
- dump_ada_node (buffer, TREE_VALUE (arg), type, spc, false, true);
+ pp_string (pp, buf);
+ dump_ada_node (pp, TREE_VALUE (arg), type, spc, false, true);
}
/* If the type is a pointer to a tagged type, we need to differentiate
@@ -1738,47 +1738,47 @@ dump_ada_function_declaration (pretty_printer *buffer, tree func,
&& POINTER_TYPE_P (TREE_TYPE (arg))
&& is_tagged_type (TREE_TYPE (TREE_TYPE (arg)))
&& !(num == 1 && is_method && (DECL_VINDEX (func) || is_constructor)))
- pp_string (buffer, "'Class");
+ pp_string (pp, "'Class");
arg = TREE_CHAIN (arg);
if (num < num_args)
{
- pp_semicolon (buffer);
+ pp_semicolon (pp);
if (num_args > 2)
- newline_and_indent (buffer, spc + INDENT_INCR);
+ newline_and_indent (pp, spc + INDENT_INCR);
else
- pp_space (buffer);
+ pp_space (pp);
}
}
if (have_ellipsis)
{
- pp_string (buffer, " -- , ...");
- newline_and_indent (buffer, spc + INDENT_INCR);
+ pp_string (pp, " -- , ...");
+ newline_and_indent (pp, spc + INDENT_INCR);
}
if (num_args > 0)
- pp_right_paren (buffer);
+ pp_right_paren (pp);
if (is_constructor || !VOID_TYPE_P (TREE_TYPE (type)))
{
- pp_string (buffer, " return ");
+ pp_string (pp, " return ");
tree rtype = is_constructor ? DECL_CONTEXT (func) : TREE_TYPE (type);
- dump_ada_node (buffer, rtype, rtype, spc, false, true);
+ dump_ada_node (pp, rtype, rtype, spc, false, true);
}
}
-/* Dump in BUFFER all the domains associated with an array NODE,
+/* Dump in PP all the domains associated with an array NODE,
in Ada syntax. SPC is the current indentation level. */
static void
-dump_ada_array_domains (pretty_printer *buffer, tree node, int spc)
+dump_ada_array_domains (pretty_printer *pp, tree node, int spc)
{
bool first = true;
- pp_left_paren (buffer);
+ pp_left_paren (pp);
for (; TREE_CODE (node) == ARRAY_TYPE; node = TREE_TYPE (node))
{
@@ -1790,33 +1790,33 @@ dump_ada_array_domains (pretty_printer *buffer, tree node, int spc)
tree max = TYPE_MAX_VALUE (domain);
if (!first)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
first = false;
if (min)
- dump_ada_node (buffer, min, NULL_TREE, spc, false, true);
- pp_string (buffer, " .. ");
+ dump_ada_node (pp, min, NULL_TREE, spc, false, true);
+ pp_string (pp, " .. ");
/* If the upper bound is zero, gcc may generate a NULL_TREE
for TYPE_MAX_VALUE rather than an integer_cst. */
if (max)
- dump_ada_node (buffer, max, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, max, NULL_TREE, spc, false, true);
else
- pp_string (buffer, "0");
+ pp_string (pp, "0");
}
else
{
- pp_string (buffer, "size_t");
+ pp_string (pp, "size_t");
first = false;
}
}
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
-/* Dump in BUFFER file:line information related to NODE. */
+/* Dump in PP file:line information related to NODE. */
static void
-dump_sloc (pretty_printer *buffer, tree node)
+dump_sloc (pretty_printer *pp, tree node)
{
expanded_location xloc;
@@ -1829,9 +1829,9 @@ dump_sloc (pretty_printer *buffer, tree node)
if (xloc.file)
{
- pp_string (buffer, xloc.file);
- pp_colon (buffer);
- pp_decimal_int (buffer, xloc.line);
+ pp_string (pp, xloc.file);
+ pp_colon (pp);
+ pp_decimal_int (pp, xloc.line);
}
}
@@ -1845,68 +1845,68 @@ is_char_array (tree t)
&& id_equal (DECL_NAME (TYPE_NAME (TREE_TYPE (t))), "char");
}
-/* Dump in BUFFER an array type NODE in Ada syntax. SPC is the indentation
+/* Dump in PP an array type NODE in Ada syntax. SPC is the indentation
level. */
static void
-dump_ada_array_type (pretty_printer *buffer, tree node, int spc)
+dump_ada_array_type (pretty_printer *pp, tree node, int spc)
{
const bool char_array = is_char_array (node);
/* Special case char arrays. */
if (char_array)
- pp_string (buffer, "Interfaces.C.char_array ");
+ pp_string (pp, "Interfaces.C.char_array ");
else
- pp_string (buffer, "array ");
+ pp_string (pp, "array ");
/* Print the dimensions. */
- dump_ada_array_domains (buffer, node, spc);
+ dump_ada_array_domains (pp, node, spc);
/* Print the component type. */
if (!char_array)
{
tree tmp = strip_array_types (node);
- pp_string (buffer, " of ");
+ pp_string (pp, " of ");
if (TREE_CODE (tmp) != POINTER_TYPE && !packed_layout)
- pp_string (buffer, "aliased ");
+ pp_string (pp, "aliased ");
if (TYPE_NAME (tmp)
|| (!RECORD_OR_UNION_TYPE_P (tmp)
&& TREE_CODE (tmp) != ENUMERAL_TYPE))
- dump_ada_node (buffer, tmp, node, spc, false, true);
+ dump_ada_node (pp, tmp, node, spc, false, true);
else
- dump_anonymous_type_name (buffer, tmp);
+ dump_anonymous_type_name (pp, tmp);
}
}
-/* Dump in BUFFER type names associated with a template, each prepended with
+/* Dump in PP type names associated with a template, each prepended with
'_'. TYPES is the TREE_PURPOSE of a DECL_TEMPLATE_INSTANTIATIONS. SPC is
the indentation level. */
static void
-dump_template_types (pretty_printer *buffer, tree types, int spc)
+dump_template_types (pretty_printer *pp, tree types, int spc)
{
for (int i = 0; i < TREE_VEC_LENGTH (types); i++)
{
tree elem = TREE_VEC_ELT (types, i);
- pp_underscore (buffer);
+ pp_underscore (pp);
- if (!dump_ada_node (buffer, elem, NULL_TREE, spc, false, true))
+ if (!dump_ada_node (pp, elem, NULL_TREE, spc, false, true))
{
- pp_string (buffer, "unknown");
- pp_scalar (buffer, HOST_SIZE_T_PRINT_UNSIGNED,
+ pp_string (pp, "unknown");
+ pp_scalar (pp, HOST_SIZE_T_PRINT_UNSIGNED,
(fmt_size_t) TREE_HASH (elem));
}
}
}
-/* Dump in BUFFER the contents of all class instantiations associated with
+/* Dump in PP the contents of all class instantiations associated with
a given template T. SPC is the indentation level. */
static int
-dump_ada_template (pretty_printer *buffer, tree t, int spc)
+dump_ada_template (pretty_printer *pp, tree t, int spc)
{
/* DECL_SIZE_UNIT is DECL_TEMPLATE_INSTANTIATIONS in this context. */
tree inst = DECL_SIZE_UNIT (t);
@@ -1945,39 +1945,39 @@ dump_ada_template (pretty_printer *buffer, tree t, int spc)
num_inst++;
INDENT (spc);
- pp_string (buffer, "package ");
+ pp_string (pp, "package ");
package_prefix = false;
- dump_ada_node (buffer, instance, t, spc, false, true);
- dump_template_types (buffer, types, spc);
- pp_string (buffer, " is");
+ dump_ada_node (pp, instance, t, spc, false, true);
+ dump_template_types (pp, types, spc);
+ pp_string (pp, " is");
spc += INDENT_INCR;
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
TREE_VISITED (get_underlying_decl (instance)) = 1;
- pp_string (buffer, "type ");
- dump_ada_node (buffer, instance, t, spc, false, true);
+ pp_string (pp, "type ");
+ dump_ada_node (pp, instance, t, spc, false, true);
package_prefix = true;
if (is_tagged_type (instance))
- pp_string (buffer, " is tagged limited ");
+ pp_string (pp, " is tagged limited ");
else
- pp_string (buffer, " is limited ");
+ pp_string (pp, " is limited ");
- dump_ada_node (buffer, instance, t, spc, false, false);
- pp_newline (buffer);
+ dump_ada_node (pp, instance, t, spc, false, false);
+ pp_newline (pp);
spc -= INDENT_INCR;
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
- pp_string (buffer, "end;");
- newline_and_indent (buffer, spc);
- pp_string (buffer, "use ");
+ pp_string (pp, "end;");
+ newline_and_indent (pp, spc);
+ pp_string (pp, "use ");
package_prefix = false;
- dump_ada_node (buffer, instance, t, spc, false, true);
- dump_template_types (buffer, types, spc);
+ dump_ada_node (pp, instance, t, spc, false, true);
+ dump_template_types (pp, types, spc);
package_prefix = true;
- pp_semicolon (buffer);
- pp_newline (buffer);
- pp_newline (buffer);
+ pp_semicolon (pp);
+ pp_newline (pp);
+ pp_newline (pp);
}
return num_inst > 0;
@@ -2007,41 +2007,41 @@ is_simple_enum (tree node)
return true;
}
-/* Dump in BUFFER the declaration of enumeral NODE of type TYPE in Ada syntax.
+/* Dump in PP the declaration of enumeral NODE of type TYPE in Ada syntax.
SPC is the indentation level. */
static void
-dump_ada_enum_type (pretty_printer *buffer, tree node, tree type, int spc)
+dump_ada_enum_type (pretty_printer *pp, tree node, tree type, int spc)
{
if (is_simple_enum (node))
{
bool first = true;
spc += INDENT_INCR;
- newline_and_indent (buffer, spc - 1);
- pp_left_paren (buffer);
+ newline_and_indent (pp, spc - 1);
+ pp_left_paren (pp);
for (tree value = TYPE_VALUES (node); value; value = TREE_CHAIN (value))
{
if (first)
first = false;
else
{
- pp_comma (buffer);
- newline_and_indent (buffer, spc);
+ pp_comma (pp);
+ newline_and_indent (pp, spc);
}
- pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, false);
+ pp_ada_tree_identifier (pp, TREE_PURPOSE (value), node, false);
}
- pp_string (buffer, ")");
+ pp_string (pp, ")");
spc -= INDENT_INCR;
- newline_and_indent (buffer, spc);
- pp_string (buffer, "with Convention => C");
+ newline_and_indent (pp, spc);
+ pp_string (pp, "with Convention => C");
}
else
{
if (TYPE_UNSIGNED (node))
- pp_string (buffer, "unsigned");
+ pp_string (pp, "unsigned");
else
- pp_string (buffer, "int");
+ pp_string (pp, "int");
for (tree value = TYPE_VALUES (node); value; value = TREE_CHAIN (value))
{
@@ -2050,29 +2050,29 @@ dump_ada_enum_type (pretty_printer *buffer, tree node, tree type, int spc)
if (TREE_CODE (int_val) != INTEGER_CST)
int_val = DECL_INITIAL (int_val);
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
+ pp_semicolon (pp);
+ newline_and_indent (pp, spc);
if (TYPE_NAME (node))
- dump_ada_node (buffer, node, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, node, NULL_TREE, spc, false, true);
else if (type)
- dump_ada_node (buffer, type, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, type, NULL_TREE, spc, false, true);
else
- dump_anonymous_type_name (buffer, node);
- pp_underscore (buffer);
- pp_ada_tree_identifier (buffer, TREE_PURPOSE (value), node, false);
+ dump_anonymous_type_name (pp, node);
+ pp_underscore (pp);
+ pp_ada_tree_identifier (pp, TREE_PURPOSE (value), node, false);
- pp_string (buffer, " : constant ");
+ pp_string (pp, " : constant ");
if (TYPE_NAME (node))
- dump_ada_node (buffer, node, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, node, NULL_TREE, spc, false, true);
else if (type)
- dump_ada_node (buffer, type, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, type, NULL_TREE, spc, false, true);
else
- dump_anonymous_type_name (buffer, node);
+ dump_anonymous_type_name (pp, node);
- pp_string (buffer, " := ");
- dump_ada_node (buffer, int_val, node, spc, false, true);
+ pp_string (pp, " := ");
+ dump_ada_node (pp, int_val, node, spc, false, true);
}
}
}
@@ -2127,13 +2127,13 @@ is_float128 (tree node)
|| id_equal (name, "_Float128x");
}
-/* Recursively dump in BUFFER Ada declarations corresponding to NODE of type
+/* Recursively dump in PP Ada declarations corresponding to NODE of type
TYPE. SPC is the indentation level. LIMITED_ACCESS indicates whether NODE
can be referenced via a "limited with" clause. NAME_ONLY indicates whether
we should only dump the name of NODE, instead of its full declaration. */
static int
-dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
+dump_ada_node (pretty_printer *pp, tree node, tree type, int spc,
bool limited_access, bool name_only)
{
if (node == NULL_TREE)
@@ -2142,24 +2142,24 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
switch (TREE_CODE (node))
{
case ERROR_MARK:
- pp_string (buffer, "<<< error >>>");
+ pp_string (pp, "<<< error >>>");
return 0;
case IDENTIFIER_NODE:
- pp_ada_tree_identifier (buffer, node, type, limited_access);
+ pp_ada_tree_identifier (pp, node, type, limited_access);
break;
case TREE_LIST:
- pp_string (buffer, "--- unexpected node: TREE_LIST");
+ pp_string (pp, "--- unexpected node: TREE_LIST");
return 0;
case TREE_BINFO:
- dump_ada_node (buffer, BINFO_TYPE (node), type, spc, limited_access,
+ dump_ada_node (pp, BINFO_TYPE (node), type, spc, limited_access,
name_only);
return 0;
case TREE_VEC:
- pp_string (buffer, "--- unexpected node: TREE_VEC");
+ pp_string (pp, "--- unexpected node: TREE_VEC");
return 0;
case NULLPTR_TYPE:
@@ -2167,63 +2167,63 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
if (package_prefix)
{
append_withs ("System", false);
- pp_string (buffer, "System.Address");
+ pp_string (pp, "System.Address");
}
else
- pp_string (buffer, "address");
+ pp_string (pp, "address");
break;
case VECTOR_TYPE:
- pp_string (buffer, "<vector>");
+ pp_string (pp, "<vector>");
break;
case COMPLEX_TYPE:
if (is_float128 (TREE_TYPE (node)))
{
append_withs ("Interfaces.C.Extensions", false);
- pp_string (buffer, "Extensions.CFloat_128");
+ pp_string (pp, "Extensions.CFloat_128");
}
else if (TREE_TYPE (node) == float_type_node)
{
append_withs ("Ada.Numerics.Complex_Types", false);
- pp_string (buffer, "Ada.Numerics.Complex_Types.Complex");
+ pp_string (pp, "Ada.Numerics.Complex_Types.Complex");
}
else if (TREE_TYPE (node) == double_type_node)
{
append_withs ("Ada.Numerics.Long_Complex_Types", false);
- pp_string (buffer, "Ada.Numerics.Long_Complex_Types.Complex");
+ pp_string (pp, "Ada.Numerics.Long_Complex_Types.Complex");
}
else if (TREE_TYPE (node) == long_double_type_node)
{
append_withs ("Ada.Numerics.Long_Long_Complex_Types", false);
- pp_string (buffer, "Ada.Numerics.Long_Long_Complex_Types.Complex");
+ pp_string (pp, "Ada.Numerics.Long_Long_Complex_Types.Complex");
}
else
- pp_string (buffer, "<complex>");
+ pp_string (pp, "<complex>");
break;
case ENUMERAL_TYPE:
if (name_only)
- dump_ada_node (buffer, TYPE_NAME (node), node, spc, false, true);
+ dump_ada_node (pp, TYPE_NAME (node), node, spc, false, true);
else
- dump_ada_enum_type (buffer, node, type, spc);
+ dump_ada_enum_type (pp, node, type, spc);
break;
case REAL_TYPE:
if (is_float32 (node))
{
- pp_string (buffer, "Float");
+ pp_string (pp, "Float");
break;
}
else if (is_float64 (node))
{
- pp_string (buffer, "Long_Float");
+ pp_string (pp, "Long_Float");
break;
}
else if (is_float128 (node))
{
append_withs ("Interfaces.C.Extensions", false);
- pp_string (buffer, "Extensions.Float_128");
+ pp_string (pp, "Extensions.Float_128");
break;
}
@@ -2238,13 +2238,13 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
"__int128")))
{
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
- pp_ada_tree_identifier (buffer, TYPE_NAME (node), node,
+ pp_ada_tree_identifier (pp, TYPE_NAME (node), node,
limited_access);
else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
&& DECL_NAME (TYPE_NAME (node)))
- dump_ada_decl_name (buffer, TYPE_NAME (node), limited_access);
+ dump_ada_decl_name (pp, TYPE_NAME (node), limited_access);
else
- pp_string (buffer, "<unnamed type>");
+ pp_string (pp, "<unnamed type>");
}
else if (TREE_CODE (node) == INTEGER_TYPE)
{
@@ -2252,41 +2252,41 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
bitfield_used = true;
if (TYPE_PRECISION (node) == 1)
- pp_string (buffer, "Extensions.Unsigned_1");
+ pp_string (pp, "Extensions.Unsigned_1");
else
{
- pp_string (buffer, TYPE_UNSIGNED (node)
+ pp_string (pp, TYPE_UNSIGNED (node)
? "Extensions.Unsigned_"
: "Extensions.Signed_");
- pp_decimal_int (buffer, TYPE_PRECISION (node));
+ pp_decimal_int (pp, TYPE_PRECISION (node));
}
}
else
- pp_string (buffer, "<unnamed type>");
+ pp_string (pp, "<unnamed type>");
break;
case POINTER_TYPE:
case REFERENCE_TYPE:
if (name_only && TYPE_NAME (node))
- dump_ada_node (buffer, TYPE_NAME (node), node, spc, limited_access,
+ dump_ada_node (pp, TYPE_NAME (node), node, spc, limited_access,
true);
else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
{
if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (node))))
- pp_string (buffer, "access procedure");
+ pp_string (pp, "access procedure");
else
- pp_string (buffer, "access function");
+ pp_string (pp, "access function");
- dump_ada_function_declaration (buffer, node, false, false, false,
+ dump_ada_function_declaration (pp, node, false, false, false,
spc + INDENT_INCR);
/* If we are dumping the full type, it means we are part of a
type definition and need also a Convention C aspect. */
if (!name_only)
{
- newline_and_indent (buffer, spc);
- pp_string (buffer, "with Convention => C");
+ newline_and_indent (pp, spc);
+ pp_string (pp, "with Convention => C");
}
}
else
@@ -2298,14 +2298,14 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
if (VOID_TYPE_P (ref_type))
{
if (!name_only)
- pp_string (buffer, "new ");
+ pp_string (pp, "new ");
if (package_prefix)
{
append_withs ("System", false);
- pp_string (buffer, "System.Address");
+ pp_string (pp, "System.Address");
}
else
- pp_string (buffer, "address");
+ pp_string (pp, "address");
}
else
{
@@ -2314,15 +2314,15 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
&& id_equal (DECL_NAME (TYPE_NAME (ref_type)), "char"))
{
if (!name_only)
- pp_string (buffer, "new ");
+ pp_string (pp, "new ");
if (package_prefix)
{
- pp_string (buffer, "Interfaces.C.Strings.chars_ptr");
+ pp_string (pp, "Interfaces.C.Strings.chars_ptr");
append_withs ("Interfaces.C.Strings", false);
}
else
- pp_string (buffer, "chars_ptr");
+ pp_string (pp, "chars_ptr");
}
else
{
@@ -2336,40 +2336,40 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
{
append_withs ("System", false);
if (!name_only)
- pp_string (buffer, "new ");
- pp_string (buffer, "System.Address");
+ pp_string (pp, "new ");
+ pp_string (pp, "System.Address");
}
else
- pp_string (buffer, "address");
+ pp_string (pp, "address");
return spc;
}
if (!package_prefix)
{
is_access = false;
- pp_string (buffer, "access");
+ pp_string (pp, "access");
}
else if (AGGREGATE_TYPE_P (ref_type))
{
if (!type || TREE_CODE (type) != FUNCTION_DECL)
{
is_access = true;
- pp_string (buffer, "access ");
+ pp_string (pp, "access ");
if (quals & TYPE_QUAL_CONST)
- pp_string (buffer, "constant ");
+ pp_string (pp, "constant ");
else if (!name_only)
- pp_string (buffer, "all ");
+ pp_string (pp, "all ");
}
else if (quals & TYPE_QUAL_CONST)
{
is_access = false;
- pp_string (buffer, "in ");
+ pp_string (pp, "in ");
}
else
{
is_access = true;
- pp_string (buffer, "access ");
+ pp_string (pp, "access ");
}
}
else
@@ -2377,10 +2377,10 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
/* We want to use regular with clauses for scalar types,
as they are not involved in circular declarations. */
is_access = false;
- pp_string (buffer, "access ");
+ pp_string (pp, "access ");
if (!name_only)
- pp_string (buffer, "all ");
+ pp_string (pp, "all ");
}
/* If this is the anonymous original type of a typedef'ed
@@ -2421,7 +2421,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
break;
}
- dump_ada_node (buffer, ref_type, ref_type, spc, is_access,
+ dump_ada_node (pp, ref_type, ref_type, spc, is_access,
true);
}
}
@@ -2430,19 +2430,19 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
case ARRAY_TYPE:
if (name_only)
- dump_ada_node (buffer, TYPE_NAME (node), node, spc, limited_access,
+ dump_ada_node (pp, TYPE_NAME (node), node, spc, limited_access,
true);
else
- dump_ada_array_type (buffer, node, spc);
+ dump_ada_array_type (pp, node, spc);
break;
case RECORD_TYPE:
case UNION_TYPE:
if (name_only)
- dump_ada_node (buffer, TYPE_NAME (node), node, spc, limited_access,
+ dump_ada_node (pp, TYPE_NAME (node), node, spc, limited_access,
true);
else
- dump_ada_structure (buffer, node, type, false, spc);
+ dump_ada_structure (pp, node, type, false, spc);
break;
case INTEGER_CST:
@@ -2452,25 +2452,25 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
if (TREE_TYPE (node) == sizetype)
node = fold_convert (ssizetype, node);
if (tree_fits_shwi_p (node))
- pp_wide_integer (buffer, tree_to_shwi (node));
+ pp_wide_integer (pp, tree_to_shwi (node));
else if (tree_fits_uhwi_p (node))
- pp_unsigned_wide_integer (buffer, tree_to_uhwi (node));
+ pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
else
{
wide_int val = wi::to_wide (node);
int i;
if (wi::neg_p (val))
{
- pp_minus (buffer);
+ pp_minus (pp);
val = -val;
}
- sprintf (pp_buffer (buffer)->digit_buffer,
+ sprintf (pp_buffer (pp)->digit_buffer,
"16#%" HOST_WIDE_INT_PRINT "x",
val.elt (val.get_len () - 1));
for (i = val.get_len () - 2; i >= 0; i--)
- sprintf (pp_buffer (buffer)->digit_buffer,
+ sprintf (pp_buffer (pp)->digit_buffer,
HOST_WIDE_INT_PRINT_PADDED_HEX, val.elt (i));
- pp_string (buffer, pp_buffer (buffer)->digit_buffer);
+ pp_string (pp, pp_buffer (pp)->digit_buffer);
}
break;
@@ -2492,14 +2492,14 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
if (package_prefix)
{
append_withs ("System", false);
- pp_string (buffer, "System.Address");
+ pp_string (pp, "System.Address");
}
else
- pp_string (buffer, "address");
+ pp_string (pp, "address");
}
}
else if (name_only)
- dump_ada_decl_name (buffer, node, limited_access);
+ dump_ada_decl_name (pp, node, limited_access);
else
{
if (is_tagged_type (TREE_TYPE (node)))
@@ -2515,23 +2515,23 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
{
if (first)
{
- pp_string (buffer, "limited new ");
+ pp_string (pp, "limited new ");
first = false;
}
else
- pp_string (buffer, " and ");
+ pp_string (pp, " and ");
- dump_ada_decl_name (buffer, TYPE_NAME (TREE_TYPE (fld)),
+ dump_ada_decl_name (pp, TYPE_NAME (TREE_TYPE (fld)),
false);
}
}
- pp_string (buffer, first ? "tagged limited " : " with ");
+ pp_string (pp, first ? "tagged limited " : " with ");
}
else if (has_nontrivial_methods (TREE_TYPE (node)))
- pp_string (buffer, "limited ");
+ pp_string (pp, "limited ");
- dump_ada_node (buffer, TREE_TYPE (node), type, spc, false, false);
+ dump_ada_node (pp, TREE_TYPE (node), type, spc, false, false);
}
break;
@@ -2541,7 +2541,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
case PARM_DECL:
case FIELD_DECL:
case NAMESPACE_DECL:
- dump_ada_decl_name (buffer, node, false);
+ dump_ada_decl_name (pp, node, false);
break;
default:
@@ -2552,16 +2552,16 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
return 1;
}
-/* Dump in BUFFER NODE's methods. SPC is the indentation level. Return 1 if
+/* Dump in PP NODE's methods. SPC is the indentation level. Return 1 if
methods were printed, 0 otherwise. */
static int
-dump_ada_methods (pretty_printer *buffer, tree node, int spc)
+dump_ada_methods (pretty_printer *pp, tree node, int spc)
{
if (!has_nontrivial_methods (node))
return 0;
- pp_semicolon (buffer);
+ pp_semicolon (pp);
int res = 1;
for (tree fld = TYPE_FIELDS (node); fld; fld = DECL_CHAIN (fld))
@@ -2569,21 +2569,21 @@ dump_ada_methods (pretty_printer *buffer, tree node, int spc)
{
if (res)
{
- pp_newline (buffer);
- pp_newline (buffer);
+ pp_newline (pp);
+ pp_newline (pp);
}
- res = dump_ada_declaration (buffer, fld, node, spc);
+ res = dump_ada_declaration (pp, fld, node, spc);
}
return 1;
}
-/* Dump in BUFFER a forward declaration for TYPE present inside T.
+/* Dump in PP a forward declaration for TYPE present inside T.
SPC is the indentation level. */
static void
-dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc)
+dump_forward_type (pretty_printer *pp, tree type, tree t, int spc)
{
tree decl = get_underlying_decl (type);
@@ -2591,14 +2591,14 @@ dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc)
if (!decl)
{
if (TREE_CODE (type) == POINTER_TYPE)
- dump_forward_type (buffer, TREE_TYPE (type), t, spc);
+ dump_forward_type (pp, TREE_TYPE (type), t, spc);
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
function_args_iterator args_iter;
tree arg;
- dump_forward_type (buffer, TREE_TYPE (type), t, spc);
+ dump_forward_type (pp, TREE_TYPE (type), t, spc);
FOREACH_FUNCTION_ARGS (type, arg, args_iter)
- dump_forward_type (buffer, arg, t, spc);
+ dump_forward_type (pp, arg, t, spc);
}
return;
}
@@ -2614,10 +2614,10 @@ dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc)
return;
/* Generate an incomplete type declaration. */
- pp_string (buffer, "type ");
- dump_ada_node (buffer, decl, NULL_TREE, spc, false, true);
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "type ");
+ dump_ada_node (pp, decl, NULL_TREE, spc, false, true);
+ pp_semicolon (pp);
+ newline_and_indent (pp, spc);
/* Only one incomplete declaration is legal for a given type. */
TREE_VISITED (decl) = 1;
@@ -2630,7 +2630,7 @@ static bitmap dumped_anonymous_types;
static void dump_nested_type (pretty_printer *, tree, tree, int);
-/* Dump in BUFFER anonymous types nested inside T's definition. PARENT is the
+/* Dump in PP anonymous types nested inside T's definition. PARENT is the
parent node of T. DUMPED_TYPES is the bitmap of already dumped types. SPC
is the indentation level.
@@ -2644,7 +2644,7 @@ static void dump_nested_type (pretty_printer *, tree, tree, int);
pass on the nested TYPE_DECLs and a second pass on the unnamed types. */
static void
-dump_nested_types (pretty_printer *buffer, tree t, int spc)
+dump_nested_types (pretty_printer *pp, tree t, int spc)
{
tree type, field;
@@ -2658,18 +2658,18 @@ dump_nested_types (pretty_printer *buffer, tree t, int spc)
&& DECL_NAME (field) != DECL_NAME (t)
&& !DECL_ORIGINAL_TYPE (field)
&& TYPE_NAME (TREE_TYPE (field)) != TYPE_NAME (type))
- dump_nested_type (buffer, field, t, spc);
+ dump_nested_type (pp, field, t, spc);
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL && !TYPE_NAME (TREE_TYPE (field)))
- dump_nested_type (buffer, field, t, spc);
+ dump_nested_type (pp, field, t, spc);
}
-/* Dump in BUFFER the anonymous type of FIELD inside T. SPC is the indentation
+/* Dump in PP the anonymous type of FIELD inside T. SPC is the indentation
level. */
static void
-dump_nested_type (pretty_printer *buffer, tree field, tree t, int spc)
+dump_nested_type (pretty_printer *pp, tree field, tree t, int spc)
{
tree field_type = TREE_TYPE (field);
tree decl, tmp;
@@ -2678,7 +2678,7 @@ dump_nested_type (pretty_printer *buffer, tree field, tree t, int spc)
{
case POINTER_TYPE:
tmp = TREE_TYPE (field_type);
- dump_forward_type (buffer, tmp, t, spc);
+ dump_forward_type (pp, tmp, t, spc);
break;
case ARRAY_TYPE:
@@ -2694,59 +2694,59 @@ dump_nested_type (pretty_printer *buffer, tree field, tree t, int spc)
&& !TREE_VISITED (decl))
{
/* Generate full declaration. */
- dump_nested_type (buffer, decl, t, spc);
+ dump_nested_type (pp, decl, t, spc);
TREE_VISITED (decl) = 1;
}
else if (!decl && TREE_CODE (tmp) == POINTER_TYPE)
- dump_forward_type (buffer, TREE_TYPE (tmp), t, spc);
+ dump_forward_type (pp, TREE_TYPE (tmp), t, spc);
/* Special case char arrays. */
if (is_char_array (field_type))
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
else
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
- dump_anonymous_type_name (buffer, field_type);
- pp_string (buffer, " is ");
- dump_ada_array_type (buffer, field_type, spc);
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
+ dump_anonymous_type_name (pp, field_type);
+ pp_string (pp, " is ");
+ dump_ada_array_type (pp, field_type, spc);
+ pp_semicolon (pp);
+ newline_and_indent (pp, spc);
break;
case ENUMERAL_TYPE:
if (is_simple_enum (field_type))
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
else
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
if (TYPE_NAME (field_type))
- dump_ada_node (buffer, field_type, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, field_type, NULL_TREE, spc, false, true);
else
- dump_anonymous_type_name (buffer, field_type);
- pp_string (buffer, " is ");
- dump_ada_enum_type (buffer, field_type, NULL_TREE, spc);
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
+ dump_anonymous_type_name (pp, field_type);
+ pp_string (pp, " is ");
+ dump_ada_enum_type (pp, field_type, NULL_TREE, spc);
+ pp_semicolon (pp);
+ newline_and_indent (pp, spc);
break;
case RECORD_TYPE:
case UNION_TYPE:
- dump_nested_types (buffer, field, spc);
+ dump_nested_types (pp, field, spc);
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
if (TYPE_NAME (field_type))
- dump_ada_node (buffer, field_type, NULL_TREE, spc, false, true);
+ dump_ada_node (pp, field_type, NULL_TREE, spc, false, true);
else
- dump_anonymous_type_name (buffer, field_type);
+ dump_anonymous_type_name (pp, field_type);
if (TREE_CODE (field_type) == UNION_TYPE)
- pp_string (buffer, " (discr : unsigned := 0)");
+ pp_string (pp, " (discr : unsigned := 0)");
- pp_string (buffer, " is ");
- dump_ada_structure (buffer, field_type, t, true, spc);
- pp_semicolon (buffer);
- newline_and_indent (buffer, spc);
+ pp_string (pp, " is ");
+ dump_ada_structure (pp, field_type, t, true, spc);
+ pp_semicolon (pp);
+ newline_and_indent (pp, spc);
break;
default:
@@ -2831,39 +2831,39 @@ overloading_index (tree name)
return h ? ++h->n : 0;
}
-/* Dump in BUFFER constructor spec corresponding to T for TYPE. */
+/* Dump in PP constructor spec corresponding to T for TYPE. */
static void
-print_constructor (pretty_printer *buffer, tree t, tree type)
+print_constructor (pretty_printer *pp, tree t, tree type)
{
tree decl_name = DECL_NAME (TYPE_NAME (type));
- pp_string (buffer, "New_");
- pp_ada_tree_identifier (buffer, decl_name, t, false);
+ pp_string (pp, "New_");
+ pp_ada_tree_identifier (pp, decl_name, t, false);
}
-/* Dump in BUFFER destructor spec corresponding to T. */
+/* Dump in PP destructor spec corresponding to T. */
static void
-print_destructor (pretty_printer *buffer, tree t, tree type)
+print_destructor (pretty_printer *pp, tree t, tree type)
{
tree decl_name = DECL_NAME (TYPE_NAME (type));
- pp_string (buffer, "Delete_");
+ pp_string (pp, "Delete_");
if (startswith (IDENTIFIER_POINTER (DECL_NAME (t)), "__dt_del"))
- pp_string (buffer, "And_Free_");
- pp_ada_tree_identifier (buffer, decl_name, t, false);
+ pp_string (pp, "And_Free_");
+ pp_ada_tree_identifier (pp, decl_name, t, false);
}
-/* Dump in BUFFER assignment operator spec corresponding to T. */
+/* Dump in PP assignment operator spec corresponding to T. */
static void
-print_assignment_operator (pretty_printer *buffer, tree t, tree type)
+print_assignment_operator (pretty_printer *pp, tree t, tree type)
{
tree decl_name = DECL_NAME (TYPE_NAME (type));
- pp_string (buffer, "Assign_");
- pp_ada_tree_identifier (buffer, decl_name, t, false);
+ pp_string (pp, "Assign_");
+ pp_ada_tree_identifier (pp, decl_name, t, false);
}
/* Return the name of type T. */
@@ -2879,12 +2879,12 @@ type_name (tree t)
return IDENTIFIER_POINTER (DECL_NAME (n));
}
-/* Dump in BUFFER the declaration of object T of type TYPE in Ada syntax.
+/* Dump in PP the declaration of object T of type TYPE in Ada syntax.
SPC is the indentation level. Return 1 if a declaration was printed,
0 otherwise. */
static int
-dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
+dump_ada_declaration (pretty_printer *pp, tree t, tree type, int spc)
{
bool is_var = false;
bool need_indent = false;
@@ -2894,7 +2894,7 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
tree orig = NULL_TREE;
if (cpp_check && cpp_check (t, IS_TEMPLATE))
- return dump_ada_template (buffer, t, spc);
+ return dump_ada_template (pp, t, spc);
/* Skip enumeral values: will be handled as part of the type itself. */
if (TREE_CODE (t) == CONST_DECL && TREE_CODE (TREE_TYPE (t)) == ENUMERAL_TYPE)
@@ -2921,7 +2921,7 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
if (RECORD_OR_UNION_TYPE_P (orig) && !TREE_VISITED (stub))
{
INDENT (spc);
- dump_forward_type (buffer, orig, t, 0);
+ dump_forward_type (pp, orig, t, 0);
}
TREE_VISITED (t) = 1;
@@ -2931,14 +2931,14 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
INDENT (spc);
if (RECORD_OR_UNION_TYPE_P (orig) && !TREE_VISITED (stub))
- dump_forward_type (buffer, orig, t, spc);
+ dump_forward_type (pp, orig, t, spc);
- pp_string (buffer, "subtype ");
- dump_ada_node (buffer, t, type, spc, false, true);
- pp_string (buffer, " is ");
- dump_ada_node (buffer, orig, type, spc, false, true);
- pp_string (buffer, "; -- ");
- dump_sloc (buffer, t);
+ pp_string (pp, "subtype ");
+ dump_ada_node (pp, t, type, spc, false, true);
+ pp_string (pp, " is ");
+ dump_ada_node (pp, orig, type, spc, false, true);
+ pp_string (pp, "; -- ");
+ dump_sloc (pp, t);
TREE_VISITED (t) = 1;
return 1;
@@ -2976,9 +2976,9 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
case UNION_TYPE:
if (!COMPLETE_TYPE_P (TREE_TYPE (t)))
{
- pp_string (buffer, "type ");
- dump_ada_node (buffer, t, type, spc, false, true);
- pp_string (buffer, " is null record; -- incomplete struct");
+ pp_string (pp, "type ");
+ dump_ada_node (pp, t, type, spc, false, true);
+ pp_string (pp, " is null record; -- incomplete struct");
TREE_VISITED (t) = 1;
return 1;
}
@@ -2987,63 +2987,63 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
if (TYPE_PACKED (TREE_TYPE (t)))
{
warning_at (DECL_SOURCE_LOCATION (t), 0, "packed layout");
- pp_string (buffer, "pragma Compile_Time_Warning (True, ");
- pp_string (buffer, "\"packed layout may be incorrect\");");
- newline_and_indent (buffer, spc);
+ pp_string (pp, "pragma Compile_Time_Warning (True, ");
+ pp_string (pp, "\"packed layout may be incorrect\");");
+ newline_and_indent (pp, spc);
packed_layout = true;
}
if (orig && TYPE_NAME (orig))
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
else
{
if (separate_class_package (t))
{
is_class = true;
- pp_string (buffer, "package Class_");
- dump_ada_node (buffer, t, type, spc, false, true);
- pp_string (buffer, " is");
+ pp_string (pp, "package Class_");
+ dump_ada_node (pp, t, type, spc, false, true);
+ pp_string (pp, " is");
spc += INDENT_INCR;
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
}
- dump_nested_types (buffer, t, spc);
+ dump_nested_types (pp, t, spc);
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
}
break;
case POINTER_TYPE:
case REFERENCE_TYPE:
- dump_forward_type (buffer, TREE_TYPE (TREE_TYPE (t)), t, spc);
+ dump_forward_type (pp, TREE_TYPE (TREE_TYPE (t)), t, spc);
if (orig && TYPE_NAME (orig))
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
else
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
break;
case ARRAY_TYPE:
if ((orig && TYPE_NAME (orig)) || is_char_array (TREE_TYPE (t)))
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
else
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
break;
case FUNCTION_TYPE:
- pp_string (buffer, "-- skipped function type ");
- dump_ada_node (buffer, t, type, spc, false, true);
+ pp_string (pp, "-- skipped function type ");
+ dump_ada_node (pp, t, type, spc, false, true);
return 1;
case ENUMERAL_TYPE:
if ((orig && TYPE_NAME (orig) && orig != TREE_TYPE (t))
|| !is_simple_enum (TREE_TYPE (t)))
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
else
- pp_string (buffer, "type ");
+ pp_string (pp, "type ");
break;
default:
- pp_string (buffer, "subtype ");
+ pp_string (pp, "subtype ");
}
TREE_VISITED (t) = 1;
@@ -3065,34 +3065,34 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
INDENT (spc);
/* Print variable's name. */
- dump_ada_node (buffer, t, type, spc, false, true);
+ dump_ada_node (pp, t, type, spc, false, true);
if (TREE_CODE (t) == TYPE_DECL)
{
- pp_string (buffer, " is ");
+ pp_string (pp, " is ");
if (orig && TYPE_NAME (orig))
- dump_ada_node (buffer, TYPE_NAME (orig), type, spc, false, true);
+ dump_ada_node (pp, TYPE_NAME (orig), type, spc, false, true);
else
- dump_ada_array_type (buffer, TREE_TYPE (t), spc);
+ dump_ada_array_type (pp, TREE_TYPE (t), spc);
}
else
{
if (spc == INDENT_INCR || TREE_STATIC (t))
is_var = true;
- pp_string (buffer, " : ");
+ pp_string (pp, " : ");
if (TREE_CODE (TREE_TYPE (TREE_TYPE (t))) != POINTER_TYPE
&& !packed_layout)
- pp_string (buffer, "aliased ");
+ pp_string (pp, "aliased ");
if (TYPE_NAME (TREE_TYPE (t)))
- dump_ada_node (buffer, TREE_TYPE (t), type, spc, false, true);
+ dump_ada_node (pp, TREE_TYPE (t), type, spc, false, true);
else if (type)
- dump_anonymous_type_name (buffer, TREE_TYPE (t));
+ dump_anonymous_type_name (pp, TREE_TYPE (t));
else
- dump_ada_array_type (buffer, TREE_TYPE (t), spc);
+ dump_ada_array_type (pp, TREE_TYPE (t), spc);
}
}
else if (TREE_CODE (t) == FUNCTION_DECL)
@@ -3149,36 +3149,36 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
else if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_')
{
INDENT (spc);
- pp_string (buffer, "-- skipped func ");
- pp_string (buffer, IDENTIFIER_POINTER (decl_name));
+ pp_string (pp, "-- skipped func ");
+ pp_string (pp, IDENTIFIER_POINTER (decl_name));
return 1;
}
INDENT (spc);
- dump_forward_type (buffer, TREE_TYPE (t), t, spc);
+ dump_forward_type (pp, TREE_TYPE (t), t, spc);
if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (t))) && !is_constructor)
- pp_string (buffer, "procedure ");
+ pp_string (pp, "procedure ");
else
- pp_string (buffer, "function ");
+ pp_string (pp, "function ");
if (is_constructor)
- print_constructor (buffer, t, type);
+ print_constructor (pp, t, type);
else if (is_destructor)
- print_destructor (buffer, t, type);
+ print_destructor (pp, t, type);
else if (is_assignment_operator)
- print_assignment_operator (buffer, t, type);
+ print_assignment_operator (pp, t, type);
else
{
const unsigned int suffix = overloading_index (decl_name);
- pp_ada_tree_identifier (buffer, decl_name, t, false);
+ pp_ada_tree_identifier (pp, decl_name, t, false);
if (suffix > 1)
- pp_decimal_int (buffer, suffix);
+ pp_decimal_int (pp, suffix);
}
dump_ada_function_declaration
- (buffer, t, is_method, is_constructor, is_destructor, spc);
+ (pp, t, is_method, is_constructor, is_destructor, spc);
if (is_constructor && RECORD_OR_UNION_TYPE_P (type))
for (tree fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
@@ -3189,34 +3189,34 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
}
if (is_abstract || is_abstract_class)
- pp_string (buffer, " is abstract");
+ pp_string (pp, " is abstract");
if (is_abstract || !DECL_ASSEMBLER_NAME (t))
{
- pp_semicolon (buffer);
- pp_string (buffer, " -- ");
- dump_sloc (buffer, t);
+ pp_semicolon (pp);
+ pp_string (pp, " -- ");
+ dump_sloc (pp, t);
}
else if (is_constructor)
{
- pp_semicolon (buffer);
- pp_string (buffer, " -- ");
- dump_sloc (buffer, t);
-
- newline_and_indent (buffer, spc);
- pp_string (buffer, "pragma CPP_Constructor (");
- print_constructor (buffer, t, type);
- pp_string (buffer, ", \"");
- pp_asm_name (buffer, t);
- pp_string (buffer, "\");");
+ pp_semicolon (pp);
+ pp_string (pp, " -- ");
+ dump_sloc (pp, t);
+
+ newline_and_indent (pp, spc);
+ pp_string (pp, "pragma CPP_Constructor (");
+ print_constructor (pp, t, type);
+ pp_string (pp, ", \"");
+ pp_asm_name (pp, t);
+ pp_string (pp, "\");");
}
else
{
- pp_string (buffer, " -- ");
- dump_sloc (buffer, t);
+ pp_string (pp, " -- ");
+ dump_sloc (pp, t);
- newline_and_indent (buffer, spc);
- dump_ada_import (buffer, t, spc);
+ newline_and_indent (pp, spc);
+ dump_ada_import (pp, t, spc);
}
return 1;
@@ -3227,12 +3227,12 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
bool is_abstract_record = false;
/* Anonymous structs/unions. */
- dump_ada_node (buffer, TREE_TYPE (t), t, spc, false, true);
+ dump_ada_node (pp, TREE_TYPE (t), t, spc, false, true);
if (TREE_CODE (TREE_TYPE (t)) == UNION_TYPE)
- pp_string (buffer, " (discr : unsigned := 0)");
+ pp_string (pp, " (discr : unsigned := 0)");
- pp_string (buffer, " is ");
+ pp_string (pp, " is ");
/* Check whether we have an Ada interface compatible class.
That is only have a vtable non-static data member and no
@@ -3269,20 +3269,20 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
TREE_VISITED (t) = 1;
if (is_interface)
{
- pp_string (buffer, "limited interface -- ");
- dump_sloc (buffer, t);
- newline_and_indent (buffer, spc);
- pp_string (buffer, "with Import => True,");
- newline_and_indent (buffer, spc + 5);
- pp_string (buffer, "Convention => CPP");
-
- dump_ada_methods (buffer, TREE_TYPE (t), spc);
+ pp_string (pp, "limited interface -- ");
+ dump_sloc (pp, t);
+ newline_and_indent (pp, spc);
+ pp_string (pp, "with Import => True,");
+ newline_and_indent (pp, spc + 5);
+ pp_string (pp, "Convention => CPP");
+
+ dump_ada_methods (pp, TREE_TYPE (t), spc);
}
else
{
if (is_abstract_record)
- pp_string (buffer, "abstract ");
- dump_ada_node (buffer, t, t, spc, false, false);
+ pp_string (pp, "abstract ");
+ dump_ada_node (pp, t, t, spc, false, false);
}
}
else
@@ -3292,84 +3292,84 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
if ((TREE_CODE (t) == FIELD_DECL || VAR_P (t))
&& DECL_NAME (t))
- check_type_name_conflict (buffer, t);
+ check_type_name_conflict (pp, t);
/* Print variable/type's name. */
- dump_ada_node (buffer, t, t, spc, false, true);
+ dump_ada_node (pp, t, t, spc, false, true);
if (TREE_CODE (t) == TYPE_DECL)
{
const bool is_subtype = TYPE_NAME (orig);
if (!is_subtype && TREE_CODE (TREE_TYPE (t)) == UNION_TYPE)
- pp_string (buffer, " (discr : unsigned := 0)");
+ pp_string (pp, " (discr : unsigned := 0)");
- pp_string (buffer, " is ");
+ pp_string (pp, " is ");
- dump_ada_node (buffer, orig, t, spc, false, is_subtype);
+ dump_ada_node (pp, orig, t, spc, false, is_subtype);
}
else
{
if (spc == INDENT_INCR || TREE_STATIC (t))
is_var = true;
- pp_string (buffer, " : ");
+ pp_string (pp, " : ");
if (TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE
&& (TYPE_NAME (TREE_TYPE (t))
|| (TREE_CODE (TREE_TYPE (t)) != INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (t)) != ENUMERAL_TYPE))
&& !packed_layout)
- pp_string (buffer, "aliased ");
+ pp_string (pp, "aliased ");
if (TREE_READONLY (t) && TREE_CODE (t) != FIELD_DECL)
- pp_string (buffer, "constant ");
+ pp_string (pp, "constant ");
if (TYPE_NAME (TREE_TYPE (t))
|| (!RECORD_OR_UNION_TYPE_P (TREE_TYPE (t))
&& TREE_CODE (TREE_TYPE (t)) != ENUMERAL_TYPE))
- dump_ada_node (buffer, TREE_TYPE (t), t, spc, false, true);
+ dump_ada_node (pp, TREE_TYPE (t), t, spc, false, true);
else if (type)
- dump_anonymous_type_name (buffer, TREE_TYPE (t));
+ dump_anonymous_type_name (pp, TREE_TYPE (t));
}
}
if (is_class)
{
spc -= INDENT_INCR;
- newline_and_indent (buffer, spc);
- pp_string (buffer, "end;");
- newline_and_indent (buffer, spc);
- pp_string (buffer, "use Class_");
- dump_ada_node (buffer, t, type, spc, false, true);
- pp_semicolon (buffer);
- pp_newline (buffer);
+ newline_and_indent (pp, spc);
+ pp_string (pp, "end;");
+ newline_and_indent (pp, spc);
+ pp_string (pp, "use Class_");
+ dump_ada_node (pp, t, type, spc, false, true);
+ pp_semicolon (pp);
+ pp_newline (pp);
/* All needed indentation/newline performed already, so return 0. */
return 0;
}
else if (is_var)
{
- pp_string (buffer, " -- ");
- dump_sloc (buffer, t);
- newline_and_indent (buffer, spc);
- dump_ada_import (buffer, t, spc);
+ pp_string (pp, " -- ");
+ dump_sloc (pp, t);
+ newline_and_indent (pp, spc);
+ dump_ada_import (pp, t, spc);
}
else
{
- pp_string (buffer, "; -- ");
- dump_sloc (buffer, t);
+ pp_string (pp, "; -- ");
+ dump_sloc (pp, t);
}
return 1;
}
-/* Dump in BUFFER a structure NODE of type TYPE in Ada syntax. If NESTED is
+/* Dump in PP a structure NODE of type TYPE in Ada syntax. If NESTED is
true, it's an anonymous nested type. SPC is the indentation level. */
static void
-dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
+dump_ada_structure (pretty_printer *pp, tree node, tree type, bool nested,
int spc)
{
const bool is_union = (TREE_CODE (node) == UNION_TYPE);
@@ -3381,16 +3381,16 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
bitfield_used = false;
/* Print the contents of the structure. */
- pp_string (buffer, "record");
+ pp_string (pp, "record");
if (is_union)
{
- newline_and_indent (buffer, spc + INDENT_INCR);
- pp_string (buffer, "case discr is");
+ newline_and_indent (pp, spc + INDENT_INCR);
+ pp_string (pp, "case discr is");
field_spc = spc + INDENT_INCR * 3;
}
- pp_newline (buffer);
+ pp_newline (pp);
/* Print the non-static fields of the structure. */
for (tree tmp = TYPE_FIELDS (node); tmp; tmp = TREE_CHAIN (tmp))
@@ -3401,24 +3401,24 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
if (!is_tagged_type (TREE_TYPE (tmp)))
{
if (!TYPE_NAME (TREE_TYPE (tmp)))
- dump_ada_declaration (buffer, tmp, type, field_spc);
+ dump_ada_declaration (pp, tmp, type, field_spc);
else
{
INDENT (field_spc);
if (field_num == 0)
- pp_string (buffer, "parent : aliased ");
+ pp_string (pp, "parent : aliased ");
else
{
sprintf (buf, "field_%d : aliased ", field_num + 1);
- pp_string (buffer, buf);
+ pp_string (pp, buf);
}
- dump_ada_decl_name (buffer, TYPE_NAME (TREE_TYPE (tmp)),
+ dump_ada_decl_name (pp, TYPE_NAME (TREE_TYPE (tmp)),
false);
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
- pp_newline (buffer);
+ pp_newline (pp);
field_num++;
}
}
@@ -3437,13 +3437,13 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
sprintf (buf, "when others =>");
INDENT (spc + INDENT_INCR * 2);
- pp_string (buffer, buf);
- pp_newline (buffer);
+ pp_string (pp, buf);
+ pp_newline (pp);
}
- if (dump_ada_declaration (buffer, tmp, type, field_spc))
+ if (dump_ada_declaration (pp, tmp, type, field_spc))
{
- pp_newline (buffer);
+ pp_newline (pp);
field_num++;
}
}
@@ -3453,49 +3453,49 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
if (is_union)
{
INDENT (spc + INDENT_INCR);
- pp_string (buffer, "end case;");
- pp_newline (buffer);
+ pp_string (pp, "end case;");
+ pp_newline (pp);
}
if (field_num == 0)
{
INDENT (spc + INDENT_INCR);
- pp_string (buffer, "null;");
- pp_newline (buffer);
+ pp_string (pp, "null;");
+ pp_newline (pp);
}
INDENT (spc);
- pp_string (buffer, "end record");
+ pp_string (pp, "end record");
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
/* We disregard the methods for anonymous nested types. */
if (has_nontrivial_methods (node) && !nested)
{
- pp_string (buffer, "with Import => True,");
- newline_and_indent (buffer, spc + 5);
- pp_string (buffer, "Convention => CPP");
+ pp_string (pp, "with Import => True,");
+ newline_and_indent (pp, spc + 5);
+ pp_string (pp, "Convention => CPP");
}
else
- pp_string (buffer, "with Convention => C_Pass_By_Copy");
+ pp_string (pp, "with Convention => C_Pass_By_Copy");
if (is_union)
{
- pp_comma (buffer);
- newline_and_indent (buffer, spc + 5);
- pp_string (buffer, "Unchecked_Union => True");
+ pp_comma (pp);
+ newline_and_indent (pp, spc + 5);
+ pp_string (pp, "Unchecked_Union => True");
}
if (bitfield_used || packed_layout)
{
char buf[32];
- pp_comma (buffer);
- newline_and_indent (buffer, spc + 5);
- pp_string (buffer, "Pack => True");
- pp_comma (buffer);
- newline_and_indent (buffer, spc + 5);
+ pp_comma (pp);
+ newline_and_indent (pp, spc + 5);
+ pp_string (pp, "Pack => True");
+ pp_comma (pp);
+ newline_and_indent (pp, spc + 5);
sprintf (buf, "Alignment => %d", TYPE_ALIGN (node) / BITS_PER_UNIT);
- pp_string (buffer, buf);
+ pp_string (pp, buf);
bitfield_used = false;
packed_layout = false;
}
@@ -3503,7 +3503,7 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
if (nested)
return;
- need_semicolon = !dump_ada_methods (buffer, node, spc);
+ need_semicolon = !dump_ada_methods (pp, node, spc);
/* Print the static fields of the structure, if any. */
for (tree tmp = TYPE_FIELDS (node); tmp; tmp = TREE_CHAIN (tmp))
@@ -3513,11 +3513,11 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested,
if (need_semicolon)
{
need_semicolon = false;
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
- pp_newline (buffer);
- pp_newline (buffer);
- dump_ada_declaration (buffer, tmp, type, spc);
+ pp_newline (pp);
+ pp_newline (pp);
+ dump_ada_declaration (pp, tmp, type, spc);
}
}
}
diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc
index a71e1e0efc77..285d76b35406 100644
--- a/gcc/gimple-pretty-print.cc
+++ b/gcc/gimple-pretty-print.cc
@@ -53,27 +53,27 @@ along with GCC; see the file COPYING3. If not see
#endif
#define INDENT(SPACE) \
- do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
+ do { int i; for (i = 0; i < SPACE; i++) pp_space (pp); } while (0)
-#define GIMPLE_NIY do_niy (buffer,gs)
+#define GIMPLE_NIY do_niy (pp,gs)
-/* Try to print on BUFFER a default message for the unrecognized
+/* Try to print on PP a default message for the unrecognized
gimple statement GS. */
static void
-do_niy (pretty_printer *buffer, const gimple *gs)
+do_niy (pretty_printer *pp, const gimple *gs)
{
- pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
+ pp_printf (pp, "<<< Unknown GIMPLE statement: %s >>>\n",
gimple_code_name[(int) gimple_code (gs)]);
}
-/* Emit a newline and SPC indentation spaces to BUFFER. */
+/* Emit a newline and SPC indentation spaces to PP. */
static void
-newline_and_indent (pretty_printer *buffer, int spc)
+newline_and_indent (pretty_printer *pp, int spc)
{
- pp_newline (buffer);
+ pp_newline (pp);
INDENT (spc);
}
@@ -139,12 +139,12 @@ dump_probability (profile_probability probability)
return ret;
}
-/* Dump E probability to BUFFER. */
+/* Dump E probability to PP. */
static void
-dump_edge_probability (pretty_printer *buffer, edge e)
+dump_edge_probability (pretty_printer *pp, edge e)
{
- pp_scalar (buffer, " %s", dump_probability (e->probability));
+ pp_scalar (pp, " %s", dump_probability (e->probability));
}
/* Print GIMPLE statement G to FILE using SPC indentation spaces and
@@ -153,11 +153,11 @@ dump_edge_probability (pretty_printer *buffer, edge e)
void
print_gimple_stmt (FILE *file, gimple *g, int spc, dump_flags_t flags)
{
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- pp_gimple_stmt_1 (&buffer, g, spc, flags);
- pp_newline_and_flush (&buffer);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ pp_gimple_stmt_1 (&pp, g, spc, flags);
+ pp_newline_and_flush (&pp);
}
DEBUG_FUNCTION void
@@ -184,21 +184,21 @@ void
print_gimple_expr (FILE *file, gimple *g, int spc, dump_flags_t flags)
{
flags |= TDF_RHS_ONLY;
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- pp_gimple_stmt_1 (&buffer, g, spc, flags);
- pp_flush (&buffer);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ pp_gimple_stmt_1 (&pp, g, spc, flags);
+ pp_flush (&pp);
}
-/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
+/* Print the GIMPLE sequence SEQ on PP using SPC indentation
spaces and FLAGS as in pp_gimple_stmt_1.
- The caller is responsible for calling pp_flush on BUFFER to finalize
+ The caller is responsible for calling pp_flush on PP to finalize
the pretty printer. */
static void
-dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc,
+dump_gimple_seq (pretty_printer *pp, gimple_seq seq, int spc,
dump_flags_t flags)
{
gimple_stmt_iterator i;
@@ -207,9 +207,9 @@ dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc,
{
gimple *gs = gsi_stmt (i);
INDENT (spc);
- pp_gimple_stmt_1 (buffer, gs, spc, flags);
+ pp_gimple_stmt_1 (pp, gs, spc, flags);
if (!gsi_one_before_end_p (i))
- pp_newline (buffer);
+ pp_newline (pp);
}
}
@@ -220,11 +220,11 @@ dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc,
void
print_gimple_seq (FILE *file, gimple_seq seq, int spc, dump_flags_t flags)
{
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- dump_gimple_seq (&buffer, seq, spc, flags);
- pp_newline_and_flush (&buffer);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ dump_gimple_seq (&pp, seq, spc, flags);
+ pp_newline_and_flush (&pp);
}
@@ -250,7 +250,7 @@ debug_gimple_seq (gimple_seq seq)
'-' - decreases indent by 2 then outputs a newline. */
static void
-dump_gimple_fmt (pretty_printer *buffer, int spc, dump_flags_t flags,
+dump_gimple_fmt (pretty_printer *pp, int spc, dump_flags_t flags,
const char *fmt, ...)
{
va_list args;
@@ -270,48 +270,48 @@ dump_gimple_fmt (pretty_printer *buffer, int spc, dump_flags_t flags,
case 'G':
g = va_arg (args, gimple *);
tmp = gimple_code_name[gimple_code (g)];
- pp_string (buffer, tmp);
+ pp_string (pp, tmp);
break;
case 'S':
seq = va_arg (args, gimple_seq);
- pp_newline (buffer);
- dump_gimple_seq (buffer, seq, spc + 2, flags);
- newline_and_indent (buffer, spc);
+ pp_newline (pp);
+ dump_gimple_seq (pp, seq, spc + 2, flags);
+ newline_and_indent (pp, spc);
break;
case 'T':
t = va_arg (args, tree);
if (t == NULL_TREE)
- pp_string (buffer, "NULL");
+ pp_string (pp, "NULL");
else
- dump_generic_node (buffer, t, spc, flags, false);
+ dump_generic_node (pp, t, spc, flags, false);
break;
case 'd':
- pp_decimal_int (buffer, va_arg (args, int));
+ pp_decimal_int (pp, va_arg (args, int));
break;
case 's':
- pp_string (buffer, va_arg (args, char *));
+ pp_string (pp, va_arg (args, char *));
break;
case 'n':
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
break;
case 'x':
- pp_scalar (buffer, "%x", va_arg (args, int));
+ pp_scalar (pp, "%x", va_arg (args, int));
break;
case '+':
spc += 2;
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
break;
case '-':
spc -= 2;
- newline_and_indent (buffer, spc);
+ newline_and_indent (pp, spc);
break;
default:
@@ -319,17 +319,17 @@ dump_gimple_fmt (pretty_printer *buffer, int spc, dump_flags_t flags,
}
}
else
- pp_character (buffer, *c);
+ pp_character (pp, *c);
}
va_end (args);
}
/* Helper for dump_gimple_assign. Print the unary RHS of the
- assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
+ assignment GS. PP, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
+dump_unary_rhs (pretty_printer *pp, const gassign *gs, int spc,
dump_flags_t flags)
{
enum tree_code rhs_code = gimple_assign_rhs_code (gs);
@@ -339,7 +339,7 @@ dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
switch (rhs_code)
{
case VIEW_CONVERT_EXPR:
- dump_generic_node (buffer, rhs, spc, flags, false);
+ dump_generic_node (pp, rhs, spc, flags, false);
break;
case FIXED_CONVERT_EXPR:
@@ -347,39 +347,39 @@ dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
case FIX_TRUNC_EXPR:
case FLOAT_EXPR:
CASE_CONVERT:
- pp_left_paren (buffer);
- dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false);
- pp_string (buffer, ") ");
+ pp_left_paren (pp);
+ dump_generic_node (pp, TREE_TYPE (lhs), spc, flags, false);
+ pp_string (pp, ") ");
if (op_prio (rhs) < op_code_prio (rhs_code))
{
- pp_left_paren (buffer);
- dump_generic_node (buffer, rhs, spc, flags, false);
- pp_right_paren (buffer);
+ pp_left_paren (pp);
+ dump_generic_node (pp, rhs, spc, flags, false);
+ pp_right_paren (pp);
}
else
- dump_generic_node (buffer, rhs, spc, flags, false);
+ dump_generic_node (pp, rhs, spc, flags, false);
break;
case PAREN_EXPR:
- pp_string (buffer, "((");
- dump_generic_node (buffer, rhs, spc, flags, false);
- pp_string (buffer, "))");
+ pp_string (pp, "((");
+ dump_generic_node (pp, rhs, spc, flags, false);
+ pp_string (pp, "))");
break;
case ABS_EXPR:
case ABSU_EXPR:
if (flags & TDF_GIMPLE)
{
- pp_string (buffer,
+ pp_string (pp,
rhs_code == ABS_EXPR ? "__ABS " : "__ABSU ");
- dump_generic_node (buffer, rhs, spc, flags, false);
+ dump_generic_node (pp, rhs, spc, flags, false);
}
else
{
- pp_string (buffer,
+ pp_string (pp,
rhs_code == ABS_EXPR ? "ABS_EXPR <" : "ABSU_EXPR <");
- dump_generic_node (buffer, rhs, spc, flags, false);
- pp_greater (buffer);
+ dump_generic_node (pp, rhs, spc, flags, false);
+ pp_greater (pp);
}
break;
@@ -391,40 +391,40 @@ dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
|| rhs_code == ADDR_EXPR
|| rhs_code == CONSTRUCTOR)
{
- dump_generic_node (buffer, rhs, spc, flags, false);
+ dump_generic_node (pp, rhs, spc, flags, false);
break;
}
else if (rhs_code == BIT_NOT_EXPR)
- pp_complement (buffer);
+ pp_complement (pp);
else if (rhs_code == TRUTH_NOT_EXPR)
- pp_exclamation (buffer);
+ pp_exclamation (pp);
else if (rhs_code == NEGATE_EXPR)
- pp_minus (buffer);
+ pp_minus (pp);
else
{
- pp_left_bracket (buffer);
- pp_string (buffer, get_tree_code_name (rhs_code));
- pp_string (buffer, "] ");
+ pp_left_bracket (pp);
+ pp_string (pp, get_tree_code_name (rhs_code));
+ pp_string (pp, "] ");
}
if (op_prio (rhs) < op_code_prio (rhs_code))
{
- pp_left_paren (buffer);
- dump_generic_node (buffer, rhs, spc, flags, false);
- pp_right_paren (buffer);
+ pp_left_paren (pp);
+ dump_generic_node (pp, rhs, spc, flags, false);
+ pp_right_paren (pp);
}
else
- dump_generic_node (buffer, rhs, spc, flags, false);
+ dump_generic_node (pp, rhs, spc, flags, false);
break;
}
}
/* Helper for dump_gimple_assign. Print the binary RHS of the
- assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
+ assignment GS. PP, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_binary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
+dump_binary_rhs (pretty_printer *pp, const gassign *gs, int spc,
dump_flags_t flags)
{
const char *p;
@@ -435,13 +435,13 @@ dump_binary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
case MAX_EXPR:
if (flags & TDF_GIMPLE)
{
- pp_string (buffer, code == MIN_EXPR ? "__MIN (" : "__MAX (");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
+ pp_string (pp, code == MIN_EXPR ? "__MIN (" : "__MAX (");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags,
false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags,
false);
- pp_string (buffer, ")");
+ pp_string (pp, ")");
break;
}
else
@@ -461,44 +461,44 @@ dump_binary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
case VEC_WIDEN_LSHIFT_LO_EXPR:
case VEC_SERIES_EXPR:
for (p = get_tree_code_name (code); *p; p++)
- pp_character (buffer, TOUPPER (*p));
- pp_string (buffer, " <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_character (pp, TOUPPER (*p));
+ pp_string (pp, " <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_greater (pp);
break;
default:
if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code))
{
- pp_left_paren (buffer);
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
+ pp_left_paren (pp);
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags,
false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
else
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_space (buffer);
- pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs), flags));
- pp_space (buffer);
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_space (pp);
+ pp_string (pp, op_symbol_code (gimple_assign_rhs_code (gs), flags));
+ pp_space (pp);
if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code))
{
- pp_left_paren (buffer);
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
+ pp_left_paren (pp);
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags,
false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
else
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
}
}
/* Helper for dump_gimple_assign. Print the ternary RHS of the
- assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
+ assignment GS. PP, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_ternary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
+dump_ternary_rhs (pretty_printer *pp, const gassign *gs, int spc,
dump_flags_t flags)
{
const char *p;
@@ -508,113 +508,113 @@ dump_ternary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
case WIDEN_MULT_PLUS_EXPR:
case WIDEN_MULT_MINUS_EXPR:
for (p = get_tree_code_name (code); *p; p++)
- pp_character (buffer, TOUPPER (*p));
- pp_string (buffer, " <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_character (pp, TOUPPER (*p));
+ pp_string (pp, " <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_greater (pp);
break;
case DOT_PROD_EXPR:
- pp_string (buffer, "DOT_PROD_EXPR <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_string (pp, "DOT_PROD_EXPR <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_greater (pp);
break;
case SAD_EXPR:
- pp_string (buffer, "SAD_EXPR <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_string (pp, "SAD_EXPR <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_greater (pp);
break;
case VEC_PERM_EXPR:
if (flags & TDF_GIMPLE)
- pp_string (buffer, "__VEC_PERM (");
+ pp_string (pp, "__VEC_PERM (");
else
- pp_string (buffer, "VEC_PERM_EXPR <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_string (pp, "VEC_PERM_EXPR <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
if (flags & TDF_GIMPLE)
- pp_right_paren (buffer);
+ pp_right_paren (pp);
else
- pp_greater (buffer);
+ pp_greater (pp);
break;
case REALIGN_LOAD_EXPR:
- pp_string (buffer, "REALIGN_LOAD <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_string (pp, "REALIGN_LOAD <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_greater (pp);
break;
case COND_EXPR:
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, " ? ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, " : ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, " ? ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, " : ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
break;
case VEC_COND_EXPR:
- pp_string (buffer, "VEC_COND_EXPR <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ pp_string (pp, "VEC_COND_EXPR <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_greater (pp);
break;
case BIT_INSERT_EXPR:
if (flags & TDF_GIMPLE)
{
- pp_string (buffer, "__BIT_INSERT (");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc,
+ pp_string (pp, "__BIT_INSERT (");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs), spc,
flags | TDF_SLIM, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc,
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs), spc,
flags | TDF_SLIM, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc,
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs), spc,
flags | TDF_SLIM, false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
else
{
- pp_string (buffer, "BIT_INSERT_EXPR <");
- dump_generic_node (buffer, gimple_assign_rhs1 (gs),
+ pp_string (pp, "BIT_INSERT_EXPR <");
+ dump_generic_node (pp, gimple_assign_rhs1 (gs),
spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs2 (gs),
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs2 (gs),
spc, flags, false);
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_assign_rhs3 (gs),
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_assign_rhs3 (gs),
spc, flags, false);
if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs))))
{
- pp_string (buffer, " (");
- pp_decimal_int (buffer, TYPE_PRECISION
+ pp_string (pp, " (");
+ pp_decimal_int (pp, TYPE_PRECISION
(TREE_TYPE (gimple_assign_rhs2 (gs))));
- pp_string (buffer, " bits)");
+ pp_string (pp, " bits)");
}
- pp_greater (buffer);
+ pp_greater (pp);
}
break;
@@ -624,11 +624,11 @@ dump_ternary_rhs (pretty_printer *buffer, const gassign *gs, int spc,
}
-/* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
+/* Dump the gimple assignment GS. PP, SPC and FLAGS are as in
pp_gimple_stmt_1. */
static void
-dump_gimple_assign (pretty_printer *buffer, const gassign *gs, int spc,
+dump_gimple_assign (pretty_printer *pp, const gassign *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
@@ -651,7 +651,7 @@ dump_gimple_assign (pretty_printer *buffer, const gassign *gs, int spc,
gcc_unreachable ();
}
- dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
get_tree_code_name (gimple_assign_rhs_code (gs)),
gimple_assign_lhs (gs), arg1, arg2, arg3);
}
@@ -659,70 +659,70 @@ dump_gimple_assign (pretty_printer *buffer, const gassign *gs, int spc,
{
if (!(flags & TDF_RHS_ONLY))
{
- dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
- pp_space (buffer);
- pp_equal (buffer);
+ dump_generic_node (pp, gimple_assign_lhs (gs), spc, flags, false);
+ pp_space (pp);
+ pp_equal (pp);
if (gimple_assign_nontemporal_move_p (gs))
- pp_string (buffer, "{nt}");
+ pp_string (pp, "{nt}");
if (gimple_has_volatile_ops (gs))
- pp_string (buffer, "{v}");
+ pp_string (pp, "{v}");
- pp_space (buffer);
+ pp_space (pp);
}
if (gimple_num_ops (gs) == 2)
- dump_unary_rhs (buffer, gs, spc,
+ dump_unary_rhs (pp, gs, spc,
((flags & TDF_GIMPLE)
&& gimple_assign_rhs_class (gs) != GIMPLE_SINGLE_RHS)
? (flags | TDF_GIMPLE_VAL) : flags);
else if (gimple_num_ops (gs) == 3)
- dump_binary_rhs (buffer, gs, spc,
+ dump_binary_rhs (pp, gs, spc,
(flags & TDF_GIMPLE)
? (flags | TDF_GIMPLE_VAL) : flags);
else if (gimple_num_ops (gs) == 4)
- dump_ternary_rhs (buffer, gs, spc,
+ dump_ternary_rhs (pp, gs, spc,
(flags & TDF_GIMPLE)
? (flags | TDF_GIMPLE_VAL) : flags);
else
gcc_unreachable ();
if (!(flags & TDF_RHS_ONLY))
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
}
-/* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
+/* Dump the return statement GS. PP, SPC and FLAGS are as in
pp_gimple_stmt_1. */
static void
-dump_gimple_return (pretty_printer *buffer, const greturn *gs, int spc,
+dump_gimple_return (pretty_printer *pp, const greturn *gs, int spc,
dump_flags_t flags)
{
tree t;
t = gimple_return_retval (gs);
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, t);
+ dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, t);
else
{
- pp_string (buffer, "return");
+ pp_string (pp, "return");
if (t)
{
- pp_space (buffer);
- dump_generic_node (buffer, t, spc, flags, false);
+ pp_space (pp);
+ dump_generic_node (pp, t, spc, flags, false);
}
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
}
-/* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
+/* Dump the call arguments for a gimple call. PP, FLAGS are as in
dump_gimple_call. */
static void
-dump_gimple_call_args (pretty_printer *buffer, const gcall *gs,
+dump_gimple_call_args (pretty_printer *pp, const gcall *gs,
dump_flags_t flags)
{
size_t i = 0;
@@ -783,7 +783,7 @@ dump_gimple_call_args (pretty_printer *buffer, const gcall *gs,
&& (v = tree_to_shwi (arg0)) >= 0 && v < limit)
{
i++;
- pp_string (buffer, enums[v]);
+ pp_string (pp, enums[v]);
}
}
}
@@ -791,52 +791,52 @@ dump_gimple_call_args (pretty_printer *buffer, const gcall *gs,
for (; i < gimple_call_num_args (gs); i++)
{
if (i)
- pp_string (buffer, ", ");
- dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
+ pp_string (pp, ", ");
+ dump_generic_node (pp, gimple_call_arg (gs, i), 0, flags, false);
}
if (gimple_call_va_arg_pack_p (gs))
{
if (i)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
- pp_string (buffer, "__builtin_va_arg_pack ()");
+ pp_string (pp, "__builtin_va_arg_pack ()");
}
}
-/* Dump the points-to solution *PT to BUFFER. */
+/* Dump the points-to solution *PT to PP. */
static void
-pp_points_to_solution (pretty_printer *buffer, const pt_solution *pt)
+pp_points_to_solution (pretty_printer *pp, const pt_solution *pt)
{
if (pt->anything)
{
- pp_string (buffer, "anything ");
+ pp_string (pp, "anything ");
return;
}
if (pt->nonlocal)
- pp_string (buffer, "nonlocal ");
+ pp_string (pp, "nonlocal ");
if (pt->escaped)
- pp_string (buffer, "escaped ");
+ pp_string (pp, "escaped ");
if (pt->ipa_escaped)
- pp_string (buffer, "unit-escaped ");
+ pp_string (pp, "unit-escaped ");
if (pt->null)
- pp_string (buffer, "null ");
+ pp_string (pp, "null ");
if (pt->const_pool)
- pp_string (buffer, "const-pool ");
+ pp_string (pp, "const-pool ");
if (pt->vars
&& !bitmap_empty_p (pt->vars))
{
bitmap_iterator bi;
unsigned i;
- pp_string (buffer, "{ ");
+ pp_string (pp, "{ ");
EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
{
- pp_string (buffer, "D.");
- pp_decimal_int (buffer, i);
- pp_space (buffer);
+ pp_string (pp, "D.");
+ pp_decimal_int (pp, i);
+ pp_space (pp);
}
- pp_right_brace (buffer);
+ pp_right_brace (pp);
if (pt->vars_contains_nonlocal
|| pt->vars_contains_escaped
|| pt->vars_contains_escaped_heap
@@ -844,46 +844,46 @@ pp_points_to_solution (pretty_printer *buffer, const pt_solution *pt)
|| pt->vars_contains_interposable)
{
const char *comma = "";
- pp_string (buffer, " (");
+ pp_string (pp, " (");
if (pt->vars_contains_nonlocal)
{
- pp_string (buffer, "nonlocal");
+ pp_string (pp, "nonlocal");
comma = ", ";
}
if (pt->vars_contains_escaped)
{
- pp_string (buffer, comma);
- pp_string (buffer, "escaped");
+ pp_string (pp, comma);
+ pp_string (pp, "escaped");
comma = ", ";
}
if (pt->vars_contains_escaped_heap)
{
- pp_string (buffer, comma);
- pp_string (buffer, "escaped heap");
+ pp_string (pp, comma);
+ pp_string (pp, "escaped heap");
comma = ", ";
}
if (pt->vars_contains_restrict)
{
- pp_string (buffer, comma);
- pp_string (buffer, "restrict");
+ pp_string (pp, comma);
+ pp_string (pp, "restrict");
comma = ", ";
}
if (pt->vars_contains_interposable)
{
- pp_string (buffer, comma);
- pp_string (buffer, "interposable");
+ pp_string (pp, comma);
+ pp_string (pp, "interposable");
}
- pp_string (buffer, ")");
+ pp_string (pp, ")");
}
}
}
-/* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
+/* Dump the call statement GS. PP, SPC and FLAGS are as in
pp_gimple_stmt_1. */
static void
-dump_gimple_call (pretty_printer *buffer, const gcall *gs, int spc,
+dump_gimple_call (pretty_printer *pp, const gcall *gs, int spc,
dump_flags_t flags)
{
tree lhs = gimple_call_lhs (gs);
@@ -895,72 +895,72 @@ dump_gimple_call (pretty_printer *buffer, const gcall *gs, int spc,
pt = gimple_call_use_set (gs);
if (!pt_solution_empty_p (pt))
{
- pp_string (buffer, "# USE = ");
- pp_points_to_solution (buffer, pt);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# USE = ");
+ pp_points_to_solution (pp, pt);
+ newline_and_indent (pp, spc);
}
pt = gimple_call_clobber_set (gs);
if (!pt_solution_empty_p (pt))
{
- pp_string (buffer, "# CLB = ");
- pp_points_to_solution (buffer, pt);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# CLB = ");
+ pp_points_to_solution (pp, pt);
+ newline_and_indent (pp, spc);
}
}
if (flags & TDF_RAW)
{
if (gimple_call_internal_p (gs))
- dump_gimple_fmt (buffer, spc, flags, "%G <.%s, %T", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <.%s, %T", gs,
internal_fn_name (gimple_call_internal_fn (gs)), lhs);
else
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs);
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, %T", gs, fn, lhs);
if (gimple_call_num_args (gs) > 0)
{
- pp_string (buffer, ", ");
- dump_gimple_call_args (buffer, gs, flags);
+ pp_string (pp, ", ");
+ dump_gimple_call_args (pp, gs, flags);
}
- pp_greater (buffer);
+ pp_greater (pp);
}
else
{
if (lhs && !(flags & TDF_RHS_ONLY))
{
- dump_generic_node (buffer, lhs, spc, flags, false);
- pp_string (buffer, " =");
+ dump_generic_node (pp, lhs, spc, flags, false);
+ pp_string (pp, " =");
if (gimple_has_volatile_ops (gs))
- pp_string (buffer, "{v}");
+ pp_string (pp, "{v}");
- pp_space (buffer);
+ pp_space (pp);
}
if (gimple_call_internal_p (gs))
{
- pp_dot (buffer);
- pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs)));
+ pp_dot (pp);
+ pp_string (pp, internal_fn_name (gimple_call_internal_fn (gs)));
}
else
- print_call_name (buffer, fn, flags);
- pp_string (buffer, " (");
- dump_gimple_call_args (buffer, gs, flags);
- pp_right_paren (buffer);
+ print_call_name (pp, fn, flags);
+ pp_string (pp, " (");
+ dump_gimple_call_args (pp, gs, flags);
+ pp_right_paren (pp);
if (!(flags & TDF_RHS_ONLY))
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
if (gimple_call_chain (gs))
{
- pp_string (buffer, " [static-chain: ");
- dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
- pp_right_bracket (buffer);
+ pp_string (pp, " [static-chain: ");
+ dump_generic_node (pp, gimple_call_chain (gs), spc, flags, false);
+ pp_right_bracket (pp);
}
if (gimple_call_return_slot_opt_p (gs))
- pp_string (buffer, " [return slot optimization]");
+ pp_string (pp, " [return slot optimization]");
if (gimple_call_tail_p (gs))
- pp_string (buffer, " [tail call]");
+ pp_string (pp, " [tail call]");
if (gimple_call_must_tail_p (gs))
- pp_string (buffer, " [must tail call]");
+ pp_string (pp, " [must tail call]");
if (fn == NULL)
return;
@@ -969,7 +969,7 @@ dump_gimple_call (pretty_printer *buffer, const gcall *gs, int spc,
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
- pp_string (buffer, " [tm-clone]");
+ pp_string (pp, " [tm-clone]");
if (TREE_CODE (fn) == FUNCTION_DECL
&& fndecl_built_in_p (fn, BUILT_IN_TM_START)
&& gimple_call_num_args (gs) > 0)
@@ -978,76 +978,76 @@ dump_gimple_call (pretty_printer *buffer, const gcall *gs, int spc,
unsigned HOST_WIDE_INT props;
gcc_assert (TREE_CODE (t) == INTEGER_CST);
- pp_string (buffer, " [ ");
+ pp_string (pp, " [ ");
/* Get the transaction code properties. */
props = TREE_INT_CST_LOW (t);
if (props & PR_INSTRUMENTEDCODE)
- pp_string (buffer, "instrumentedCode ");
+ pp_string (pp, "instrumentedCode ");
if (props & PR_UNINSTRUMENTEDCODE)
- pp_string (buffer, "uninstrumentedCode ");
+ pp_string (pp, "uninstrumentedCode ");
if (props & PR_HASNOXMMUPDATE)
- pp_string (buffer, "hasNoXMMUpdate ");
+ pp_string (pp, "hasNoXMMUpdate ");
if (props & PR_HASNOABORT)
- pp_string (buffer, "hasNoAbort ");
+ pp_string (pp, "hasNoAbort ");
if (props & PR_HASNOIRREVOCABLE)
- pp_string (buffer, "hasNoIrrevocable ");
+ pp_string (pp, "hasNoIrrevocable ");
if (props & PR_DOESGOIRREVOCABLE)
- pp_string (buffer, "doesGoIrrevocable ");
+ pp_string (pp, "doesGoIrrevocable ");
if (props & PR_HASNOSIMPLEREADS)
- pp_string (buffer, "hasNoSimpleReads ");
+ pp_string (pp, "hasNoSimpleReads ");
if (props & PR_AWBARRIERSOMITTED)
- pp_string (buffer, "awBarriersOmitted ");
+ pp_string (pp, "awBarriersOmitted ");
if (props & PR_RARBARRIERSOMITTED)
- pp_string (buffer, "RaRBarriersOmitted ");
+ pp_string (pp, "RaRBarriersOmitted ");
if (props & PR_UNDOLOGCODE)
- pp_string (buffer, "undoLogCode ");
+ pp_string (pp, "undoLogCode ");
if (props & PR_PREFERUNINSTRUMENTED)
- pp_string (buffer, "preferUninstrumented ");
+ pp_string (pp, "preferUninstrumented ");
if (props & PR_EXCEPTIONBLOCK)
- pp_string (buffer, "exceptionBlock ");
+ pp_string (pp, "exceptionBlock ");
if (props & PR_HASELSE)
- pp_string (buffer, "hasElse ");
+ pp_string (pp, "hasElse ");
if (props & PR_READONLY)
- pp_string (buffer, "readOnly ");
+ pp_string (pp, "readOnly ");
- pp_right_bracket (buffer);
+ pp_right_bracket (pp);
}
}
-/* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
+/* Dump the switch statement GS. PP, SPC and FLAGS are as in
pp_gimple_stmt_1. */
static void
-dump_gimple_switch (pretty_printer *buffer, const gswitch *gs, int spc,
+dump_gimple_switch (pretty_printer *pp, const gswitch *gs, int spc,
dump_flags_t flags)
{
unsigned int i;
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, ", gs,
gimple_switch_index (gs));
else
{
- pp_string (buffer, "switch (");
- dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
+ pp_string (pp, "switch (");
+ dump_generic_node (pp, gimple_switch_index (gs), spc, flags, true);
if (flags & TDF_GIMPLE)
- pp_string (buffer, ") {");
+ pp_string (pp, ") {");
else
- pp_string (buffer, ") <");
+ pp_string (pp, ") <");
}
for (i = 0; i < gimple_switch_num_labels (gs); i++)
{
tree case_label = gimple_switch_label (gs, i);
gcc_checking_assert (case_label != NULL_TREE);
- dump_generic_node (buffer, case_label, spc, flags, false);
- pp_space (buffer);
+ dump_generic_node (pp, case_label, spc, flags, false);
+ pp_space (pp);
tree label = CASE_LABEL (case_label);
- dump_generic_node (buffer, label, spc, flags, false);
+ dump_generic_node (pp, label, spc, flags, false);
if (cfun && cfun->cfg)
{
@@ -1056,48 +1056,48 @@ dump_gimple_switch (pretty_printer *buffer, const gswitch *gs, int spc,
{
edge label_edge = find_edge (gimple_bb (gs), dest);
if (label_edge && !(flags & TDF_GIMPLE))
- dump_edge_probability (buffer, label_edge);
+ dump_edge_probability (pp, label_edge);
}
}
if (i < gimple_switch_num_labels (gs) - 1)
{
if (flags & TDF_GIMPLE)
- pp_string (buffer, "; ");
+ pp_string (pp, "; ");
else
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
}
if (flags & TDF_GIMPLE)
- pp_string (buffer, "; }");
+ pp_string (pp, "; }");
else
- pp_greater (buffer);
+ pp_greater (pp);
}
-/* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
+/* Dump the gimple conditional GS. PP, SPC and FLAGS are as in
pp_gimple_stmt_1. */
static void
-dump_gimple_cond (pretty_printer *buffer, const gcond *gs, int spc,
+dump_gimple_cond (pretty_printer *pp, const gcond *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
get_tree_code_name (gimple_cond_code (gs)),
gimple_cond_lhs (gs), gimple_cond_rhs (gs),
gimple_cond_true_label (gs), gimple_cond_false_label (gs));
else
{
if (!(flags & TDF_RHS_ONLY))
- pp_string (buffer, "if (");
- dump_generic_node (buffer, gimple_cond_lhs (gs), spc,
+ pp_string (pp, "if (");
+ dump_generic_node (pp, gimple_cond_lhs (gs), spc,
flags | ((flags & TDF_GIMPLE) ? TDF_GIMPLE_VAL : TDF_NONE),
false);
- pp_space (buffer);
- pp_string (buffer, op_symbol_code (gimple_cond_code (gs), flags));
- pp_space (buffer);
- dump_generic_node (buffer, gimple_cond_rhs (gs), spc,
+ pp_space (pp);
+ pp_string (pp, op_symbol_code (gimple_cond_code (gs), flags));
+ pp_space (pp);
+ dump_generic_node (pp, gimple_cond_rhs (gs), spc,
flags | ((flags & TDF_GIMPLE) ? TDF_GIMPLE_VAL : TDF_NONE),
false);
if (!(flags & TDF_RHS_ONLY))
@@ -1119,112 +1119,112 @@ dump_gimple_cond (pretty_printer *buffer, const gcond *gs, int spc,
bool has_edge_info = true_edge != NULL && false_edge != NULL;
- pp_right_paren (buffer);
+ pp_right_paren (pp);
if (gimple_cond_true_label (gs))
{
- pp_string (buffer, " goto ");
- dump_generic_node (buffer, gimple_cond_true_label (gs),
+ pp_string (pp, " goto ");
+ dump_generic_node (pp, gimple_cond_true_label (gs),
spc, flags, false);
if (has_edge_info && !(flags & TDF_GIMPLE))
- dump_edge_probability (buffer, true_edge);
- pp_semicolon (buffer);
+ dump_edge_probability (pp, true_edge);
+ pp_semicolon (pp);
}
if (gimple_cond_false_label (gs))
{
- pp_string (buffer, " else goto ");
- dump_generic_node (buffer, gimple_cond_false_label (gs),
+ pp_string (pp, " else goto ");
+ dump_generic_node (pp, gimple_cond_false_label (gs),
spc, flags, false);
if (has_edge_info && !(flags & TDF_GIMPLE))
- dump_edge_probability (buffer, false_edge);
+ dump_edge_probability (pp, false_edge);
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
}
}
}
-/* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
+/* Dump a GIMPLE_LABEL tuple on the pretty_printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see
TDF_* in dumpfils.h). */
static void
-dump_gimple_label (pretty_printer *buffer, const glabel *gs, int spc,
+dump_gimple_label (pretty_printer *pp, const glabel *gs, int spc,
dump_flags_t flags)
{
tree label = gimple_label_label (gs);
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
+ dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, label);
else
{
- dump_generic_node (buffer, label, spc, flags, false);
- pp_colon (buffer);
+ dump_generic_node (pp, label, spc, flags, false);
+ pp_colon (pp);
}
if (flags & TDF_GIMPLE)
return;
if (DECL_NONLOCAL (label))
- pp_string (buffer, " [non-local]");
+ pp_string (pp, " [non-local]");
if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
- pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
+ pp_printf (pp, " [LP %d]", EH_LANDING_PAD_NR (label));
}
-/* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
+/* Dump a GIMPLE_GOTO tuple on the pretty_printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see
TDF_* in dumpfile.h). */
static void
-dump_gimple_goto (pretty_printer *buffer, const ggoto *gs, int spc,
+dump_gimple_goto (pretty_printer *pp, const ggoto *gs, int spc,
dump_flags_t flags)
{
tree label = gimple_goto_dest (gs);
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
+ dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, label);
else
- dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
+ dump_gimple_fmt (pp, spc, flags, "goto %T;", label);
}
-/* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
+/* Dump a GIMPLE_BIND tuple on the pretty_printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see
TDF_* in dumpfile.h). */
static void
-dump_gimple_bind (pretty_printer *buffer, const gbind *gs, int spc,
+dump_gimple_bind (pretty_printer *pp, const gbind *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
+ dump_gimple_fmt (pp, spc, flags, "%G <", gs);
else
- pp_left_brace (buffer);
+ pp_left_brace (pp);
if (!(flags & TDF_SLIM))
{
tree var;
for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
{
- newline_and_indent (buffer, 2);
- print_declaration (buffer, var, spc, flags);
+ newline_and_indent (pp, 2);
+ print_declaration (pp, var, spc, flags);
}
if (gimple_bind_vars (gs))
- pp_newline (buffer);
+ pp_newline (pp);
}
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
- newline_and_indent (buffer, spc);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_bind_body (gs), spc + 2, flags);
+ newline_and_indent (pp, spc);
if (flags & TDF_RAW)
- pp_greater (buffer);
+ pp_greater (pp);
else
- pp_right_brace (buffer);
+ pp_right_brace (pp);
}
-/* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_TRY tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_try (pretty_printer *buffer, const gtry *gs, int spc,
+dump_gimple_try (pretty_printer *pp, const gtry *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
@@ -1236,95 +1236,95 @@ dump_gimple_try (pretty_printer *buffer, const gtry *gs, int spc,
type = "GIMPLE_TRY_FINALLY";
else
type = "UNKNOWN GIMPLE_TRY";
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
gimple_try_eval (gs), gimple_try_cleanup (gs));
}
else
{
- pp_string (buffer, "try");
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
+ pp_string (pp, "try");
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
- dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ dump_gimple_seq (pp, gimple_try_eval (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
gimple_seq seq = gimple_try_cleanup (gs);
if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
{
- newline_and_indent (buffer, spc);
- pp_string (buffer, "catch");
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
+ newline_and_indent (pp, spc);
+ pp_string (pp, "catch");
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
}
else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
{
- newline_and_indent (buffer, spc);
- pp_string (buffer, "finally");
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
+ newline_and_indent (pp, spc);
+ pp_string (pp, "finally");
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
if (seq && is_a <geh_else *> (gimple_seq_first_stmt (seq))
&& gimple_seq_nondebug_singleton_p (seq))
{
geh_else *stmt = as_a <geh_else *> (gimple_seq_first_stmt (seq));
seq = gimple_eh_else_n_body (stmt);
- pp_newline (buffer);
- dump_gimple_seq (buffer, seq, spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ pp_newline (pp);
+ dump_gimple_seq (pp, seq, spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
seq = gimple_eh_else_e_body (stmt);
- newline_and_indent (buffer, spc);
- pp_string (buffer, "else");
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
+ newline_and_indent (pp, spc);
+ pp_string (pp, "else");
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
}
}
else
- pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
+ pp_string (pp, " <UNKNOWN GIMPLE_TRY> {");
- pp_newline (buffer);
- dump_gimple_seq (buffer, seq, spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ pp_newline (pp);
+ dump_gimple_seq (pp, seq, spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
-/* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_CATCH tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_catch (pretty_printer *buffer, const gcatch *gs, int spc,
+dump_gimple_catch (pretty_printer *pp, const gcatch *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
gimple_catch_types (gs), gimple_catch_handler (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
+ dump_gimple_fmt (pp, spc, flags, "catch (%T)%+{%S}",
gimple_catch_types (gs), gimple_catch_handler (gs));
}
-/* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_eh_filter (pretty_printer *buffer, const geh_filter *gs, int spc,
+dump_gimple_eh_filter (pretty_printer *pp, const geh_filter *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
gimple_eh_filter_types (gs),
gimple_eh_filter_failure (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
+ dump_gimple_fmt (pp, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
gimple_eh_filter_types (gs),
gimple_eh_filter_failure (gs));
}
@@ -1333,113 +1333,113 @@ dump_gimple_eh_filter (pretty_printer *buffer, const geh_filter *gs, int spc,
/* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
static void
-dump_gimple_eh_must_not_throw (pretty_printer *buffer,
+dump_gimple_eh_must_not_throw (pretty_printer *pp,
const geh_mnt *gs, int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs,
gimple_eh_must_not_throw_fndecl (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
+ dump_gimple_fmt (pp, spc, flags, "<<<eh_must_not_throw (%T)>>>",
gimple_eh_must_not_throw_fndecl (gs));
}
-/* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_eh_else (pretty_printer *buffer, const geh_else *gs, int spc,
+dump_gimple_eh_else (pretty_printer *pp, const geh_else *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs,
gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
else
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
}
-/* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_RESX tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_resx (pretty_printer *buffer, const gresx *gs, int spc,
+dump_gimple_resx (pretty_printer *pp, const gresx *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%d>", gs,
gimple_resx_region (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
+ dump_gimple_fmt (pp, spc, flags, "resx %d", gimple_resx_region (gs));
}
-/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer PP. */
static void
-dump_gimple_eh_dispatch (pretty_printer *buffer, const geh_dispatch *gs,
+dump_gimple_eh_dispatch (pretty_printer *pp, const geh_dispatch *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%d>", gs,
gimple_eh_dispatch_region (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
+ dump_gimple_fmt (pp, spc, flags, "eh_dispatch %d",
gimple_eh_dispatch_region (gs));
}
-/* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
+/* Dump a GIMPLE_DEBUG tuple on the pretty_printer PP, SPC spaces
of indent. FLAGS specifies details to show in the dump (see TDF_*
in dumpfile.h). */
static void
-dump_gimple_debug (pretty_printer *buffer, const gdebug *gs, int spc,
+dump_gimple_debug (pretty_printer *pp, const gdebug *gs, int spc,
dump_flags_t flags)
{
switch (gs->subcode)
{
case GIMPLE_DEBUG_BIND:
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G BIND <%T, %T>", gs,
gimple_debug_bind_get_var (gs),
gimple_debug_bind_get_value (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
+ dump_gimple_fmt (pp, spc, flags, "# DEBUG %T => %T",
gimple_debug_bind_get_var (gs),
gimple_debug_bind_get_value (gs));
break;
case GIMPLE_DEBUG_SOURCE_BIND:
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G SRCBIND <%T, %T>", gs,
gimple_debug_source_bind_get_var (gs),
gimple_debug_source_bind_get_value (gs));
else
- dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T",
+ dump_gimple_fmt (pp, spc, flags, "# DEBUG %T s=> %T",
gimple_debug_source_bind_get_var (gs),
gimple_debug_source_bind_get_value (gs));
break;
case GIMPLE_DEBUG_BEGIN_STMT:
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G BEGIN_STMT", gs);
+ dump_gimple_fmt (pp, spc, flags, "%G BEGIN_STMT", gs);
else
- dump_gimple_fmt (buffer, spc, flags, "# DEBUG BEGIN_STMT");
+ dump_gimple_fmt (pp, spc, flags, "# DEBUG BEGIN_STMT");
break;
case GIMPLE_DEBUG_INLINE_ENTRY:
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G INLINE_ENTRY %T", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G INLINE_ENTRY %T", gs,
gimple_block (gs)
? block_ultimate_origin (gimple_block (gs))
: NULL_TREE);
else
- dump_gimple_fmt (buffer, spc, flags, "# DEBUG INLINE_ENTRY %T",
+ dump_gimple_fmt (pp, spc, flags, "# DEBUG INLINE_ENTRY %T",
gimple_block (gs)
? block_ultimate_origin (gimple_block (gs))
: NULL_TREE);
@@ -1450,9 +1450,9 @@ dump_gimple_debug (pretty_printer *buffer, const gdebug *gs, int spc,
}
}
-/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_for (pretty_printer *buffer, const gomp_for *gs, int spc,
+dump_gimple_omp_for (pretty_printer *pp, const gomp_for *gs, int spc,
dump_flags_t flags)
{
size_t i;
@@ -1480,19 +1480,19 @@ dump_gimple_omp_for (pretty_printer *buffer, const gomp_for *gs, int spc,
default:
gcc_unreachable ();
}
- dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
kind, gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >,");
+ dump_omp_clauses (pp, gimple_omp_for_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >,");
for (i = 0; i < gimple_omp_for_collapse (gs); i++)
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"%+%T, %T, %T, %s, %T,%n",
gimple_omp_for_index (gs, i),
gimple_omp_for_initial (gs, i),
gimple_omp_for_final (gs, i),
get_tree_code_name (gimple_omp_for_cond (gs, i)),
gimple_omp_for_incr (gs, i));
- dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
+ dump_gimple_fmt (pp, spc, flags, "PRE_BODY <%S>%->",
gimple_omp_for_pre_body (gs));
}
else
@@ -1500,236 +1500,236 @@ dump_gimple_omp_for (pretty_printer *buffer, const gomp_for *gs, int spc,
switch (gimple_omp_for_kind (gs))
{
case GF_OMP_FOR_KIND_FOR:
- pp_string (buffer, "#pragma omp for");
+ pp_string (pp, "#pragma omp for");
break;
case GF_OMP_FOR_KIND_DISTRIBUTE:
- pp_string (buffer, "#pragma omp distribute");
+ pp_string (pp, "#pragma omp distribute");
break;
case GF_OMP_FOR_KIND_TASKLOOP:
- pp_string (buffer, "#pragma omp taskloop");
+ pp_string (pp, "#pragma omp taskloop");
break;
case GF_OMP_FOR_KIND_OACC_LOOP:
- pp_string (buffer, "#pragma acc loop");
+ pp_string (pp, "#pragma acc loop");
break;
case GF_OMP_FOR_KIND_SIMD:
- pp_string (buffer, "#pragma omp simd");
+ pp_string (pp, "#pragma omp simd");
break;
default:
gcc_unreachable ();
}
- dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
+ dump_omp_clauses (pp, gimple_omp_for_clauses (gs), spc, flags);
for (i = 0; i < gimple_omp_for_collapse (gs); i++)
{
if (i)
spc += 2;
- newline_and_indent (buffer, spc);
- pp_string (buffer, "for (");
- dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ newline_and_indent (pp, spc);
+ pp_string (pp, "for (");
+ dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
flags, false);
- pp_string (buffer, " = ");
+ pp_string (pp, " = ");
tree init = gimple_omp_for_initial (gs, i);
if (TREE_CODE (init) != TREE_VEC)
- dump_generic_node (buffer, init, spc, flags, false);
+ dump_generic_node (pp, init, spc, flags, false);
else
- dump_omp_loop_non_rect_expr (buffer, init, spc, flags);
- pp_string (buffer, "; ");
+ dump_omp_loop_non_rect_expr (pp, init, spc, flags);
+ pp_string (pp, "; ");
- dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
flags, false);
- pp_space (buffer);
+ pp_space (pp);
switch (gimple_omp_for_cond (gs, i))
{
case LT_EXPR:
- pp_less (buffer);
+ pp_less (pp);
break;
case GT_EXPR:
- pp_greater (buffer);
+ pp_greater (pp);
break;
case LE_EXPR:
- pp_less_equal (buffer);
+ pp_less_equal (pp);
break;
case GE_EXPR:
- pp_greater_equal (buffer);
+ pp_greater_equal (pp);
break;
case NE_EXPR:
- pp_string (buffer, "!=");
+ pp_string (pp, "!=");
break;
default:
gcc_unreachable ();
}
- pp_space (buffer);
+ pp_space (pp);
tree cond = gimple_omp_for_final (gs, i);
if (TREE_CODE (cond) != TREE_VEC)
- dump_generic_node (buffer, cond, spc, flags, false);
+ dump_generic_node (pp, cond, spc, flags, false);
else
- dump_omp_loop_non_rect_expr (buffer, cond, spc, flags);
- pp_string (buffer, "; ");
+ dump_omp_loop_non_rect_expr (pp, cond, spc, flags);
+ pp_string (pp, "; ");
- dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
+ dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
flags, false);
- pp_string (buffer, " = ");
- dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
+ pp_string (pp, " = ");
+ dump_generic_node (pp, gimple_omp_for_incr (gs, i), spc,
flags, false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_continue (pretty_printer *buffer, const gomp_continue *gs,
+dump_gimple_omp_continue (pretty_printer *pp, const gomp_continue *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, %T>", gs,
gimple_omp_continue_control_def (gs),
gimple_omp_continue_control_use (gs));
}
else
{
- pp_string (buffer, "#pragma omp continue (");
- dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
+ pp_string (pp, "#pragma omp continue (");
+ dump_generic_node (pp, gimple_omp_continue_control_def (gs),
spc, flags, false);
- pp_comma (buffer);
- pp_space (buffer);
- dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
+ pp_comma (pp);
+ pp_space (pp);
+ dump_generic_node (pp, gimple_omp_continue_control_use (gs),
spc, flags, false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
}
-/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_single (pretty_printer *buffer, const gomp_single *gs,
+dump_gimple_omp_single (pretty_printer *pp, const gomp_single *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_single_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp single");
- dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp single");
+ dump_omp_clauses (pp, gimple_omp_single_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_taskgroup (pretty_printer *buffer, const gimple *gs,
+dump_gimple_omp_taskgroup (pretty_printer *pp, const gimple *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_taskgroup_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_taskgroup_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp taskgroup");
- dump_omp_clauses (buffer, gimple_omp_taskgroup_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp taskgroup");
+ dump_omp_clauses (pp, gimple_omp_taskgroup_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_MASKED tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_MASKED tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_masked (pretty_printer *buffer, const gimple *gs,
+dump_gimple_omp_masked (pretty_printer *pp, const gimple *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_masked_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_masked_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp masked");
- dump_omp_clauses (buffer, gimple_omp_masked_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp masked");
+ dump_omp_clauses (pp, gimple_omp_masked_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_scope (pretty_printer *buffer, const gimple *gs,
+dump_gimple_omp_scope (pretty_printer *pp, const gimple *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_scope_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_scope_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp scope");
- dump_omp_clauses (buffer, gimple_omp_scope_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp scope");
+ dump_omp_clauses (pp, gimple_omp_scope_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_target (pretty_printer *buffer, const gomp_target *gs,
+dump_gimple_omp_target (pretty_printer *pp, const gomp_target *gs,
int spc, dump_flags_t flags)
{
const char *kind;
@@ -1791,304 +1791,304 @@ dump_gimple_omp_target (pretty_printer *buffer, const gomp_target *gs,
}
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
kind, gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
+ dump_omp_clauses (pp, gimple_omp_target_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >, %T, %T%n>",
gimple_omp_target_child_fn (gs),
gimple_omp_target_data_arg (gs));
}
else
{
- pp_string (buffer, "#pragma omp target");
- pp_string (buffer, kind);
- dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp target");
+ pp_string (pp, kind);
+ dump_omp_clauses (pp, gimple_omp_target_clauses (gs), spc, flags);
if (gimple_omp_target_child_fn (gs))
{
- pp_string (buffer, " [child fn: ");
- dump_generic_node (buffer, gimple_omp_target_child_fn (gs),
+ pp_string (pp, " [child fn: ");
+ dump_generic_node (pp, gimple_omp_target_child_fn (gs),
spc, flags, false);
- pp_string (buffer, " (");
+ pp_string (pp, " (");
if (gimple_omp_target_data_arg (gs))
- dump_generic_node (buffer, gimple_omp_target_data_arg (gs),
+ dump_generic_node (pp, gimple_omp_target_data_arg (gs),
spc, flags, false);
else
- pp_string (buffer, "???");
- pp_string (buffer, ")]");
+ pp_string (pp, "???");
+ pp_string (pp, ")]");
}
gimple_seq body = gimple_omp_body (gs);
if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
else if (body)
{
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 2, flags);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 2, flags);
}
}
}
-/* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_teams (pretty_printer *buffer, const gomp_teams *gs, int spc,
+dump_gimple_omp_teams (pretty_printer *pp, const gomp_teams *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_teams_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp teams");
- dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp teams");
+ dump_omp_clauses (pp, gimple_omp_teams_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '{');
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '}');
+ newline_and_indent (pp, spc + 2);
+ pp_character (pp, '{');
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_character (pp, '}');
}
}
}
-/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_sections (pretty_printer *buffer, const gomp_sections *gs,
+dump_gimple_omp_sections (pretty_printer *pp, const gomp_sections *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >");
+ dump_omp_clauses (pp, gimple_omp_sections_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >");
}
else
{
- pp_string (buffer, "#pragma omp sections");
+ pp_string (pp, "#pragma omp sections");
if (gimple_omp_sections_control (gs))
{
- pp_string (buffer, " <");
- dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
+ pp_string (pp, " <");
+ dump_generic_node (pp, gimple_omp_sections_control (gs), spc,
flags, false);
- pp_greater (buffer);
+ pp_greater (pp);
}
- dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
+ dump_omp_clauses (pp, gimple_omp_sections_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
/* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION,STRUCTURED_BLOCK} tuple on the
- pretty_printer BUFFER. */
+ pretty_printer PP. */
static void
-dump_gimple_omp_block (pretty_printer *buffer, const gimple *gs, int spc,
+dump_gimple_omp_block (pretty_printer *pp, const gimple *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
gimple_omp_body (gs));
else
{
switch (gimple_code (gs))
{
case GIMPLE_OMP_MASTER:
- pp_string (buffer, "#pragma omp master");
+ pp_string (pp, "#pragma omp master");
break;
case GIMPLE_OMP_SECTION:
- pp_string (buffer, "#pragma omp section");
+ pp_string (pp, "#pragma omp section");
break;
case GIMPLE_OMP_STRUCTURED_BLOCK:
- pp_string (buffer, "#pragma omp __structured_block");
+ pp_string (pp, "#pragma omp __structured_block");
break;
default:
gcc_unreachable ();
}
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_critical (pretty_printer *buffer, const gomp_critical *gs,
+dump_gimple_omp_critical (pretty_printer *pp, const gomp_critical *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
gimple_omp_body (gs));
else
{
- pp_string (buffer, "#pragma omp critical");
+ pp_string (pp, "#pragma omp critical");
if (gimple_omp_critical_name (gs))
{
- pp_string (buffer, " (");
- dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
+ pp_string (pp, " (");
+ dump_generic_node (pp, gimple_omp_critical_name (gs), spc,
flags, false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
- dump_omp_clauses (buffer, gimple_omp_critical_clauses (gs), spc, flags);
+ dump_omp_clauses (pp, gimple_omp_critical_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_ordered (pretty_printer *buffer, const gomp_ordered *gs,
+dump_gimple_omp_ordered (pretty_printer *pp, const gomp_ordered *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
gimple_omp_body (gs));
else
{
- pp_string (buffer, "#pragma omp ordered");
- dump_omp_clauses (buffer, gimple_omp_ordered_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp ordered");
+ dump_omp_clauses (pp, gimple_omp_ordered_clauses (gs), spc, flags);
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_scan (pretty_printer *buffer, const gomp_scan *gs,
+dump_gimple_omp_scan (pretty_printer *pp, const gomp_scan *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
gimple_omp_body (gs));
else
{
if (gimple_omp_scan_clauses (gs))
{
- pp_string (buffer, "#pragma omp scan");
- dump_omp_clauses (buffer, gimple_omp_scan_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp scan");
+ dump_omp_clauses (pp, gimple_omp_scan_clauses (gs), spc, flags);
}
if (!gimple_seq_empty_p (gimple_omp_body (gs)))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
}
-/* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer PP. */
static void
-dump_gimple_omp_return (pretty_printer *buffer, const gimple *gs, int spc,
+dump_gimple_omp_return (pretty_printer *pp, const gimple *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <nowait=%d", gs,
(int) gimple_omp_return_nowait_p (gs));
if (gimple_omp_return_lhs (gs))
- dump_gimple_fmt (buffer, spc, flags, ", lhs=%T>",
+ dump_gimple_fmt (pp, spc, flags, ", lhs=%T>",
gimple_omp_return_lhs (gs));
else
- dump_gimple_fmt (buffer, spc, flags, ">");
+ dump_gimple_fmt (pp, spc, flags, ">");
}
else
{
- pp_string (buffer, "#pragma omp return");
+ pp_string (pp, "#pragma omp return");
if (gimple_omp_return_nowait_p (gs))
- pp_string (buffer, "(nowait)");
+ pp_string (pp, "(nowait)");
if (gimple_omp_return_lhs (gs))
{
- pp_string (buffer, " (set ");
- dump_generic_node (buffer, gimple_omp_return_lhs (gs),
+ pp_string (pp, " (set ");
+ dump_generic_node (pp, gimple_omp_return_lhs (gs),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_character (pp, ')');
}
}
}
-/* Dump a GIMPLE_ASSUME tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_ASSUME tuple on the pretty_printer PP. */
static void
-dump_gimple_assume (pretty_printer *buffer, const gimple *gs,
+dump_gimple_assume (pretty_printer *pp, const gimple *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"%G [GUARD=%T] <%+BODY <%S> >",
gs, gimple_assume_guard (gs),
gimple_assume_body (gs));
else
{
- pp_string (buffer, "[[assume (");
- dump_generic_node (buffer, gimple_assume_guard (gs), spc, flags, false);
- pp_string (buffer, ")]]");
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_assume_body (gs), spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ pp_string (pp, "[[assume (");
+ dump_generic_node (pp, gimple_assume_guard (gs), spc, flags, false);
+ pp_string (pp, ")]]");
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_assume_body (gs), spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
}
-/* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
+/* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer PP. */
static void
-dump_gimple_transaction (pretty_printer *buffer, const gtransaction *gs,
+dump_gimple_transaction (pretty_printer *pp, const gtransaction *gs,
int spc, dump_flags_t flags)
{
unsigned subcode = gimple_transaction_subcode (gs);
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags,
+ dump_gimple_fmt (pp, spc, flags,
"%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
"<%+BODY <%S> >",
gs, subcode, gimple_transaction_label_norm (gs),
@@ -2099,171 +2099,171 @@ dump_gimple_transaction (pretty_printer *buffer, const gtransaction *gs,
else
{
if (subcode & GTMA_IS_OUTER)
- pp_string (buffer, "__transaction_atomic [[outer]]");
+ pp_string (pp, "__transaction_atomic [[outer]]");
else if (subcode & GTMA_IS_RELAXED)
- pp_string (buffer, "__transaction_relaxed");
+ pp_string (pp, "__transaction_relaxed");
else
- pp_string (buffer, "__transaction_atomic");
+ pp_string (pp, "__transaction_atomic");
subcode &= ~GTMA_DECLARATION_MASK;
if (gimple_transaction_body (gs))
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, gimple_transaction_body (gs),
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, gimple_transaction_body (gs),
spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
else
{
- pp_string (buffer, " //");
+ pp_string (pp, " //");
if (gimple_transaction_label_norm (gs))
{
- pp_string (buffer, " NORM=");
- dump_generic_node (buffer, gimple_transaction_label_norm (gs),
+ pp_string (pp, " NORM=");
+ dump_generic_node (pp, gimple_transaction_label_norm (gs),
spc, flags, false);
}
if (gimple_transaction_label_uninst (gs))
{
- pp_string (buffer, " UNINST=");
- dump_generic_node (buffer, gimple_transaction_label_uninst (gs),
+ pp_string (pp, " UNINST=");
+ dump_generic_node (pp, gimple_transaction_label_uninst (gs),
spc, flags, false);
}
if (gimple_transaction_label_over (gs))
{
- pp_string (buffer, " OVER=");
- dump_generic_node (buffer, gimple_transaction_label_over (gs),
+ pp_string (pp, " OVER=");
+ dump_generic_node (pp, gimple_transaction_label_over (gs),
spc, flags, false);
}
if (subcode)
{
- pp_string (buffer, " SUBCODE=[ ");
+ pp_string (pp, " SUBCODE=[ ");
if (subcode & GTMA_HAVE_ABORT)
{
- pp_string (buffer, "GTMA_HAVE_ABORT ");
+ pp_string (pp, "GTMA_HAVE_ABORT ");
subcode &= ~GTMA_HAVE_ABORT;
}
if (subcode & GTMA_HAVE_LOAD)
{
- pp_string (buffer, "GTMA_HAVE_LOAD ");
+ pp_string (pp, "GTMA_HAVE_LOAD ");
subcode &= ~GTMA_HAVE_LOAD;
}
if (subcode & GTMA_HAVE_STORE)
{
- pp_string (buffer, "GTMA_HAVE_STORE ");
+ pp_string (pp, "GTMA_HAVE_STORE ");
subcode &= ~GTMA_HAVE_STORE;
}
if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
{
- pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE ");
+ pp_string (pp, "GTMA_MAY_ENTER_IRREVOCABLE ");
subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
}
if (subcode & GTMA_DOES_GO_IRREVOCABLE)
{
- pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE ");
+ pp_string (pp, "GTMA_DOES_GO_IRREVOCABLE ");
subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
}
if (subcode & GTMA_HAS_NO_INSTRUMENTATION)
{
- pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION ");
+ pp_string (pp, "GTMA_HAS_NO_INSTRUMENTATION ");
subcode &= ~GTMA_HAS_NO_INSTRUMENTATION;
}
if (subcode)
- pp_printf (buffer, "0x%x ", subcode);
- pp_right_bracket (buffer);
+ pp_printf (pp, "0x%x ", subcode);
+ pp_right_bracket (pp);
}
}
}
}
-/* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
+/* Dump a GIMPLE_ASM tuple on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
+dump_gimple_asm (pretty_printer *pp, const gasm *gs, int spc,
dump_flags_t flags)
{
unsigned int i, n, f, fields;
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+STRING <%n%s%n>", gs,
gimple_asm_string (gs));
n = gimple_asm_noutputs (gs);
if (n)
{
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "OUTPUT: ");
+ newline_and_indent (pp, spc + 2);
+ pp_string (pp, "OUTPUT: ");
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_output_op (gs, i),
+ dump_generic_node (pp, gimple_asm_output_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
}
n = gimple_asm_ninputs (gs);
if (n)
{
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "INPUT: ");
+ newline_and_indent (pp, spc + 2);
+ pp_string (pp, "INPUT: ");
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_input_op (gs, i),
+ dump_generic_node (pp, gimple_asm_input_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
}
n = gimple_asm_nclobbers (gs);
if (n)
{
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "CLOBBER: ");
+ newline_and_indent (pp, spc + 2);
+ pp_string (pp, "CLOBBER: ");
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
+ dump_generic_node (pp, gimple_asm_clobber_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
}
n = gimple_asm_nlabels (gs);
if (n)
{
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "LABEL: ");
+ newline_and_indent (pp, spc + 2);
+ pp_string (pp, "LABEL: ");
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_label_op (gs, i),
+ dump_generic_node (pp, gimple_asm_label_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
}
- newline_and_indent (buffer, spc);
- pp_greater (buffer);
+ newline_and_indent (pp, spc);
+ pp_greater (pp);
}
else
{
- pp_string (buffer, "__asm__");
+ pp_string (pp, "__asm__");
if (gimple_asm_volatile_p (gs))
- pp_string (buffer, " __volatile__");
+ pp_string (pp, " __volatile__");
if (gimple_asm_inline_p (gs))
- pp_string (buffer, " __inline__");
+ pp_string (pp, " __inline__");
if (gimple_asm_nlabels (gs))
- pp_string (buffer, " goto");
- pp_string (buffer, "(\"");
- pp_string (buffer, gimple_asm_string (gs));
- pp_string (buffer, "\"");
+ pp_string (pp, " goto");
+ pp_string (pp, "(\"");
+ pp_string (pp, gimple_asm_string (gs));
+ pp_string (pp, "\"");
if (gimple_asm_nlabels (gs))
fields = 4;
@@ -2278,7 +2278,7 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
for (f = 0; f < fields; ++f)
{
- pp_string (buffer, " : ");
+ pp_string (pp, " : ");
switch (f)
{
@@ -2286,10 +2286,10 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
n = gimple_asm_noutputs (gs);
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_output_op (gs, i),
+ dump_generic_node (pp, gimple_asm_output_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
break;
@@ -2297,10 +2297,10 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
n = gimple_asm_ninputs (gs);
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_input_op (gs, i),
+ dump_generic_node (pp, gimple_asm_input_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
break;
@@ -2308,10 +2308,10 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
n = gimple_asm_nclobbers (gs);
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
+ dump_generic_node (pp, gimple_asm_clobber_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
break;
@@ -2319,10 +2319,10 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
n = gimple_asm_nlabels (gs);
for (i = 0; i < n; i++)
{
- dump_generic_node (buffer, gimple_asm_label_op (gs, i),
+ dump_generic_node (pp, gimple_asm_label_op (gs, i),
spc, flags, false);
if (i < n - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
break;
@@ -2331,15 +2331,15 @@ dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc,
}
}
- pp_string (buffer, ");");
+ pp_string (pp, ");");
}
}
-/* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
+/* Dump ptr_info and range_info for NODE on pretty_printer PP with
SPC spaces of indent. */
static void
-dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
+dump_ssaname_info (pretty_printer *pp, tree node, int spc)
{
if (TREE_CODE (node) != SSA_NAME)
return;
@@ -2349,13 +2349,13 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
{
unsigned int align, misalign;
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
- pp_string (buffer, "# PT = ");
- pp_points_to_solution (buffer, &pi->pt);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# PT = ");
+ pp_points_to_solution (pp, &pi->pt);
+ newline_and_indent (pp, spc);
if (get_ptr_info_alignment (pi, &align, &misalign))
{
- pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign);
- newline_and_indent (buffer, spc);
+ pp_printf (pp, "# ALIGN = %u, MISALIGN = %u", align, misalign);
+ newline_and_indent (pp, spc);
}
}
@@ -2364,9 +2364,9 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
{
Value_Range r (TREE_TYPE (node));
get_global_range_query ()->range_of_expr (r, node);
- pp_string (buffer, "# RANGE ");
- pp_vrange (buffer, &r);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# RANGE ");
+ pp_vrange (pp, &r);
+ newline_and_indent (pp, spc);
}
}
@@ -2375,138 +2375,138 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
void
dump_ssaname_info_to_file (FILE *file, tree node, int spc)
{
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- dump_ssaname_info (&buffer, node, spc);
- pp_flush (&buffer);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ dump_ssaname_info (&pp, node, spc);
+ pp_flush (&pp);
}
-/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
- The caller is responsible for calling pp_flush on BUFFER to finalize
+/* Dump a PHI node PHI. PP, SPC and FLAGS are as in pp_gimple_stmt_1.
+ The caller is responsible for calling pp_flush on PP to finalize
pretty printer. If COMMENT is true, print this after #. */
static void
-dump_gimple_phi (pretty_printer *buffer, const gphi *phi, int spc, bool comment,
+dump_gimple_phi (pretty_printer *pp, const gphi *phi, int spc, bool comment,
dump_flags_t flags)
{
size_t i;
tree lhs = gimple_phi_result (phi);
if (flags & TDF_ALIAS)
- dump_ssaname_info (buffer, lhs, spc);
+ dump_ssaname_info (pp, lhs, spc);
if (comment)
- pp_string (buffer, "# ");
+ pp_string (pp, "# ");
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, ", phi,
gimple_phi_result (phi));
else
{
- dump_generic_node (buffer, lhs, spc, flags, false);
+ dump_generic_node (pp, lhs, spc, flags, false);
if (flags & TDF_GIMPLE)
- pp_string (buffer, " = __PHI (");
+ pp_string (pp, " = __PHI (");
else
- pp_string (buffer, " = PHI <");
+ pp_string (pp, " = PHI <");
}
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
- dump_location (buffer, gimple_phi_arg_location (phi, i));
+ dump_location (pp, gimple_phi_arg_location (phi, i));
basic_block src = gimple_phi_arg_edge (phi, i)->src;
if (flags & TDF_GIMPLE)
{
- pp_string (buffer, "__BB");
- pp_decimal_int (buffer, src->index);
- pp_string (buffer, ": ");
+ pp_string (pp, "__BB");
+ pp_decimal_int (pp, src->index);
+ pp_string (pp, ": ");
}
- dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
+ dump_generic_node (pp, gimple_phi_arg_def (phi, i), spc, flags,
false);
if (! (flags & TDF_GIMPLE))
{
- pp_left_paren (buffer);
- pp_decimal_int (buffer, src->index);
- pp_right_paren (buffer);
+ pp_left_paren (pp);
+ pp_decimal_int (pp, src->index);
+ pp_right_paren (pp);
}
if (i < gimple_phi_num_args (phi) - 1)
- pp_string (buffer, ", ");
+ pp_string (pp, ", ");
}
if (flags & TDF_GIMPLE)
- pp_string (buffer, ");");
+ pp_string (pp, ");");
else
- pp_greater (buffer);
+ pp_greater (pp);
}
-/* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
+/* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer PP, SPC spaces
of indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_omp_parallel (pretty_printer *buffer, const gomp_parallel *gs,
+dump_gimple_omp_parallel (pretty_printer *pp, const gomp_parallel *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
+ dump_omp_clauses (pp, gimple_omp_parallel_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >, %T, %T%n>",
gimple_omp_parallel_child_fn (gs),
gimple_omp_parallel_data_arg (gs));
}
else
{
gimple_seq body;
- pp_string (buffer, "#pragma omp parallel");
- dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp parallel");
+ dump_omp_clauses (pp, gimple_omp_parallel_clauses (gs), spc, flags);
if (gimple_omp_parallel_child_fn (gs))
{
- pp_string (buffer, " [child fn: ");
- dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
+ pp_string (pp, " [child fn: ");
+ dump_generic_node (pp, gimple_omp_parallel_child_fn (gs),
spc, flags, false);
- pp_string (buffer, " (");
+ pp_string (pp, " (");
if (gimple_omp_parallel_data_arg (gs))
- dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
+ dump_generic_node (pp, gimple_omp_parallel_data_arg (gs),
spc, flags, false);
else
- pp_string (buffer, "???");
- pp_string (buffer, ")]");
+ pp_string (pp, "???");
+ pp_string (pp, ")]");
}
body = gimple_omp_body (gs);
if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
else if (body)
{
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 2, flags);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 2, flags);
}
}
}
-/* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
+/* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer PP, SPC spaces
of indent. FLAGS specifies details to show in the dump (see TDF_* in
dumpfile.h). */
static void
-dump_gimple_omp_task (pretty_printer *buffer, const gomp_task *gs, int spc,
+dump_gimple_omp_task (pretty_printer *pp, const gomp_task *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
gimple_omp_body (gs));
- dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
- dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
+ dump_omp_clauses (pp, gimple_omp_task_clauses (gs), spc, flags);
+ dump_gimple_fmt (pp, spc, flags, " >, %T, %T, %T, %T, %T%n>",
gimple_omp_task_child_fn (gs),
gimple_omp_task_data_arg (gs),
gimple_omp_task_copy_fn (gs),
@@ -2517,116 +2517,116 @@ dump_gimple_omp_task (pretty_printer *buffer, const gomp_task *gs, int spc,
{
gimple_seq body;
if (gimple_omp_task_taskloop_p (gs))
- pp_string (buffer, "#pragma omp taskloop");
+ pp_string (pp, "#pragma omp taskloop");
else if (gimple_omp_task_taskwait_p (gs))
- pp_string (buffer, "#pragma omp taskwait");
+ pp_string (pp, "#pragma omp taskwait");
else
- pp_string (buffer, "#pragma omp task");
- dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
+ pp_string (pp, "#pragma omp task");
+ dump_omp_clauses (pp, gimple_omp_task_clauses (gs), spc, flags);
if (gimple_omp_task_child_fn (gs))
{
- pp_string (buffer, " [child fn: ");
- dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
+ pp_string (pp, " [child fn: ");
+ dump_generic_node (pp, gimple_omp_task_child_fn (gs),
spc, flags, false);
- pp_string (buffer, " (");
+ pp_string (pp, " (");
if (gimple_omp_task_data_arg (gs))
- dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
+ dump_generic_node (pp, gimple_omp_task_data_arg (gs),
spc, flags, false);
else
- pp_string (buffer, "???");
- pp_string (buffer, ")]");
+ pp_string (pp, "???");
+ pp_string (pp, ")]");
}
body = gimple_omp_body (gs);
if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
{
- newline_and_indent (buffer, spc + 2);
- pp_left_brace (buffer);
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 4, flags);
- newline_and_indent (buffer, spc + 2);
- pp_right_brace (buffer);
+ newline_and_indent (pp, spc + 2);
+ pp_left_brace (pp);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 4, flags);
+ newline_and_indent (pp, spc + 2);
+ pp_right_brace (pp);
}
else if (body)
{
- pp_newline (buffer);
- dump_gimple_seq (buffer, body, spc + 2, flags);
+ pp_newline (pp);
+ dump_gimple_seq (pp, body, spc + 2, flags);
}
}
}
-/* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
+/* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
in dumpfile.h). */
static void
-dump_gimple_omp_atomic_load (pretty_printer *buffer, const gomp_atomic_load *gs,
+dump_gimple_omp_atomic_load (pretty_printer *pp, const gomp_atomic_load *gs,
int spc, dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T, %T>", gs,
gimple_omp_atomic_load_lhs (gs),
gimple_omp_atomic_load_rhs (gs));
}
else
{
- pp_string (buffer, "#pragma omp atomic_load");
- dump_omp_atomic_memory_order (buffer,
+ pp_string (pp, "#pragma omp atomic_load");
+ dump_omp_atomic_memory_order (pp,
gimple_omp_atomic_memory_order (gs));
if (gimple_omp_atomic_need_value_p (gs))
- pp_string (buffer, " [needed]");
+ pp_string (pp, " [needed]");
if (gimple_omp_atomic_weak_p (gs))
- pp_string (buffer, " [weak]");
- newline_and_indent (buffer, spc + 2);
- dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
+ pp_string (pp, " [weak]");
+ newline_and_indent (pp, spc + 2);
+ dump_generic_node (pp, gimple_omp_atomic_load_lhs (gs),
spc, flags, false);
- pp_space (buffer);
- pp_equal (buffer);
- pp_space (buffer);
- pp_star (buffer);
- dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
+ pp_space (pp);
+ pp_equal (pp);
+ pp_space (pp);
+ pp_star (pp);
+ dump_generic_node (pp, gimple_omp_atomic_load_rhs (gs),
spc, flags, false);
}
}
-/* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
+/* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
in dumpfile.h). */
static void
-dump_gimple_omp_atomic_store (pretty_printer *buffer,
+dump_gimple_omp_atomic_store (pretty_printer *pp,
const gomp_atomic_store *gs, int spc,
dump_flags_t flags)
{
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
+ dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs,
gimple_omp_atomic_store_val (gs));
}
else
{
- pp_string (buffer, "#pragma omp atomic_store");
- dump_omp_atomic_memory_order (buffer,
+ pp_string (pp, "#pragma omp atomic_store");
+ dump_omp_atomic_memory_order (pp,
gimple_omp_atomic_memory_order (gs));
- pp_space (buffer);
+ pp_space (pp);
if (gimple_omp_atomic_need_value_p (gs))
- pp_string (buffer, "[needed] ");
+ pp_string (pp, "[needed] ");
if (gimple_omp_atomic_weak_p (gs))
- pp_string (buffer, "[weak] ");
- pp_left_paren (buffer);
- dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
+ pp_string (pp, "[weak] ");
+ pp_left_paren (pp);
+ dump_generic_node (pp, gimple_omp_atomic_store_val (gs),
spc, flags, false);
- pp_right_paren (buffer);
+ pp_right_paren (pp);
}
}
-/* Dump all the memory operands for statement GS. BUFFER, SPC and
+/* Dump all the memory operands for statement GS. PP, SPC and
FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_gimple_mem_ops (pretty_printer *buffer, const gimple *gs, int spc,
+dump_gimple_mem_ops (pretty_printer *pp, const gimple *gs, int spc,
dump_flags_t flags)
{
tree vdef = gimple_vdef (gs);
@@ -2634,246 +2634,246 @@ dump_gimple_mem_ops (pretty_printer *buffer, const gimple *gs, int spc,
if (vdef != NULL_TREE)
{
- pp_string (buffer, "# ");
- dump_generic_node (buffer, vdef, spc + 2, flags, false);
- pp_string (buffer, " = VDEF <");
- dump_generic_node (buffer, vuse, spc + 2, flags, false);
- pp_greater (buffer);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# ");
+ dump_generic_node (pp, vdef, spc + 2, flags, false);
+ pp_string (pp, " = VDEF <");
+ dump_generic_node (pp, vuse, spc + 2, flags, false);
+ pp_greater (pp);
+ newline_and_indent (pp, spc);
}
else if (vuse != NULL_TREE)
{
- pp_string (buffer, "# VUSE <");
- dump_generic_node (buffer, vuse, spc + 2, flags, false);
- pp_greater (buffer);
- newline_and_indent (buffer, spc);
+ pp_string (pp, "# VUSE <");
+ dump_generic_node (pp, vuse, spc + 2, flags, false);
+ pp_greater (pp);
+ newline_and_indent (pp, spc);
}
}
-/* Print the gimple statement GS on the pretty printer BUFFER, SPC
+/* Print the gimple statement GS on the pretty printer PP, SPC
spaces of indent. FLAGS specifies details to show in the dump (see
TDF_* in dumpfile.h). The caller is responsible for calling
- pp_flush on BUFFER to finalize the pretty printer. */
+ pp_flush on PP to finalize the pretty printer. */
void
-pp_gimple_stmt_1 (pretty_printer *buffer, const gimple *gs, int spc,
+pp_gimple_stmt_1 (pretty_printer *pp, const gimple *gs, int spc,
dump_flags_t flags)
{
if (!gs)
return;
if (flags & TDF_STMTADDR)
- pp_printf (buffer, "<&%p> ", (const void *) gs);
+ pp_printf (pp, "<&%p> ", (const void *) gs);
if ((flags & TDF_LINENO) && gimple_has_location (gs))
- dump_location (buffer, gimple_location (gs));
+ dump_location (pp, gimple_location (gs));
if (flags & TDF_EH)
{
int lp_nr = lookup_stmt_eh_lp (gs);
if (lp_nr > 0)
- pp_printf (buffer, "[LP %d] ", lp_nr);
+ pp_printf (pp, "[LP %d] ", lp_nr);
else if (lp_nr < 0)
- pp_printf (buffer, "[MNT %d] ", -lp_nr);
+ pp_printf (pp, "[MNT %d] ", -lp_nr);
}
if ((flags & (TDF_VOPS|TDF_MEMSYMS))
&& gimple_has_mem_ops (gs))
- dump_gimple_mem_ops (buffer, gs, spc, flags);
+ dump_gimple_mem_ops (pp, gs, spc, flags);
if (gimple_has_lhs (gs)
&& (flags & TDF_ALIAS))
- dump_ssaname_info (buffer, gimple_get_lhs (gs), spc);
+ dump_ssaname_info (pp, gimple_get_lhs (gs), spc);
switch (gimple_code (gs))
{
case GIMPLE_ASM:
- dump_gimple_asm (buffer, as_a <const gasm *> (gs), spc, flags);
+ dump_gimple_asm (pp, as_a <const gasm *> (gs), spc, flags);
break;
case GIMPLE_ASSIGN:
- dump_gimple_assign (buffer, as_a <const gassign *> (gs), spc, flags);
+ dump_gimple_assign (pp, as_a <const gassign *> (gs), spc, flags);
break;
case GIMPLE_BIND:
- dump_gimple_bind (buffer, as_a <const gbind *> (gs), spc, flags);
+ dump_gimple_bind (pp, as_a <const gbind *> (gs), spc, flags);
break;
case GIMPLE_CALL:
- dump_gimple_call (buffer, as_a <const gcall *> (gs), spc, flags);
+ dump_gimple_call (pp, as_a <const gcall *> (gs), spc, flags);
break;
case GIMPLE_COND:
- dump_gimple_cond (buffer, as_a <const gcond *> (gs), spc, flags);
+ dump_gimple_cond (pp, as_a <const gcond *> (gs), spc, flags);
break;
case GIMPLE_LABEL:
- dump_gimple_label (buffer, as_a <const glabel *> (gs), spc, flags);
+ dump_gimple_label (pp, as_a <const glabel *> (gs), spc, flags);
break;
case GIMPLE_GOTO:
- dump_gimple_goto (buffer, as_a <const ggoto *> (gs), spc, flags);
+ dump_gimple_goto (pp, as_a <const ggoto *> (gs), spc, flags);
break;
case GIMPLE_NOP:
- pp_string (buffer, "GIMPLE_NOP");
+ pp_string (pp, "GIMPLE_NOP");
break;
case GIMPLE_RETURN:
- dump_gimple_return (buffer, as_a <const greturn *> (gs), spc, flags);
+ dump_gimple_return (pp, as_a <const greturn *> (gs), spc, flags);
break;
case GIMPLE_SWITCH:
- dump_gimple_switch (buffer, as_a <const gswitch *> (gs), spc, flags);
+ dump_gimple_switch (pp, as_a <const gswitch *> (gs), spc, flags);
break;
case GIMPLE_TRY:
- dump_gimple_try (buffer, as_a <const gtry *> (gs), spc, flags);
+ dump_gimple_try (pp, as_a <const gtry *> (gs), spc, flags);
break;
case GIMPLE_PHI:
- dump_gimple_phi (buffer, as_a <const gphi *> (gs), spc, false, flags);
+ dump_gimple_phi (pp, as_a <const gphi *> (gs), spc, false, flags);
break;
case GIMPLE_OMP_PARALLEL:
- dump_gimple_omp_parallel (buffer, as_a <const gomp_parallel *> (gs), spc,
+ dump_gimple_omp_parallel (pp, as_a <const gomp_parallel *> (gs), spc,
flags);
break;
case GIMPLE_OMP_TASK:
- dump_gimple_omp_task (buffer, as_a <const gomp_task *> (gs), spc, flags);
+ dump_gimple_omp_task (pp, as_a <const gomp_task *> (gs), spc, flags);
break;
case GIMPLE_OMP_ATOMIC_LOAD:
- dump_gimple_omp_atomic_load (buffer, as_a <const gomp_atomic_load *> (gs),
+ dump_gimple_omp_atomic_load (pp, as_a <const gomp_atomic_load *> (gs),
spc, flags);
break;
case GIMPLE_OMP_ATOMIC_STORE:
- dump_gimple_omp_atomic_store (buffer,
+ dump_gimple_omp_atomic_store (pp,
as_a <const gomp_atomic_store *> (gs),
spc, flags);
break;
case GIMPLE_OMP_FOR:
- dump_gimple_omp_for (buffer, as_a <const gomp_for *> (gs), spc, flags);
+ dump_gimple_omp_for (pp, as_a <const gomp_for *> (gs), spc, flags);
break;
case GIMPLE_OMP_CONTINUE:
- dump_gimple_omp_continue (buffer, as_a <const gomp_continue *> (gs), spc,
+ dump_gimple_omp_continue (pp, as_a <const gomp_continue *> (gs), spc,
flags);
break;
case GIMPLE_OMP_SINGLE:
- dump_gimple_omp_single (buffer, as_a <const gomp_single *> (gs), spc,
+ dump_gimple_omp_single (pp, as_a <const gomp_single *> (gs), spc,
flags);
break;
case GIMPLE_OMP_TARGET:
- dump_gimple_omp_target (buffer, as_a <const gomp_target *> (gs), spc,
+ dump_gimple_omp_target (pp, as_a <const gomp_target *> (gs), spc,
flags);
break;
case GIMPLE_OMP_TEAMS:
- dump_gimple_omp_teams (buffer, as_a <const gomp_teams *> (gs), spc,
+ dump_gimple_omp_teams (pp, as_a <const gomp_teams *> (gs), spc,
flags);
break;
case GIMPLE_OMP_RETURN:
- dump_gimple_omp_return (buffer, gs, spc, flags);
+ dump_gimple_omp_return (pp, gs, spc, flags);
break;
case GIMPLE_OMP_SECTIONS:
- dump_gimple_omp_sections (buffer, as_a <const gomp_sections *> (gs),
+ dump_gimple_omp_sections (pp, as_a <const gomp_sections *> (gs),
spc, flags);
break;
case GIMPLE_OMP_SECTIONS_SWITCH:
- pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
+ pp_string (pp, "GIMPLE_SECTIONS_SWITCH");
break;
case GIMPLE_OMP_TASKGROUP:
- dump_gimple_omp_taskgroup (buffer, gs, spc, flags);
+ dump_gimple_omp_taskgroup (pp, gs, spc, flags);
break;
case GIMPLE_OMP_MASKED:
- dump_gimple_omp_masked (buffer, gs, spc, flags);
+ dump_gimple_omp_masked (pp, gs, spc, flags);
break;
case GIMPLE_OMP_SCOPE:
- dump_gimple_omp_scope (buffer, gs, spc, flags);
+ dump_gimple_omp_scope (pp, gs, spc, flags);
break;
case GIMPLE_OMP_MASTER:
case GIMPLE_OMP_SECTION:
case GIMPLE_OMP_STRUCTURED_BLOCK:
- dump_gimple_omp_block (buffer, gs, spc, flags);
+ dump_gimple_omp_block (pp, gs, spc, flags);
break;
case GIMPLE_OMP_ORDERED:
- dump_gimple_omp_ordered (buffer, as_a <const gomp_ordered *> (gs), spc,
+ dump_gimple_omp_ordered (pp, as_a <const gomp_ordered *> (gs), spc,
flags);
break;
case GIMPLE_OMP_SCAN:
- dump_gimple_omp_scan (buffer, as_a <const gomp_scan *> (gs), spc,
+ dump_gimple_omp_scan (pp, as_a <const gomp_scan *> (gs), spc,
flags);
break;
case GIMPLE_OMP_CRITICAL:
- dump_gimple_omp_critical (buffer, as_a <const gomp_critical *> (gs), spc,
+ dump_gimple_omp_critical (pp, as_a <const gomp_critical *> (gs), spc,
flags);
break;
case GIMPLE_CATCH:
- dump_gimple_catch (buffer, as_a <const gcatch *> (gs), spc, flags);
+ dump_gimple_catch (pp, as_a <const gcatch *> (gs), spc, flags);
break;
case GIMPLE_EH_FILTER:
- dump_gimple_eh_filter (buffer, as_a <const geh_filter *> (gs), spc,
+ dump_gimple_eh_filter (pp, as_a <const geh_filter *> (gs), spc,
flags);
break;
case GIMPLE_EH_MUST_NOT_THROW:
- dump_gimple_eh_must_not_throw (buffer,
+ dump_gimple_eh_must_not_throw (pp,
as_a <const geh_mnt *> (gs),
spc, flags);
break;
case GIMPLE_EH_ELSE:
- dump_gimple_eh_else (buffer, as_a <const geh_else *> (gs), spc, flags);
+ dump_gimple_eh_else (pp, as_a <const geh_else *> (gs), spc, flags);
break;
case GIMPLE_RESX:
- dump_gimple_resx (buffer, as_a <const gresx *> (gs), spc, flags);
+ dump_gimple_resx (pp, as_a <const gresx *> (gs), spc, flags);
break;
case GIMPLE_EH_DISPATCH:
- dump_gimple_eh_dispatch (buffer, as_a <const geh_dispatch *> (gs), spc,
+ dump_gimple_eh_dispatch (pp, as_a <const geh_dispatch *> (gs), spc,
flags);
break;
case GIMPLE_DEBUG:
- dump_gimple_debug (buffer, as_a <const gdebug *> (gs), spc, flags);
+ dump_gimple_debug (pp, as_a <const gdebug *> (gs), spc, flags);
break;
case GIMPLE_PREDICT:
- pp_string (buffer, "// predicted ");
+ pp_string (pp, "// predicted ");
if (gimple_predict_outcome (gs))
- pp_string (buffer, "likely by ");
+ pp_string (pp, "likely by ");
else
- pp_string (buffer, "unlikely by ");
- pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
- pp_string (buffer, " predictor.");
+ pp_string (pp, "unlikely by ");
+ pp_string (pp, predictor_name (gimple_predict_predictor (gs)));
+ pp_string (pp, " predictor.");
break;
case GIMPLE_ASSUME:
- dump_gimple_assume (buffer, gs, spc, flags);
+ dump_gimple_assume (pp, gs, spc, flags);
break;
case GIMPLE_TRANSACTION:
- dump_gimple_transaction (buffer, as_a <const gtransaction *> (gs), spc,
+ dump_gimple_transaction (pp, as_a <const gtransaction *> (gs), spc,
flags);
break;
@@ -2929,7 +2929,7 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
}
-/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
+/* Dumps end of basic block BB to PP indented by INDENT
spaces. */
static void
@@ -2943,11 +2943,11 @@ dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
}
-/* Dump PHI nodes of basic block BB to BUFFER with details described
+/* Dump PHI nodes of basic block BB to PP with details described
by FLAGS and indented by INDENT spaces. */
static void
-dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent,
+dump_phi_nodes (pretty_printer *pp, basic_block bb, int indent,
dump_flags_t flags)
{
gphi_iterator i;
@@ -2958,52 +2958,52 @@ dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent,
if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
{
INDENT (indent);
- dump_gimple_phi (buffer, phi, indent,
+ dump_gimple_phi (pp, phi, indent,
(flags & TDF_GIMPLE) ? false : true, flags);
- pp_newline (buffer);
+ pp_newline (pp);
}
}
}
/* Dump jump to basic block BB that is represented implicitly in the cfg
- to BUFFER. */
+ to PP. */
static void
-pp_cfg_jump (pretty_printer *buffer, edge e, dump_flags_t flags)
+pp_cfg_jump (pretty_printer *pp, edge e, dump_flags_t flags)
{
if (flags & TDF_GIMPLE)
{
- pp_string (buffer, "goto __BB");
- pp_decimal_int (buffer, e->dest->index);
+ pp_string (pp, "goto __BB");
+ pp_decimal_int (pp, e->dest->index);
if (e->probability.initialized_p ())
{
- pp_string (buffer, "(");
- pp_string (buffer,
+ pp_string (pp, "(");
+ pp_string (pp,
profile_quality_as_string (e->probability.quality ()));
- pp_string (buffer, "(");
- pp_decimal_int (buffer, e->probability.value ());
- pp_string (buffer, "))");
+ pp_string (pp, "(");
+ pp_decimal_int (pp, e->probability.value ());
+ pp_string (pp, "))");
}
- pp_semicolon (buffer);
+ pp_semicolon (pp);
}
else
{
- pp_string (buffer, "goto <bb ");
- pp_decimal_int (buffer, e->dest->index);
- pp_greater (buffer);
- pp_semicolon (buffer);
+ pp_string (pp, "goto <bb ");
+ pp_decimal_int (pp, e->dest->index);
+ pp_greater (pp);
+ pp_semicolon (pp);
- dump_edge_probability (buffer, e);
+ dump_edge_probability (pp, e);
}
}
-/* Dump edges represented implicitly in basic block BB to BUFFER, indented
+/* Dump edges represented implicitly in basic block BB to PP, indented
by INDENT spaces, with details given by FLAGS. */
static void
-dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
+dump_implicit_edges (pretty_printer *pp, basic_block bb, int indent,
dump_flags_t flags)
{
edge e;
@@ -3020,12 +3020,12 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
INDENT (indent + 2);
- pp_cfg_jump (buffer, true_edge, flags);
- newline_and_indent (buffer, indent);
- pp_string (buffer, "else");
- newline_and_indent (buffer, indent + 2);
- pp_cfg_jump (buffer, false_edge, flags);
- pp_newline (buffer);
+ pp_cfg_jump (pp, true_edge, flags);
+ newline_and_indent (pp, indent);
+ pp_string (pp, "else");
+ newline_and_indent (pp, indent + 2);
+ pp_cfg_jump (pp, false_edge, flags);
+ pp_newline (pp);
return;
}
@@ -3039,19 +3039,19 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
if ((flags & TDF_LINENO)
&& e->goto_locus != UNKNOWN_LOCATION)
- dump_location (buffer, e->goto_locus);
+ dump_location (pp, e->goto_locus);
- pp_cfg_jump (buffer, e, flags);
- pp_newline (buffer);
+ pp_cfg_jump (pp, e, flags);
+ pp_newline (pp);
}
}
-/* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
+/* Dumps basic block BB to PP with details described by FLAGS and
indented by INDENT spaces. */
static void
-gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
+gimple_dump_bb_buff (pretty_printer *pp, basic_block bb, int indent,
dump_flags_t flags)
{
gimple_stmt_iterator gsi;
@@ -3061,7 +3061,7 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
if (label_indent < 0)
label_indent = 0;
- dump_phi_nodes (buffer, bb, indent, flags);
+ dump_phi_nodes (pp, bb, indent, flags);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -3072,15 +3072,15 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
INDENT (curr_indent);
- pp_gimple_stmt_1 (buffer, stmt, curr_indent, flags);
- pp_newline_and_flush (buffer);
+ pp_gimple_stmt_1 (pp, stmt, curr_indent, flags);
+ pp_newline_and_flush (pp);
gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
- pp_buffer (buffer)->stream, stmt);
+ pp_buffer (pp)->stream, stmt);
}
- dump_implicit_edges (buffer, bb, indent, flags);
- pp_flush (buffer);
+ dump_implicit_edges (pp, bb, indent, flags);
+ pp_flush (pp);
}
@@ -3093,10 +3093,10 @@ gimple_dump_bb (FILE *file, basic_block bb, int indent, dump_flags_t flags)
dump_gimple_bb_header (file, bb, indent, flags);
if (bb->index >= NUM_FIXED_BLOCKS)
{
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- gimple_dump_bb_buff (&buffer, bb, indent, flags);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ gimple_dump_bb_buff (&pp, bb, indent, flags);
}
dump_gimple_bb_footer (file, bb, indent, flags);
}
diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 7d38ed631d73..4e1acf04d442 100644
--- a/gcc/print-tree.cc
+++ b/gcc/print-tree.cc
@@ -954,11 +954,11 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
indent_to (file, indent + 4);
fprintf (file, "def_stmt ");
{
- pretty_printer buffer;
- buffer.buffer->stream = file;
- pp_gimple_stmt_1 (&buffer, SSA_NAME_DEF_STMT (node), indent + 4,
+ pretty_printer pp;
+ pp.buffer->stream = file;
+ pp_gimple_stmt_1 (&pp, SSA_NAME_DEF_STMT (node), indent + 4,
TDF_NONE);
- pp_flush (&buffer);
+ pp_flush (&pp);
}
indent_to (file, indent + 4);
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 4d1ed234fcbe..83324086c85b 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -345,9 +345,9 @@ static void
dot_rdg_1 (FILE *file, struct graph *rdg)
{
int i;
- pretty_printer buffer;
- pp_needs_newline (&buffer) = false;
- buffer.buffer->stream = file;
+ pretty_printer pp;
+ pp_needs_newline (&pp) = false;
+ pp.buffer->stream = file;
fprintf (file, "digraph RDG {\n");
@@ -357,8 +357,8 @@ dot_rdg_1 (FILE *file, struct graph *rdg)
struct graph_edge *e;
fprintf (file, "%d [label=\"[%d] ", i, i);
- pp_gimple_stmt_1 (&buffer, RDGV_STMT (v), 0, TDF_SLIM);
- pp_flush (&buffer);
+ pp_gimple_stmt_1 (&pp, RDGV_STMT (v), 0, TDF_SLIM);
+ pp_flush (&pp);
fprintf (file, "\"]\n");
/* Highlight reads from memory. */
diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h
index 0da6242629b7..c5089f82cf6a 100644
--- a/gcc/tree-pretty-print.h
+++ b/gcc/tree-pretty-print.h
@@ -56,6 +56,6 @@ extern void print_call_name (pretty_printer *, tree, dump_flags_t);
extern void pp_tree_identifier (pretty_printer *, tree);
extern void dump_function_header (FILE *, tree, dump_flags_t);
extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
-extern void dump_location (pretty_printer *buffer, location_t loc);
+extern void dump_location (pretty_printer *pp, location_t loc);
#endif /* ! GCC_TREE_PRETTY_PRINT_H */
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index dbb4f81ae3c4..45400306d647 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -282,23 +282,23 @@ vrange::operator== (const vrange &src) const
void
vrange::dump (FILE *file) const
{
- pretty_printer buffer;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- vrange_printer vrange_pp (&buffer);
+ pretty_printer pp;
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ vrange_printer vrange_pp (&pp);
this->accept (vrange_pp);
- pp_flush (&buffer);
+ pp_flush (&pp);
}
void
irange_bitmask::dump (FILE *file) const
{
char buf[WIDE_INT_PRINT_BUFFER_SIZE], *p;
- pretty_printer buffer;
+ pretty_printer pp;
- pp_needs_newline (&buffer) = true;
- buffer.buffer->stream = file;
- pp_string (&buffer, "MASK ");
+ pp_needs_newline (&pp) = true;
+ pp.buffer->stream = file;
+ pp_string (&pp, "MASK ");
unsigned len_mask, len_val;
if (print_hex_buf_size (m_mask, &len_mask)
| print_hex_buf_size (m_value, &len_val))
@@ -306,11 +306,11 @@ irange_bitmask::dump (FILE *file) const
else
p = buf;
print_hex (m_mask, p);
- pp_string (&buffer, p);
- pp_string (&buffer, " VALUE ");
+ pp_string (&pp, p);
+ pp_string (&pp, " VALUE ");
print_hex (m_value, p);
- pp_string (&buffer, p);
- pp_flush (&buffer);
+ pp_string (&pp, p);
+ pp_flush (&pp);
}
namespace inchash
--
2.26.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed 2/3] pretty_printer: make all fields private
2024-06-12 13:37 [pushed 1/3] pretty_printer: rename instances named "buffer" to "pp" David Malcolm
@ 2024-06-12 13:37 ` David Malcolm
2024-06-12 13:37 ` [pushed 3/3] pretty_printer: convert chunk_info into a class David Malcolm
1 sibling, 0 replies; 3+ messages in thread
From: David Malcolm @ 2024-06-12 13:37 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
No functional change intended.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
Pushed to trunk as r15-1209-gc5e3be456888aa.
gcc/analyzer/ChangeLog:
* access-diagram.cc (access_range::dump): Update for fields of
pretty_printer becoming private.
* call-details.cc (call_details::dump): Likewise.
* call-summary.cc (call_summary::dump): Likewise.
(call_summary_replay::dump): Likewise.
* checker-event.cc (checker_event::debug): Likewise.
* constraint-manager.cc (range::dump): Likewise.
(bounded_range::dump): Likewise.
(constraint_manager::dump): Likewise.
* engine.cc (exploded_node::dump): Likewise.
(exploded_path::dump): Likewise.
(exploded_path::dump_to_file): Likewise.
* feasible-graph.cc (feasible_graph::dump_feasible_path): Likewise.
* program-point.cc (program_point::dump): Likewise.
* program-state.cc (extrinsic_state::dump_to_file): Likewise.
(sm_state_map::dump): Likewise.
(program_state::dump_to_file): Likewise.
* ranges.cc (symbolic_byte_offset::dump): Likewise.
(symbolic_byte_range::dump): Likewise.
* record-layout.cc (record_layout::dump): Likewise.
* region-model-reachability.cc (reachable_regions::dump): Likewise.
* region-model.cc (region_to_value_map::dump): Likewise.
(region_model::dump): Likewise.
(model_merger::dump): Likewise.
* region-model.h (one_way_id_map<T>::dump): Likewise.
* region.cc (region_offset::dump): Likewise.
(region::dump): Likewise.
* sm-malloc.cc (deallocator_set::dump): Likewise.
* store.cc (uncertainty_t::dump): Likewise.
(binding_key::dump): Likewise.
(bit_range::dump): Likewise.
(byte_range::dump): Likewise.
(binding_map::dump): Likewise.
(binding_cluster::dump): Likewise.
(store::dump): Likewise.
* supergraph.cc (supergraph::dump_dot_to_file): Likewise.
(superedge::dump): Likewise.
* svalue.cc (svalue::dump): Likewise.
gcc/c-family/ChangeLog:
* c-ada-spec.cc (dump_ads): Update for fields of pretty_printer
becoming private.
* c-pretty-print.cc: Likewise throughout.
gcc/c/ChangeLog:
* c-objc-common.cc (print_type): Update for fields of
pretty_printer becoming private.
(c_tree_printer): Likewise.
gcc/cp/ChangeLog:
* cxx-pretty-print.cc: Update throughout for fields of
pretty_printer becoming private.
* error.cc: Likewise.
gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::urls_init): Update for fields
of pretty_printer becoming private.
(diagnostic_context::print_any_cwe): Likewise.
(diagnostic_context::print_any_rules): Likewise.
(diagnostic_context::print_option_information): Likewise.
* diagnostic.h (diagnostic_format_decoder): Likewise.
(diagnostic_prefixing_rule): Likewise, fixing typo.
* digraph.cc (test_dump_to_dot): Likewise.
* digraph.h (digraph<GraphTraits>::dump_dot_to_file): Likewise.
* dumpfile.cc
(dump_pretty_printer::emit_any_pending_textual_chunks): Likewise.
* gimple-pretty-print.cc (print_gimple_stmt): Likewise.
(print_gimple_expr): Likewise.
(print_gimple_seq): Likewise.
(dump_ssaname_info_to_file): Likewise.
(gimple_dump_bb): Likewise.
* graph.cc (print_graph_cfg): Likewise.
(start_graph_dump): Likewise.
* langhooks.cc (lhd_print_error_function): Likewise.
* lto-wrapper.cc (print_lto_docs_link): Likewise.
* pretty-print.cc (pp_set_real_maximum_length): Convert to...
(pretty_printer::set_real_maximum_length): ...this.
(pp_clear_state): Convert to...
(pretty_printer::clear_state): ...this.
(pp_wrap_text): Update for pp_remaining_character_count_for_line
becoming a member function.
(urlify_quoted_string): Update for fields of pretty_printer becoming
private.
(pp_format): Convert to...
(pretty_printer::format): ...this. Reduce the scope of local
variables "old_line_length" and "old_wrapping_mode" and make
const. Reduce the scope of locals "args", "new_chunk_array",
"curarg", "any_unnumbered", and "any_numbered".
(pp_output_formatted_text): Update for fields of pretty_printer
becoming private.
(pp_flush): Likewise.
(pp_really_flush): Likewise.
(pp_set_line_maximum_length): Likewise.
(pp_set_prefix): Convert to...
(pretty_printer::set_prefix): ...this.
(pp_take_prefix): Update for fields of pretty_printer gaining
"m_" prefixes.
(pp_destroy_prefix): Likewise.
(pp_emit_prefix): Convert to...
(pretty_printer::emit_prefix): ...this.
(pretty_printer::pretty_printer): Update both ctors for fields
gaining "m_" prefixes.
(pretty_printer::~pretty_printer): Likewise for dtor.
(pp_append_text): Update for pp_emit_prefix becoming
pretty_printer::emit_prefix.
(pp_remaining_character_count_for_line): Convert to...
(pretty_printer::remaining_character_count_for_line): ...this.
(pp_character): Update for above change.
(pp_maybe_space): Convert to...
(pretty_printer::maybe_space): ...this.
(pp_begin_url): Convert to...
(pretty_printer::begin_url): ...this.
(get_end_url_string): Update for fields of pretty_printer
becoming private.
(pp_end_url): Convert to...
(pretty_printer::end_url): ...this.
(selftest::test_pretty_printer::test_pretty_printer): Update for
fields of pretty_printer becoming private.
(selftest::test_urls): Likewise.
(selftest::test_null_urls): Likewise.
(selftest::test_urlification): Likewise.
* pretty-print.h (pp_line_cutoff): Convert from macro to inline
function.
(pp_prefixing_rule): Likewise.
(pp_wrapping_mode): Likewise.
(pp_format_decoder): Likewise.
(pp_needs_newline): Likewise.
(pp_indentation): Likewise.
(pp_translate_identifiers): Likewise.
(pp_show_color): Likewise.
(pp_buffer): Likewise.
(pp_get_prefix): Add forward decl to allow friend decl.
(pp_take_prefix): Likewise.
(pp_destroy_prefix): Likewise.
(class pretty_printer): Fix typo in leading comment. Add
"friend" decls for the various new accessor functions that were
formerly macros and for pp_get_prefix, pp_take_prefix, and
pp_destroy_prefix. Make all fields private.
(pretty_printer::set_output_stream): New.
(pretty_printer::set_prefix): New decl.
(pretty_printer::emit_prefix): New decl.
(pretty_printer::format): New decl.
(pretty_printer::maybe_space): New decl.
(pretty_printer::supports_urls_p): New.
(pretty_printer::get_url_format): New.
(pretty_printer::set_url_format): New.
(pretty_printer::begin_url): New decl.
(pretty_printer::end_url): New decl.
(pretty_printer::set_verbatim_wrapping): New.
(pretty_printer::set_padding): New.
(pretty_printer::get_padding): New.
(pretty_printer::clear_state): New decl.
(pretty_printer::set_real_maximum_length): New decl.
(pretty_printer::remaining_character_count_for_line): New decl.
(pretty_printer::buffer): Rename to...
(pretty_printer::m_buffer): ...this.
(pretty_printer::prefix): Rename to...
(pretty_printer::m_prefix): ...this;
(pretty_printer::padding): Rename to...
(pretty_printer::m_padding): ...this;
(pretty_printer::maximum_length): Rename to...
(pretty_printer::m_maximum_length): ...this;
(pretty_printer::indent_skip): Rename to...
(pretty_printer::m_indent_skip): ...this;
(pretty_printer::wrapping): Rename to...
(pretty_printer::m_wrapping): ...this;
(pretty_printer::format_decoder): Rename to...
(pretty_printer::m_format_decoder): ...this;
(pretty_printer::emitted_prefix): Rename to...
(pretty_printer::m_emitted_prefix): ...this;
(pretty_printer::need_newline): Rename to...
(pretty_printer::m_need_newline): ...this;
(pretty_printer::translate_identifiers): Rename to...
(pretty_printer::m_translate_identifiers): ...this;
(pretty_printer::show_color): Rename to...
(pretty_printer::m_show_color): ...this;
(pretty_printer::url_format): Rename to...
(pretty_printer::m_url_format): ...this;
(pp_get_prefix): Reformat.
(pp_format_postprocessor): New inline function.
(pp_take_prefix): Move decl to before class pretty_printer.
(pp_destroy_prefix): Likewise.
(pp_set_prefix): Convert to inline function.
(pp_emit_prefix): Convert to inline function.
(pp_format): Convert to inline function.
(pp_maybe_space): Convert to inline function.
(pp_begin_url): Convert to inline function.
(pp_end_url): Convert to inline function.
(pp_set_verbatim_wrapping): Convert from macro to inline
function, renaming...
(pp_set_verbatim_wrapping_): ...this.
* print-rtl.cc (dump_value_slim): Update for fields of
pretty_printer becoming private.
(dump_insn_slim): Likewise.
(dump_rtl_slim): Likewise.
* print-tree.cc (print_node): Likewise.
* sched-rgn.cc (dump_rgn_dependencies_dot): Likewise.
* text-art/canvas.cc (canvas::print_to_pp): Likewise.
(canvas::debug): Likewise.
(selftest::test_canvas_urls): Likewise.
* text-art/dump.h (dump_to_file): Likewise.
* text-art/selftests.cc (selftest::assert_canvas_streq): Likewise.
* text-art/style.cc (style::print_changes): Likewise.
* text-art/styled-string.cc (styled_string::from_fmt_va):
Likewise.
* tree-diagnostic-path.cc (control_flow_tests): Update for
pp_show_color becoming an inline function.
* tree-loop-distribution.cc (dot_rdg_1): Update for fields of
pretty_printer becoming private.
* tree-pretty-print.cc (maybe_init_pretty_print): Likewise.
* value-range.cc (vrange::dump): Likewise.
(irange_bitmask::dump): Likewise.
gcc/fortran/ChangeLog:
* error.cc (gfc_clear_pp_buffer): Likewise.
(gfc_warning): Likewise.
(gfc_warning_check): Likewise.
(gfc_error_opt): Likewise.
(gfc_error_check): Likewise.
gcc/jit/ChangeLog:
* jit-recording.cc (recording::function::dump_to_dot): Update for
fields of pretty_printer becoming private.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info):
Update for fields of pretty_printer becoming private.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
gcc/analyzer/access-diagram.cc | 2 +-
gcc/analyzer/call-details.cc | 2 +-
gcc/analyzer/call-summary.cc | 4 +-
gcc/analyzer/checker-event.cc | 2 +-
gcc/analyzer/constraint-manager.cc | 8 +-
gcc/analyzer/engine.cc | 6 +-
gcc/analyzer/feasible-graph.cc | 2 +-
gcc/analyzer/program-point.cc | 2 +-
gcc/analyzer/program-state.cc | 6 +-
gcc/analyzer/ranges.cc | 4 +-
gcc/analyzer/record-layout.cc | 2 +-
gcc/analyzer/region-model-reachability.cc | 2 +-
gcc/analyzer/region-model.cc | 6 +-
gcc/analyzer/region-model.h | 2 +-
gcc/analyzer/region.cc | 4 +-
gcc/analyzer/sm-malloc.cc | 2 +-
gcc/analyzer/store.cc | 14 +-
gcc/analyzer/supergraph.cc | 4 +-
gcc/analyzer/svalue.cc | 2 +-
gcc/c-family/c-ada-spec.cc | 2 +-
gcc/c-family/c-pretty-print.cc | 36 +-
gcc/c/c-objc-common.cc | 4 +-
gcc/cp/cxx-pretty-print.cc | 12 +-
gcc/cp/error.cc | 37 +-
gcc/diagnostic.cc | 14 +-
gcc/diagnostic.h | 6 +-
gcc/digraph.cc | 2 +-
gcc/digraph.h | 2 +-
gcc/dumpfile.cc | 1 +
gcc/fortran/error.cc | 30 +-
gcc/gimple-pretty-print.cc | 10 +-
gcc/graph.cc | 4 +-
gcc/jit/jit-recording.cc | 2 +-
gcc/langhooks.cc | 3 +-
gcc/lto-wrapper.cc | 4 +-
gcc/pretty-print.cc | 339 +++++++++---------
gcc/pretty-print.h | 263 +++++++++++---
gcc/print-rtl.cc | 6 +-
gcc/print-tree.cc | 2 +-
gcc/sched-rgn.cc | 2 +-
.../gcc.dg/plugin/analyzer_cpython_plugin.c | 2 +-
gcc/text-art/canvas.cc | 10 +-
gcc/text-art/dump.h | 2 +-
gcc/text-art/selftests.cc | 2 +-
gcc/text-art/style.cc | 4 +-
gcc/text-art/styled-string.cc | 2 +-
gcc/tree-diagnostic-path.cc | 2 +-
gcc/tree-loop-distribution.cc | 2 +-
gcc/tree-pretty-print.cc | 2 +-
gcc/value-range.cc | 4 +-
50 files changed, 516 insertions(+), 373 deletions(-)
diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc
index 8d7461fe381d..cb5b656c164a 100644
--- a/gcc/analyzer/access-diagram.cc
+++ b/gcc/analyzer/access-diagram.cc
@@ -547,7 +547,7 @@ access_range::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/call-details.cc b/gcc/analyzer/call-details.cc
index fda925edb968..116ab40afaf5 100644
--- a/gcc/analyzer/call-details.cc
+++ b/gcc/analyzer/call-details.cc
@@ -366,7 +366,7 @@ call_details::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/call-summary.cc b/gcc/analyzer/call-summary.cc
index 46b4e2a3bbd7..ec36fdfd9f1a 100644
--- a/gcc/analyzer/call-summary.cc
+++ b/gcc/analyzer/call-summary.cc
@@ -149,7 +149,7 @@ call_summary::dump (const extrinsic_state &ext_state,
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (ext_state, &pp, simple);
pp_flush (&pp);
}
@@ -890,7 +890,7 @@ call_summary_replay::dump (FILE *fp, bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, simple);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/checker-event.cc b/gcc/analyzer/checker-event.cc
index ee3ceb407ea1..593f364e1d66 100644
--- a/gcc/analyzer/checker-event.cc
+++ b/gcc/analyzer/checker-event.cc
@@ -199,7 +199,7 @@ checker_event::debug () const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump (&pp);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc
index 883f33b2cdd7..a9d58c9cdcf5 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -185,7 +185,7 @@ range::dump () const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_newline (&pp);
pp_flush (&pp);
@@ -448,7 +448,7 @@ bounded_range::dump (bool show_types) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, show_types);
pp_newline (&pp);
pp_flush (&pp);
@@ -721,7 +721,7 @@ bounded_ranges::dump (bool show_types) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, show_types);
pp_newline (&pp);
pp_flush (&pp);
@@ -1772,7 +1772,7 @@ constraint_manager::dump (FILE *fp) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, true);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 30c0913c861d..f5fad5b2e470 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -1422,7 +1422,7 @@ exploded_node::dump (FILE *fp,
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, ext_state);
pp_flush (&pp);
}
@@ -4832,7 +4832,7 @@ exploded_path::dump (FILE *fp, const extrinsic_state *ext_state) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, ext_state);
pp_flush (&pp);
}
@@ -4856,7 +4856,7 @@ exploded_path::dump_to_file (const char *filename,
return;
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, &ext_state);
pp_flush (&pp);
fclose (fp);
diff --git a/gcc/analyzer/feasible-graph.cc b/gcc/analyzer/feasible-graph.cc
index a1812231572c..35b489fde357 100644
--- a/gcc/analyzer/feasible-graph.cc
+++ b/gcc/analyzer/feasible-graph.cc
@@ -301,7 +301,7 @@ feasible_graph::dump_feasible_path (const feasible_node &dst_fnode,
FILE *fp = fopen (filename, "w");
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_feasible_path (dst_fnode, &pp);
pp_flush (&pp);
fclose (fp);
diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index 14ce5be4bcf9..ea15ccc91d27 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -302,7 +302,7 @@ program_point::dump () const
{
pretty_printer pp;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
print (&pp, format (true));
pp_flush (&pp);
}
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index efaf569a4906..cb9c38880029 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -86,7 +86,7 @@ extrinsic_state::dump_to_file (FILE *outf) const
pretty_printer pp;
if (outf == stderr)
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = outf;
+ pp.set_output_stream (outf);
dump_to_pp (&pp);
pp_flush (&pp);
}
@@ -274,7 +274,7 @@ sm_state_map::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
print (NULL, simple, true, &pp);
pp_newline (&pp);
pp_flush (&pp);
@@ -1169,7 +1169,7 @@ program_state::dump_to_file (const extrinsic_state &ext_state,
pp_format_decoder (&pp) = default_tree_printer;
if (outf == stderr)
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = outf;
+ pp.set_output_stream (outf);
dump_to_pp (ext_state, summarize, multiline, &pp);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/ranges.cc b/gcc/analyzer/ranges.cc
index f591efae43af..17d6e6b2212d 100644
--- a/gcc/analyzer/ranges.cc
+++ b/gcc/analyzer/ranges.cc
@@ -98,7 +98,7 @@ symbolic_byte_offset::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
@@ -157,7 +157,7 @@ symbolic_byte_range::dump (bool simple, region_model_manager &mgr) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple, mgr);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/record-layout.cc b/gcc/analyzer/record-layout.cc
index af3115518489..59690a43b76e 100644
--- a/gcc/analyzer/record-layout.cc
+++ b/gcc/analyzer/record-layout.cc
@@ -85,7 +85,7 @@ record_layout::dump () const
{
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/region-model-reachability.cc b/gcc/analyzer/region-model-reachability.cc
index b9887902980f..828e3fcbadac 100644
--- a/gcc/analyzer/region-model-reachability.cc
+++ b/gcc/analyzer/region-model-reachability.cc
@@ -350,7 +350,7 @@ reachable_regions::dump () const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 1a44ff073bd3..7969055a59cd 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -226,7 +226,7 @@ region_to_value_map::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple, true);
pp_newline (&pp);
pp_flush (&pp);
@@ -486,7 +486,7 @@ region_model::dump (FILE *fp, bool simple, bool multiline) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, simple, multiline);
pp_newline (&pp);
pp_flush (&pp);
@@ -7400,7 +7400,7 @@ model_merger::dump (FILE *fp, bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_to_pp (&pp, simple);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index 912b558a18dd..f57d2069b3b1 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -123,7 +123,7 @@ DEBUG_FUNCTION inline void
one_way_id_map<T>::dump () const
{
pretty_printer pp;
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_flush (&pp);
}
diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc
index d5cfd476fd8a..2eabda41941d 100644
--- a/gcc/analyzer/region.cc
+++ b/gcc/analyzer/region.cc
@@ -141,7 +141,7 @@ region_offset::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
@@ -1018,7 +1018,7 @@ region::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 8bdcb4bc33cd..f1ec04d117d0 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -586,7 +586,7 @@ deallocator_set::dump () const
{
pretty_printer pp;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 5a33d740ce2b..f58b84ef9461 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -110,7 +110,7 @@ uncertainty_t::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
@@ -147,7 +147,7 @@ binding_key::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
@@ -231,7 +231,7 @@ DEBUG_FUNCTION void
bit_range::dump () const
{
pretty_printer pp;
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_newline (&pp);
pp_flush (&pp);
@@ -507,7 +507,7 @@ DEBUG_FUNCTION void
byte_range::dump () const
{
pretty_printer pp;
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp);
pp_newline (&pp);
pp_flush (&pp);
@@ -776,7 +776,7 @@ binding_map::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple, true);
pp_newline (&pp);
pp_flush (&pp);
@@ -1403,7 +1403,7 @@ binding_cluster::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
pp_string (&pp, " cluster for: ");
m_base_region->dump_to_pp (&pp, simple);
pp_string (&pp, ": ");
@@ -2639,7 +2639,7 @@ store::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple, true, NULL);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index adbf90f17ede..4dc7942b26aa 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -443,7 +443,7 @@ supergraph::dump_dot_to_file (FILE *fp, const dump_args_t &dump_args) const
trying to prettify things by showing the underlying var. */
pp_format_decoder (pp) = default_tree_printer;
- pp->buffer->stream = fp;
+ pp->set_output_stream (fp);
dump_dot_to_pp (pp, dump_args);
pp_flush (pp);
delete pp;
@@ -902,7 +902,7 @@ superedge::dump () const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump (&pp);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc
index b67780a5ef12..cad6b7dd3cd8 100644
--- a/gcc/analyzer/svalue.cc
+++ b/gcc/analyzer/svalue.cc
@@ -89,7 +89,7 @@ svalue::dump (bool simple) const
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
dump_to_pp (&pp, simple);
pp_newline (&pp);
pp_flush (&pp);
diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index e0e72493151b..a41e93aeafb8 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -3556,7 +3556,7 @@ dump_ads (const char *source_file,
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = f;
+ pp.set_output_stream (f);
/* Dump all relevant macros. */
dump_ada_macros (&pp, source_file);
diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc
index da7934d783a5..dd7eba123943 100644
--- a/gcc/c-family/c-pretty-print.cc
+++ b/gcc/c-family/c-pretty-print.cc
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
#define pp_c_maybe_whitespace(PP) \
do { \
- if ((PP)->padding == pp_before) \
+ if ((PP)->get_padding () == pp_before) \
pp_c_whitespace (PP); \
} while (0)
@@ -76,98 +76,98 @@ void
pp_c_whitespace (c_pretty_printer *pp)
{
pp_space (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_left_paren (c_pretty_printer *pp)
{
pp_left_paren (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_right_paren (c_pretty_printer *pp)
{
pp_right_paren (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_left_brace (c_pretty_printer *pp)
{
pp_left_brace (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_right_brace (c_pretty_printer *pp)
{
pp_right_brace (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_left_bracket (c_pretty_printer *pp)
{
pp_left_bracket (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_right_bracket (c_pretty_printer *pp)
{
pp_right_bracket (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_dot (c_pretty_printer *pp)
{
pp_dot (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_ampersand (c_pretty_printer *pp)
{
pp_ampersand (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_star (c_pretty_printer *pp)
{
pp_star (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_arrow (c_pretty_printer *pp)
{
pp_arrow (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_semicolon (c_pretty_printer *pp)
{
pp_semicolon (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_complement (c_pretty_printer *pp)
{
pp_complement (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
pp_c_exclamation (c_pretty_printer *pp)
{
pp_exclamation (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
/* Print out the external representation of QUALIFIERS. */
@@ -1307,7 +1307,7 @@ pp_c_ws_string (c_pretty_printer *pp, const char *str)
{
pp_c_maybe_whitespace (pp);
pp_string (pp, str);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
}
void
@@ -1328,7 +1328,7 @@ pp_c_identifier (c_pretty_printer *pp, const char *id)
{
pp_c_maybe_whitespace (pp);
pp_identifier (pp, id);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
}
/* Pretty-print a C primary-expression.
@@ -2985,7 +2985,7 @@ print_c_tree (FILE *file, tree t)
c_pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp.statement (t);
pp_newline_and_flush (&pp);
}
diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc
index 738e899a2a93..1025e0e1c7b9 100644
--- a/gcc/c/c-objc-common.cc
+++ b/gcc/c/c-objc-common.cc
@@ -252,7 +252,7 @@ print_type (c_pretty_printer *cpp, tree t, bool *quoted)
c_pretty_printer cpp2;
/* Print the stripped version into a temporary printer. */
cpp2.type_id (aka_type);
- struct obstack *ob2 = cpp2.buffer->obstack;
+ struct obstack *ob2 = pp_buffer (&cpp2)->obstack;
/* Get the stripped version from the temporary printer. */
const char *aka = (char *) obstack_base (ob2);
int aka_len = obstack_object_size (ob2);
@@ -301,7 +301,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
tree t = NULL_TREE;
// FIXME: the next cast should be a dynamic_cast, when it is permitted.
c_pretty_printer *cpp = (c_pretty_printer *) pp;
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
if (precision != 0 || wide)
return false;
diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc
index c6d8cc84132b..806aebff174b 100644
--- a/gcc/cp/cxx-pretty-print.cc
+++ b/gcc/cp/cxx-pretty-print.cc
@@ -49,7 +49,7 @@ pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c)
if (p != NULL && *p == c)
pp_cxx_whitespace (pp);
pp_character (pp, c);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
#define pp_cxx_expression_list(PP, T) \
@@ -65,7 +65,7 @@ void
pp_cxx_colon_colon (cxx_pretty_printer *pp)
{
pp_colon_colon (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
@@ -84,7 +84,7 @@ void
pp_cxx_separate_with (cxx_pretty_printer *pp, int c)
{
pp_separate_with (pp, c);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
/* Expressions. */
@@ -1702,7 +1702,7 @@ cxx_pretty_printer::direct_declarator (tree t)
if (DECL_IOBJ_MEMBER_FUNCTION_P (t))
{
- padding = pp_before;
+ set_padding (pp_before);
pp_cxx_cv_qualifier_seq (this, pp_cxx_implicit_parameter_type (t));
}
@@ -1859,7 +1859,7 @@ cxx_pretty_printer::direct_abstract_declarator (tree t)
direct_abstract_declarator (TREE_TYPE (t));
if (TREE_CODE (t) == METHOD_TYPE)
{
- padding = pp_before;
+ set_padding (pp_before);
pp_cxx_cv_qualifier_seq (this, class_of_this_parm (t));
}
pp_cxx_exception_specification (this, t);
@@ -2685,7 +2685,7 @@ pp_cxx_requires_clause (cxx_pretty_printer *pp, tree t)
{
if (!t)
return;
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_ws_string (pp, "requires");
pp_space (pp);
pp->expression (t);
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 0ff7f9d4c468..01ad794df8e3 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -180,7 +180,7 @@ cxx_initialize_diagnostics (diagnostic_context *context)
diagnostic_starter (context) = cp_diagnostic_starter;
/* diagnostic_finalizer is already c_diagnostic_finalizer. */
diagnostic_format_decoder (context) = cp_printer;
- pp->m_format_postprocessor = new cxx_format_postprocessor ();
+ pp_format_postprocessor (pp) = new cxx_format_postprocessor ();
}
/* Dump an '@module' name suffix for DECL, if any. */
@@ -210,7 +210,7 @@ dump_module_suffix (cxx_pretty_printer *pp, tree decl)
if (const char *n = module_name (m, false))
{
pp_character (pp, '@');
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
pp_string (pp, n);
}
}
@@ -921,7 +921,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
else
pp_ampersand (pp);
}
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifier_seq (pp, t);
}
break;
@@ -939,7 +939,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
}
pp_cxx_star (pp);
pp_cxx_cv_qualifier_seq (pp, t);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
break;
/* This can be reached without a pointer when dealing with
@@ -986,7 +986,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
case FIXED_POINT_TYPE:
case NULLPTR_TYPE:
dump_type (pp, t, flags);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
break;
default:
@@ -1035,7 +1035,7 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
anyway; they may in g++, but we'll just pretend otherwise. */
dump_parameters (pp, arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifiers (pp, type_memfn_quals (t),
TREE_CODE (t) == FUNCTION_TYPE
&& (flags & TFF_POINTER));
@@ -1049,7 +1049,7 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
{
pp_space (pp);
pp_c_attributes_display (pp, TYPE_ATTRIBUTES (t));
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
}
dump_type_suffix (pp, TREE_TYPE (t), flags);
break;
@@ -1720,13 +1720,13 @@ dump_lambda_function (cxx_pretty_printer *pp,
/* Early escape. */;
else if (TREE_CODE (TREE_TYPE (fn)) == FUNCTION_TYPE)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_c_ws_string (pp, "static");
}
else if (!(TYPE_QUALS (class_of_this_parm (TREE_TYPE (fn)))
& TYPE_QUAL_CONST))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_c_ws_string (pp, "mutable");
}
dump_substitution (pp, fn, template_parms, template_args, flags);
@@ -1845,20 +1845,20 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags)
if (TREE_CODE (fntype) == METHOD_TYPE)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifier_seq (pp, class_of_this_parm (fntype));
dump_ref_qualifier (pp, fntype, flags);
}
if (tx_safe_fn_type_p (fntype))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_ws_string (pp, "transaction_safe");
}
if (flags & TFF_EXCEPTION_SPECIFICATION)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
dump_exception_spec (pp, exceptions, flags);
}
@@ -1952,7 +1952,7 @@ dump_ref_qualifier (cxx_pretty_printer *pp, tree t, int flags ATTRIBUTE_UNUSED)
{
if (FUNCTION_REF_QUALIFIED (t))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
if (FUNCTION_RVALUE_QUALIFIED (t))
pp_cxx_ws_string (pp, "&&");
else
@@ -3156,7 +3156,7 @@ static void
reinit_cxx_pp (void)
{
pp_clear_output_area (cxx_pp);
- cxx_pp->padding = pp_none;
+ cxx_pp->set_padding (pp_none);
pp_indentation (cxx_pp) = 0;
pp_needs_newline (cxx_pp) = false;
pp_show_color (cxx_pp) = false;
@@ -3537,7 +3537,7 @@ static const char *
cv_to_string (tree p, int v)
{
reinit_cxx_pp ();
- cxx_pp->padding = v ? pp_before : pp_none;
+ cxx_pp->set_padding (v ? pp_before : pp_none);
pp_cxx_cv_qualifier_seq (cxx_pp, p);
return pp_ggc_formatted_text (cxx_pp);
}
@@ -3682,8 +3682,7 @@ cp_print_error_function (diagnostic_context *context,
pp_newline (context->printer);
diagnostic_set_last_function (context, diagnostic);
- pp_destroy_prefix (context->printer);
- context->printer->prefix = old_prefix;
+ context->printer->set_prefix (old_prefix);
}
}
@@ -4470,9 +4469,9 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool verbose,
bool *quoted, const char **buffer_ptr)
{
- gcc_assert (pp->m_format_postprocessor);
+ gcc_assert (pp_format_postprocessor (pp));
cxx_format_postprocessor *postprocessor
- = static_cast <cxx_format_postprocessor *> (pp->m_format_postprocessor);
+ = static_cast <cxx_format_postprocessor *> (pp_format_postprocessor (pp));
const char *result;
tree t = NULL;
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 1b4def06f726..9d0cb8ea051c 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -342,8 +342,8 @@ diagnostic_context::urls_init (int value)
value = DIAGNOSTICS_URLS_DEFAULT;
}
- this->printer->url_format
- = determine_url_format ((diagnostic_url_rule_t) value);
+ this->printer->set_url_format
+ (determine_url_format ((diagnostic_url_rule_t) value));
}
/* Create the file_cache, if not already created, and tell it how to
@@ -1354,7 +1354,7 @@ diagnostic_context::print_any_cwe (const diagnostic_info &diagnostic)
pp_string (pp, " [");
pp_string (pp, colorize_start (pp_show_color (pp),
diagnostic_kind_color[diagnostic.kind]));
- if (pp->url_format != URL_FORMAT_NONE)
+ if (pp->supports_urls_p ())
{
char *cwe_url = get_cwe_url (cwe);
pp_begin_url (pp, cwe_url);
@@ -1362,7 +1362,7 @@ diagnostic_context::print_any_cwe (const diagnostic_info &diagnostic)
}
pp_printf (pp, "CWE-%i", cwe);
pp_set_prefix (pp, saved_prefix);
- if (pp->url_format != URL_FORMAT_NONE)
+ if (pp->supports_urls_p ())
pp_end_url (pp);
pp_string (pp, colorize_stop (pp_show_color (pp)));
pp_character (pp, ']');
@@ -1394,7 +1394,7 @@ diagnostic_context::print_any_rules (const diagnostic_info &diagnostic)
colorize_start (pp_show_color (pp),
diagnostic_kind_color[diagnostic.kind]));
char *url = NULL;
- if (pp->url_format != URL_FORMAT_NONE)
+ if (pp->supports_urls_p ())
{
url = rule.make_url ();
if (url)
@@ -1402,7 +1402,7 @@ diagnostic_context::print_any_rules (const diagnostic_info &diagnostic)
}
pp_string (pp, desc);
pp_set_prefix (pp, saved_prefix);
- if (pp->url_format != URL_FORMAT_NONE)
+ if (pp->supports_urls_p ())
if (url)
pp_end_url (pp);
free (url);
@@ -1425,7 +1425,7 @@ diagnostic_context::print_option_information (const diagnostic_info &diagnostic,
orig_diag_kind, diagnostic.kind))
{
char *option_url = nullptr;
- if (this->printer->url_format != URL_FORMAT_NONE)
+ if (this->printer->supports_urls_p ())
option_url = make_option_url (diagnostic.option_index);
pretty_printer * const pp = this->printer;
pp_string (pp, " [");
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 4632aac73c6b..9a9571bb76d4 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -842,10 +842,10 @@ diagnostic_finalizer (diagnostic_context *context)
#define diagnostic_info_auxiliary_data(DI) (DI)->x_data
/* Same as pp_format_decoder. Works on 'diagnostic_context *'. */
-#define diagnostic_format_decoder(DC) ((DC)->printer->format_decoder)
+#define diagnostic_format_decoder(DC) pp_format_decoder ((DC)->printer)
-/* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */
-#define diagnostic_prefixing_rule(DC) ((DC)->printer->wrapping.rule)
+/* Same as pp_prefixing_rule. Works on 'diagnostic_context *'. */
+#define diagnostic_prefixing_rule(DC) pp_prefixing_rule ((DC)->printer)
/* Raise SIGABRT on any diagnostic of severity DK_ERROR or higher. */
inline void
diff --git a/gcc/digraph.cc b/gcc/digraph.cc
index 64497f8d9291..b323764a93cd 100644
--- a/gcc/digraph.cc
+++ b/gcc/digraph.cc
@@ -108,7 +108,7 @@ test_dump_to_dot ()
g.add_test_edge (a, b);
pretty_printer pp;
- pp.buffer->stream = NULL;
+ pp.set_output_stream (nullptr);
test_dump_args_t dump_args;
g.dump_dot_to_pp (&pp, NULL, dump_args);
diff --git a/gcc/digraph.h b/gcc/digraph.h
index 33a5055cd9cd..4894d3987ccf 100644
--- a/gcc/digraph.h
+++ b/gcc/digraph.h
@@ -201,7 +201,7 @@ digraph<GraphTraits>::dump_dot_to_file (FILE *fp,
pretty_printer pp;
// TODO:
pp_format_decoder (&pp) = default_tree_printer;
- pp.buffer->stream = fp;
+ pp.set_output_stream (fp);
dump_dot_to_pp (&pp, root_cluster, args);
pp_flush (&pp);
}
diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc
index 1ec44cb58fb7..097f9bcfff21 100644
--- a/gcc/dumpfile.cc
+++ b/gcc/dumpfile.cc
@@ -860,6 +860,7 @@ dump_pretty_printer::emit_items (optinfo *dest)
void
dump_pretty_printer::emit_any_pending_textual_chunks (optinfo *dest)
{
+ output_buffer *const buffer = pp_buffer (this);
gcc_assert (buffer->obstack == &buffer->formatted_obstack);
/* Don't emit an item if the pending text is empty. */
diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc
index 65e38b0e8667..a0e1a1c36844 100644
--- a/gcc/fortran/error.cc
+++ b/gcc/fortran/error.cc
@@ -924,10 +924,10 @@ static void
gfc_clear_pp_buffer (output_buffer *this_buffer)
{
pretty_printer *pp = global_dc->printer;
- output_buffer *tmp_buffer = pp->buffer;
- pp->buffer = this_buffer;
+ output_buffer *tmp_buffer = pp_buffer (pp);
+ pp_buffer (pp) = this_buffer;
pp_clear_output_area (pp);
- pp->buffer = tmp_buffer;
+ pp_buffer (pp) = tmp_buffer;
/* We need to reset last_location, otherwise we may skip caret lines
when we actually give a diagnostic. */
global_dc->m_last_location = UNKNOWN_LOCATION;
@@ -964,13 +964,13 @@ gfc_warning (int opt, const char *gmsgid, va_list ap)
rich_location rich_loc (line_table, UNKNOWN_LOCATION);
bool fatal_errors = global_dc->m_fatal_errors;
pretty_printer *pp = global_dc->printer;
- output_buffer *tmp_buffer = pp->buffer;
+ output_buffer *tmp_buffer = pp_buffer (pp);
gfc_clear_pp_buffer (pp_warning_buffer);
if (buffered_p)
{
- pp->buffer = pp_warning_buffer;
+ pp_buffer (pp) = pp_warning_buffer;
global_dc->m_fatal_errors = false;
/* To prevent -fmax-errors= triggering. */
--werrorcount;
@@ -983,7 +983,7 @@ gfc_warning (int opt, const char *gmsgid, va_list ap)
if (buffered_p)
{
- pp->buffer = tmp_buffer;
+ pp_buffer (pp) = tmp_buffer;
global_dc->m_fatal_errors = fatal_errors;
warningcount_buffered = 0;
@@ -1461,13 +1461,13 @@ gfc_warning_check (void)
if (! gfc_output_buffer_empty_p (pp_warning_buffer))
{
pretty_printer *pp = global_dc->printer;
- output_buffer *tmp_buffer = pp->buffer;
- pp->buffer = pp_warning_buffer;
+ output_buffer *tmp_buffer = pp_buffer (pp);
+ pp_buffer (pp) = pp_warning_buffer;
pp_really_flush (pp);
warningcount += warningcount_buffered;
werrorcount += werrorcount_buffered;
gcc_assert (warningcount_buffered + werrorcount_buffered == 1);
- pp->buffer = tmp_buffer;
+ pp_buffer (pp) = tmp_buffer;
diagnostic_action_after_output (global_dc,
warningcount_buffered
? DK_WARNING : DK_ERROR);
@@ -1502,7 +1502,7 @@ gfc_error_opt (int opt, const char *gmsgid, va_list ap)
rich_location richloc (line_table, UNKNOWN_LOCATION);
bool fatal_errors = global_dc->m_fatal_errors;
pretty_printer *pp = global_dc->printer;
- output_buffer *tmp_buffer = pp->buffer;
+ output_buffer *tmp_buffer = pp_buffer (pp);
gfc_clear_pp_buffer (pp_error_buffer);
@@ -1512,7 +1512,7 @@ gfc_error_opt (int opt, const char *gmsgid, va_list ap)
save abort_on_error and restore it below. */
saved_abort_on_error = global_dc->m_abort_on_error;
global_dc->m_abort_on_error = false;
- pp->buffer = pp_error_buffer;
+ pp_buffer (pp) = pp_error_buffer;
global_dc->m_fatal_errors = false;
/* To prevent -fmax-errors= triggering, we decrease it before
report_diagnostic increases it. */
@@ -1524,7 +1524,7 @@ gfc_error_opt (int opt, const char *gmsgid, va_list ap)
if (buffered_p)
{
- pp->buffer = tmp_buffer;
+ pp_buffer (pp) = tmp_buffer;
global_dc->m_fatal_errors = fatal_errors;
global_dc->m_abort_on_error = saved_abort_on_error;
@@ -1609,12 +1609,12 @@ gfc_error_check (void)
{
error_buffer.flag = false;
pretty_printer *pp = global_dc->printer;
- output_buffer *tmp_buffer = pp->buffer;
- pp->buffer = pp_error_buffer;
+ output_buffer *tmp_buffer = pp_buffer (pp);
+ pp_buffer (pp) = pp_error_buffer;
pp_really_flush (pp);
++errorcount;
gcc_assert (gfc_output_buffer_empty_p (pp_error_buffer));
- pp->buffer = tmp_buffer;
+ pp_buffer (pp) = tmp_buffer;
diagnostic_action_after_output (global_dc, DK_ERROR);
diagnostic_check_max_errors (global_dc, true);
return true;
diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc
index 285d76b35406..8294465fd9f7 100644
--- a/gcc/gimple-pretty-print.cc
+++ b/gcc/gimple-pretty-print.cc
@@ -155,7 +155,7 @@ print_gimple_stmt (FILE *file, gimple *g, int spc, dump_flags_t flags)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp_gimple_stmt_1 (&pp, g, spc, flags);
pp_newline_and_flush (&pp);
}
@@ -186,7 +186,7 @@ print_gimple_expr (FILE *file, gimple *g, int spc, dump_flags_t flags)
flags |= TDF_RHS_ONLY;
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp_gimple_stmt_1 (&pp, g, spc, flags);
pp_flush (&pp);
}
@@ -222,7 +222,7 @@ print_gimple_seq (FILE *file, gimple_seq seq, int spc, dump_flags_t flags)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
dump_gimple_seq (&pp, seq, spc, flags);
pp_newline_and_flush (&pp);
}
@@ -2377,7 +2377,7 @@ dump_ssaname_info_to_file (FILE *file, tree node, int spc)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
dump_ssaname_info (&pp, node, spc);
pp_flush (&pp);
}
@@ -3095,7 +3095,7 @@ gimple_dump_bb (FILE *file, basic_block bb, int indent, dump_flags_t flags)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
gimple_dump_bb_buff (&pp, bb, indent, flags);
}
dump_gimple_bb_footer (file, bb, indent, flags);
diff --git a/gcc/graph.cc b/gcc/graph.cc
index 5689a64b20b4..07da0798f51d 100644
--- a/gcc/graph.cc
+++ b/gcc/graph.cc
@@ -310,7 +310,7 @@ void DEBUG_FUNCTION
print_graph_cfg (FILE *fp, struct function *fun)
{
pretty_printer graph_slim_pp;
- graph_slim_pp.buffer->stream = fp;
+ graph_slim_pp.set_output_stream (fp);
pretty_printer *const pp = &graph_slim_pp;
const char *funcname = function_name (fun);
pp_printf (pp, "subgraph \"cluster_%s\" {\n"
@@ -354,7 +354,7 @@ static void
start_graph_dump (FILE *fp, const char *base)
{
pretty_printer graph_slim_pp;
- graph_slim_pp.buffer->stream = fp;
+ graph_slim_pp.set_output_stream (fp);
pretty_printer *const pp = &graph_slim_pp;
pp_string (pp, "digraph \"");
pp_write_text_to_stream (pp);
diff --git a/gcc/jit/jit-recording.cc b/gcc/jit/jit-recording.cc
index 68a2e860c1fb..24fb1d7ddc9e 100644
--- a/gcc/jit/jit-recording.cc
+++ b/gcc/jit/jit-recording.cc
@@ -4410,7 +4410,7 @@ recording::function::dump_to_dot (const char *path)
return;
pretty_printer the_pp;
- the_pp.buffer->stream = fp;
+ the_pp.set_output_stream (fp);
pretty_printer *pp = &the_pp;
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc
index 94d1f4e5a2c6..61f2b6762565 100644
--- a/gcc/langhooks.cc
+++ b/gcc/langhooks.cc
@@ -466,8 +466,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
diagnostic_set_last_function (context, diagnostic);
pp_newline_and_flush (context->printer);
- context->printer->prefix = old_prefix;
- free ((char*) new_prefix);
+ context->printer->set_prefix (old_prefix);
}
}
diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 6dcf8b469a3c..84835a888ef1 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -1361,11 +1361,11 @@ init_num_threads (void)
void
print_lto_docs_link ()
{
- bool print_url = global_dc->printer->url_format != URL_FORMAT_NONE;
+ bool print_url = global_dc->printer->supports_urls_p ();
const char *url = global_dc->make_option_url (OPT_flto);
pretty_printer pp;
- pp.url_format = URL_FORMAT_DEFAULT;
+ pp.set_url_format (URL_FORMAT_DEFAULT);
pp_string (&pp, "see the ");
if (print_url)
pp_begin_url (&pp, url);
diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index eb59bf424b7c..271cd650c4d1 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -814,34 +814,35 @@ output_buffer::~output_buffer ()
/* Subroutine of pp_set_maximum_length. Set up PRETTY-PRINTER's
internal maximum characters per line. */
-static void
-pp_set_real_maximum_length (pretty_printer *pp)
+
+void
+pretty_printer::set_real_maximum_length ()
{
/* If we're told not to wrap lines then do the obvious thing. In case
we'll emit prefix only once per message, it is appropriate
not to increase unnecessarily the line-length cut-off. */
- if (!pp_is_wrapping_line (pp)
- || pp_prefixing_rule (pp) == DIAGNOSTICS_SHOW_PREFIX_ONCE
- || pp_prefixing_rule (pp) == DIAGNOSTICS_SHOW_PREFIX_NEVER)
- pp->maximum_length = pp_line_cutoff (pp);
+ if (!pp_is_wrapping_line (this)
+ || pp_prefixing_rule (this) == DIAGNOSTICS_SHOW_PREFIX_ONCE
+ || pp_prefixing_rule (this) == DIAGNOSTICS_SHOW_PREFIX_NEVER)
+ m_maximum_length = pp_line_cutoff (this);
else
{
- int prefix_length = pp->prefix ? strlen (pp->prefix) : 0;
+ int prefix_length = m_prefix ? strlen (m_prefix) : 0;
/* If the prefix is ridiculously too long, output at least
32 characters. */
- if (pp_line_cutoff (pp) - prefix_length < 32)
- pp->maximum_length = pp_line_cutoff (pp) + 32;
+ if (pp_line_cutoff (this) - prefix_length < 32)
+ m_maximum_length = pp_line_cutoff (this) + 32;
else
- pp->maximum_length = pp_line_cutoff (pp);
+ m_maximum_length = pp_line_cutoff (this);
}
}
-/* Clear PRETTY-PRINTER's output state. */
-static inline void
-pp_clear_state (pretty_printer *pp)
+/* Clear this pretty_printer's output state. */
+inline void
+pretty_printer::clear_state ()
{
- pp->emitted_prefix = false;
- pp_indentation (pp) = 0;
+ m_emitted_prefix = false;
+ pp_indentation (this) = 0;
}
/* Print X to PP in decimal. */
@@ -1006,7 +1007,7 @@ pp_wrap_text (pretty_printer *pp, const char *start, const char *end)
while (p != end && !ISBLANK (*p) && *p != '\n')
++p;
if (wrapping_line
- && p - start >= pp_remaining_character_count_for_line (pp))
+ && p - start >= pp->remaining_character_count_for_line ())
pp_newline (pp);
pp_append_text (pp, start, p);
start = p;
@@ -1101,7 +1102,7 @@ urlify_quoted_string (pretty_printer *pp,
size_t quoted_text_start_idx,
size_t quoted_text_end_idx)
{
- if (pp->url_format == URL_FORMAT_NONE)
+ if (!pp->supports_urls_p ())
return quoted_text_end_idx;
if (!urlifier)
return quoted_text_end_idx;
@@ -1125,7 +1126,7 @@ urlify_quoted_string (pretty_printer *pp,
/* ...with URLified version of the text. */
/* Begin URL. */
- switch (pp->url_format)
+ switch (pp->get_url_format ())
{
default:
case URL_FORMAT_NONE:
@@ -1305,7 +1306,8 @@ on_end_quote (pretty_printer *pp,
1 up to highest argument; each argument may only be used once.
A format string can have at most 30 arguments. */
-/* Formatting phases 1 and 2: render TEXT->format_spec plus
+/* Implementation of pp_format.
+ Formatting phases 1 and 2: render TEXT->format_spec plus
text->m_args_ptr into a series of chunks in pp_buffer (PP)->args[].
Phase 3 is in pp_output_formatted_text.
@@ -1322,27 +1324,22 @@ on_end_quote (pretty_printer *pp,
are stashed into the output_buffer's m_quotes for use in phase 3. */
void
-pp_format (pretty_printer *pp,
- text_info *text,
- const urlifier *urlifier)
+pretty_printer::format (text_info *text,
+ const urlifier *urlifier)
{
- output_buffer * const buffer = pp_buffer (pp);
- const char *p;
- const char **args;
- struct chunk_info *new_chunk_array;
+ output_buffer * const buffer = m_buffer;
- unsigned int curarg = 0, chunk = 0, argno;
- pp_wrapping_mode_t old_wrapping_mode;
- bool any_unnumbered = false, any_numbered = false;
+ unsigned int chunk = 0, argno;
const char **formatters[PP_NL_ARGMAX];
/* Allocate a new chunk structure. */
- new_chunk_array = XOBNEW (&buffer->chunk_obstack, struct chunk_info);
+ struct chunk_info *new_chunk_array
+ = XOBNEW (&buffer->chunk_obstack, struct chunk_info);
new_chunk_array->prev = buffer->cur_chunk_array;
new_chunk_array->m_quotes = nullptr;
buffer->cur_chunk_array = new_chunk_array;
- args = new_chunk_array->args;
+ const char **args = new_chunk_array->args;
/* Formatting phase 1: split up TEXT->format_spec into chunks in
pp_buffer (PP)->args[]. Even-numbered chunks are to be output
@@ -1352,7 +1349,9 @@ pp_format (pretty_printer *pp,
memset (formatters, 0, sizeof formatters);
- for (p = text->m_format_spec; *p; )
+ unsigned int curarg = 0;
+ bool any_unnumbered = false, any_numbered = false;
+ for (const char *p = text->m_format_spec; *p; )
{
while (*p != '\0' && *p != '%')
{
@@ -1377,8 +1376,7 @@ pp_format (pretty_printer *pp,
{
obstack_grow (&buffer->chunk_obstack,
open_quote, strlen (open_quote));
- const char *colorstr
- = colorize_start (pp_show_color (pp), "quote");
+ const char *colorstr = colorize_start (m_show_color, "quote");
obstack_grow (&buffer->chunk_obstack, colorstr, strlen (colorstr));
p++;
@@ -1388,9 +1386,9 @@ pp_format (pretty_printer *pp,
case '>':
{
- on_end_quote (pp, *buffer, chunk, urlifier);
+ on_end_quote (this, *buffer, chunk, urlifier);
- const char *colorstr = colorize_stop (pp_show_color (pp));
+ const char *colorstr = colorize_stop (m_show_color);
obstack_grow (&buffer->chunk_obstack, colorstr, strlen (colorstr));
}
/* FALLTHRU */
@@ -1402,7 +1400,7 @@ pp_format (pretty_printer *pp,
case '}':
{
- const char *endurlstr = get_end_url_string (pp);
+ const char *endurlstr = get_end_url_string (this);
obstack_grow (&buffer->chunk_obstack, endurlstr,
strlen (endurlstr));
}
@@ -1411,7 +1409,7 @@ pp_format (pretty_printer *pp,
case 'R':
{
- const char *colorstr = colorize_stop (pp_show_color (pp));
+ const char *colorstr = colorize_stop (m_show_color);
obstack_grow (&buffer->chunk_obstack, colorstr,
strlen (colorstr));
p++;
@@ -1520,7 +1518,7 @@ pp_format (pretty_printer *pp,
prefixing off. */
buffer->obstack = &buffer->chunk_obstack;
const int old_line_length = buffer->line_length;
- old_wrapping_mode = pp_set_verbatim_wrapping (pp);
+ const pp_wrapping_mode_t old_wrapping_mode = pp_set_verbatim_wrapping (this);
/* Second phase. Replace each formatter with the formatted text it
corresponds to. */
@@ -1533,6 +1531,8 @@ pp_format (pretty_printer *pp,
bool hash = false;
bool quote = false;
+ const char *p;
+
/* We do not attempt to enforce any ordering on the modifier
characters. */
@@ -1583,14 +1583,14 @@ pp_format (pretty_printer *pp,
if (quote)
{
- pp_begin_quote (pp, pp_show_color (pp));
+ pp_begin_quote (this, m_show_color);
on_begin_quote (*buffer, chunk, urlifier);
}
switch (*p)
{
case 'r':
- pp_string (pp, colorize_start (pp_show_color (pp),
+ pp_string (this, colorize_start (m_show_color,
va_arg (*text->m_args_ptr,
const char *)));
break;
@@ -1602,11 +1602,11 @@ pp_format (pretty_printer *pp,
"\x" prefix. Otherwise print them all unchanged. */
int chr = va_arg (*text->m_args_ptr, int);
if (ISPRINT (chr) || !quote)
- pp_character (pp, chr);
+ pp_character (this, chr);
else
{
const char str [2] = { chr, '\0' };
- pp_quoted_string (pp, str, 1);
+ pp_quoted_string (this, str, 1);
}
break;
}
@@ -1614,43 +1614,43 @@ pp_format (pretty_printer *pp,
case 'd':
case 'i':
if (wide)
- pp_wide_integer (pp, va_arg (*text->m_args_ptr, HOST_WIDE_INT));
+ pp_wide_integer (this, va_arg (*text->m_args_ptr, HOST_WIDE_INT));
else
- pp_integer_with_precision (pp, *text->m_args_ptr, precision,
+ pp_integer_with_precision (this, *text->m_args_ptr, precision,
int, "d");
break;
case 'o':
if (wide)
- pp_scalar (pp, "%" HOST_WIDE_INT_PRINT "o",
+ pp_scalar (this, "%" HOST_WIDE_INT_PRINT "o",
va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT));
else
- pp_integer_with_precision (pp, *text->m_args_ptr, precision,
+ pp_integer_with_precision (this, *text->m_args_ptr, precision,
unsigned, "o");
break;
case 's':
if (quote)
- pp_quoted_string (pp, va_arg (*text->m_args_ptr, const char *));
+ pp_quoted_string (this, va_arg (*text->m_args_ptr, const char *));
else
- pp_string (pp, va_arg (*text->m_args_ptr, const char *));
+ pp_string (this, va_arg (*text->m_args_ptr, const char *));
break;
case 'p':
- pp_pointer (pp, va_arg (*text->m_args_ptr, void *));
+ pp_pointer (this, va_arg (*text->m_args_ptr, void *));
break;
case 'u':
if (wide)
- pp_scalar (pp, HOST_WIDE_INT_PRINT_UNSIGNED,
+ pp_scalar (this, HOST_WIDE_INT_PRINT_UNSIGNED,
va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT));
else
- pp_integer_with_precision (pp, *text->m_args_ptr, precision,
+ pp_integer_with_precision (this, *text->m_args_ptr, precision,
unsigned, "u");
break;
case 'f':
- pp_double (pp, va_arg (*text->m_args_ptr, double));
+ pp_double (this, va_arg (*text->m_args_ptr, double));
break;
case 'Z':
@@ -1660,11 +1660,11 @@ pp_format (pretty_printer *pp,
for (unsigned i = 0; i < len; ++i)
{
- pp_scalar (pp, "%i", v[i]);
+ pp_scalar (this, "%i", v[i]);
if (i < len - 1)
{
- pp_comma (pp);
- pp_space (pp);
+ pp_comma (this);
+ pp_space (this);
}
}
break;
@@ -1672,10 +1672,10 @@ pp_format (pretty_printer *pp,
case 'x':
if (wide)
- pp_scalar (pp, HOST_WIDE_INT_PRINT_HEX,
+ pp_scalar (this, HOST_WIDE_INT_PRINT_HEX,
va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT));
else
- pp_integer_with_precision (pp, *text->m_args_ptr, precision,
+ pp_integer_with_precision (this, *text->m_args_ptr, precision,
unsigned, "x");
break;
@@ -1714,7 +1714,7 @@ pp_format (pretty_printer *pp,
Negative precision is treated as if it were omitted. */
size_t len = n < 0 ? strlen (s) : strnlen (s, n);
- pp_append_text (pp, s, s + len);
+ pp_append_text (this, s, s + len);
}
break;
@@ -1725,16 +1725,16 @@ pp_format (pretty_printer *pp,
= va_arg (*text->m_args_ptr, diagnostic_event_id_ptr);
gcc_assert (event_id->known_p ());
- pp_string (pp, colorize_start (pp_show_color (pp), "path"));
- pp_character (pp, '(');
- pp_decimal_int (pp, event_id->one_based ());
- pp_character (pp, ')');
- pp_string (pp, colorize_stop (pp_show_color (pp)));
+ pp_string (this, colorize_start (m_show_color, "path"));
+ pp_character (this, '(');
+ pp_decimal_int (this, event_id->one_based ());
+ pp_character (this, ')');
+ pp_string (this, colorize_stop (m_show_color));
}
break;
case '{':
- pp_begin_url (pp, va_arg (*text->m_args_ptr, const char *));
+ begin_url (va_arg (*text->m_args_ptr, const char *));
break;
default:
@@ -1746,18 +1746,18 @@ pp_format (pretty_printer *pp,
potentially disable printing of the closing quote
(e.g. when printing "'TYPEDEF' aka 'TYPE'" in the C family
of frontends). */
- gcc_assert (pp_format_decoder (pp));
- ok = pp_format_decoder (pp) (pp, text, p,
- precision, wide, plus, hash, "e,
- formatters[argno]);
+ gcc_assert (pp_format_decoder (this));
+ ok = m_format_decoder (this, text, p,
+ precision, wide, plus, hash, "e,
+ formatters[argno]);
gcc_assert (ok);
}
}
if (quote)
{
- on_end_quote (pp, *buffer, chunk, urlifier);
- pp_end_quote (pp, pp_show_color (pp));
+ on_end_quote (this, *buffer, chunk, urlifier);
+ pp_end_quote (this, m_show_color);
}
obstack_1grow (&buffer->chunk_obstack, '\0');
@@ -1770,14 +1770,14 @@ pp_format (pretty_printer *pp,
/* If the client supplied a postprocessing object, call its "handle"
hook here. */
- if (pp->m_format_postprocessor)
- pp->m_format_postprocessor->handle (pp);
+ if (m_format_postprocessor)
+ m_format_postprocessor->handle (this);
/* Revert to normal obstack and wrapping mode. */
buffer->obstack = &buffer->formatted_obstack;
buffer->line_length = old_line_length;
- pp_wrapping_mode (pp) = old_wrapping_mode;
- pp_clear_state (pp);
+ pp_wrapping_mode (this) = old_wrapping_mode;
+ clear_state ();
}
struct auto_obstack
@@ -1923,7 +1923,7 @@ pp_output_formatted_text (pretty_printer *pp,
/* If we have any deferred urlification, handle it now. */
if (urlifier
- && pp->url_format != URL_FORMAT_NONE
+ && pp->supports_urls_p ()
&& buffer->cur_chunk_array->m_quotes
&& buffer->cur_chunk_array->m_quotes->has_phase_3_quotes_p ())
buffer->cur_chunk_array->m_quotes->handle_phase_3 (pp, *urlifier);
@@ -1959,8 +1959,8 @@ pp_format_verbatim (pretty_printer *pp, text_info *text)
void
pp_flush (pretty_printer *pp)
{
- pp_clear_state (pp);
- if (!pp->buffer->flush_p)
+ pp->clear_state ();
+ if (!pp_buffer (pp)->flush_p)
return;
pp_write_text_to_stream (pp);
fflush (pp_buffer (pp)->stream);
@@ -1971,7 +1971,7 @@ pp_flush (pretty_printer *pp)
void
pp_really_flush (pretty_printer *pp)
{
- pp_clear_state (pp);
+ pp->clear_state ();
pp_write_text_to_stream (pp);
fflush (pp_buffer (pp)->stream);
}
@@ -1983,7 +1983,7 @@ void
pp_set_line_maximum_length (pretty_printer *pp, int length)
{
pp_line_cutoff (pp) = length;
- pp_set_real_maximum_length (pp);
+ pp->set_real_maximum_length ();
}
/* Clear PRETTY-PRINTER output area text info. */
@@ -1999,13 +1999,13 @@ pp_clear_output_area (pretty_printer *pp)
will eventually be free-ed. */
void
-pp_set_prefix (pretty_printer *pp, char *prefix)
+pretty_printer::set_prefix (char *prefix)
{
- free (pp->prefix);
- pp->prefix = prefix;
- pp_set_real_maximum_length (pp);
- pp->emitted_prefix = false;
- pp_indentation (pp) = 0;
+ free (m_prefix);
+ m_prefix = prefix;
+ set_real_maximum_length ();
+ m_emitted_prefix = false;
+ pp_indentation (this) = 0;
}
/* Take ownership of PP's prefix, setting it to NULL.
@@ -2015,8 +2015,8 @@ pp_set_prefix (pretty_printer *pp, char *prefix)
char *
pp_take_prefix (pretty_printer *pp)
{
- char *result = pp->prefix;
- pp->prefix = NULL;
+ char *result = pp->m_prefix;
+ pp->m_prefix = nullptr;
return result;
}
@@ -2024,39 +2024,39 @@ pp_take_prefix (pretty_printer *pp)
void
pp_destroy_prefix (pretty_printer *pp)
{
- if (pp->prefix != NULL)
+ if (pp->m_prefix)
{
- free (pp->prefix);
- pp->prefix = NULL;
+ free (pp->m_prefix);
+ pp->m_prefix = nullptr;
}
}
-/* Write out PRETTY-PRINTER's prefix. */
+/* Write out this pretty_printer's prefix. */
void
-pp_emit_prefix (pretty_printer *pp)
+pretty_printer::emit_prefix ()
{
- if (pp->prefix != NULL)
+ if (m_prefix)
{
- switch (pp_prefixing_rule (pp))
+ switch (pp_prefixing_rule (this))
{
default:
case DIAGNOSTICS_SHOW_PREFIX_NEVER:
break;
case DIAGNOSTICS_SHOW_PREFIX_ONCE:
- if (pp->emitted_prefix)
+ if (m_emitted_prefix)
{
- pp_indent (pp);
+ pp_indent (this);
break;
}
- pp_indentation (pp) += 3;
+ pp_indentation (this) += 3;
/* Fall through. */
case DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE:
{
- int prefix_length = strlen (pp->prefix);
- pp_append_r (pp, pp->prefix, prefix_length);
- pp->emitted_prefix = true;
+ int prefix_length = strlen (m_prefix);
+ pp_append_r (this, m_prefix, prefix_length);
+ m_emitted_prefix = true;
}
break;
}
@@ -2066,19 +2066,19 @@ pp_emit_prefix (pretty_printer *pp)
/* Construct a PRETTY-PRINTER of MAXIMUM_LENGTH characters per line. */
pretty_printer::pretty_printer (int maximum_length)
- : buffer (new (XCNEW (output_buffer)) output_buffer ()),
- prefix (),
- padding (pp_none),
- maximum_length (),
- indent_skip (),
- wrapping (),
- format_decoder (),
+ : m_buffer (new (XCNEW (output_buffer)) output_buffer ()),
+ m_prefix (nullptr),
+ m_padding (pp_none),
+ m_maximum_length (0),
+ m_indent_skip (0),
+ m_wrapping (),
+ m_format_decoder (nullptr),
m_format_postprocessor (NULL),
- emitted_prefix (),
- need_newline (),
- translate_identifiers (true),
- show_color (),
- url_format (URL_FORMAT_NONE),
+ m_emitted_prefix (false),
+ m_need_newline (false),
+ m_translate_identifiers (true),
+ m_show_color (false),
+ m_url_format (URL_FORMAT_NONE),
m_skipping_null_url (false)
{
pp_line_cutoff (this) = maximum_length;
@@ -2090,22 +2090,22 @@ pretty_printer::pretty_printer (int maximum_length)
/* Copy constructor for pretty_printer. */
pretty_printer::pretty_printer (const pretty_printer &other)
-: buffer (new (XCNEW (output_buffer)) output_buffer ()),
- prefix (),
- padding (other.padding),
- maximum_length (other.maximum_length),
- indent_skip (other.indent_skip),
- wrapping (other.wrapping),
- format_decoder (other.format_decoder),
+: m_buffer (new (XCNEW (output_buffer)) output_buffer ()),
+ m_prefix (nullptr),
+ m_padding (other.m_padding),
+ m_maximum_length (other.m_maximum_length),
+ m_indent_skip (other.m_indent_skip),
+ m_wrapping (other.m_wrapping),
+ m_format_decoder (other.m_format_decoder),
m_format_postprocessor (NULL),
- emitted_prefix (other.emitted_prefix),
- need_newline (other.need_newline),
- translate_identifiers (other.translate_identifiers),
- show_color (other.show_color),
- url_format (other.url_format),
+ m_emitted_prefix (other.m_emitted_prefix),
+ m_need_newline (other.m_need_newline),
+ m_translate_identifiers (other.m_translate_identifiers),
+ m_show_color (other.m_show_color),
+ m_url_format (other.m_url_format),
m_skipping_null_url (false)
{
- pp_line_cutoff (this) = maximum_length;
+ pp_line_cutoff (this) = m_maximum_length;
/* By default, we emit prefixes once per message. */
pp_prefixing_rule (this) = pp_prefixing_rule (&other);
pp_set_prefix (this, NULL);
@@ -2118,9 +2118,9 @@ pretty_printer::~pretty_printer ()
{
if (m_format_postprocessor)
delete m_format_postprocessor;
- buffer->~output_buffer ();
- XDELETE (buffer);
- free (prefix);
+ m_buffer->~output_buffer ();
+ XDELETE (m_buffer);
+ free (m_prefix);
}
/* Base class implementation of pretty_printer::clone vfunc. */
@@ -2142,7 +2142,7 @@ pp_append_text (pretty_printer *pp, const char *start, const char *end)
/* Emit prefix and skip whitespace if we're starting a new line. */
if (pp_buffer (pp)->line_length == 0)
{
- pp_emit_prefix (pp);
+ pp->emit_prefix ();
if (pp_is_wrapping_line (pp))
while (start != end && *start == ' ')
++start;
@@ -2169,12 +2169,11 @@ pp_last_position_in_text (const pretty_printer *pp)
/* Return the amount of characters PRETTY-PRINTER can accept to
make a full line. Meaningful only in line-wrapping mode. */
int
-pp_remaining_character_count_for_line (pretty_printer *pp)
+pretty_printer::remaining_character_count_for_line ()
{
- return pp->maximum_length - pp_buffer (pp)->line_length;
+ return m_maximum_length - pp_buffer (this)->line_length;
}
-
/* Format a message into BUFFER a la printf. */
void
pp_printf (pretty_printer *pp, const char *msg, ...)
@@ -2219,7 +2218,7 @@ pp_character (pretty_printer *pp, int c)
if (pp_is_wrapping_line (pp)
/* If printing UTF-8, don't wrap in the middle of a sequence. */
&& (((unsigned int) c) & 0xC0) != 0x80
- && pp_remaining_character_count_for_line (pp) <= 0)
+ && pp->remaining_character_count_for_line () <= 0)
{
pp_newline (pp);
if (ISSPACE (c))
@@ -2319,12 +2318,12 @@ pp_quoted_string (pretty_printer *pp, const char *str, size_t n /* = -1 */)
/* Maybe print out a whitespace if needed. */
void
-pp_maybe_space (pretty_printer *pp)
+pretty_printer::maybe_space ()
{
- if (pp->padding != pp_none)
+ if (m_padding != pp_none)
{
- pp_space (pp);
- pp->padding = pp_none;
+ pp_space (this);
+ m_padding = pp_none;
}
}
@@ -2625,28 +2624,28 @@ identifier_to_locale (const char *ident)
for the given URL. */
void
-pp_begin_url (pretty_printer *pp, const char *url)
+pretty_printer::begin_url (const char *url)
{
if (!url)
{
/* Handle null URL by skipping all output here,
and in the next pp_end_url. */
- pp->m_skipping_null_url = true;
+ m_skipping_null_url = true;
return;
}
- switch (pp->url_format)
+ switch (m_url_format)
{
case URL_FORMAT_NONE:
break;
case URL_FORMAT_ST:
- pp_string (pp, "\33]8;;");
- pp_string (pp, url);
- pp_string (pp, "\33\\");
+ pp_string (this, "\33]8;;");
+ pp_string (this, url);
+ pp_string (this, "\33\\");
break;
case URL_FORMAT_BEL:
- pp_string (pp, "\33]8;;");
- pp_string (pp, url);
- pp_string (pp, "\a");
+ pp_string (this, "\33]8;;");
+ pp_string (this, url);
+ pp_string (this, "\a");
break;
default:
gcc_unreachable ();
@@ -2659,7 +2658,7 @@ pp_begin_url (pretty_printer *pp, const char *url)
static const char *
get_end_url_string (pretty_printer *pp)
{
- switch (pp->url_format)
+ switch (pp->get_url_format ())
{
case URL_FORMAT_NONE:
return "";
@@ -2675,17 +2674,17 @@ get_end_url_string (pretty_printer *pp)
/* If URL-printing is enabled, write a "close URL" escape sequence to PP. */
void
-pp_end_url (pretty_printer *pp)
+pretty_printer::end_url ()
{
- if (pp->m_skipping_null_url)
+ if (m_skipping_null_url)
{
/* We gracefully handle pp_begin_url (NULL) by omitting output for
both begin and end. Here we handle the latter. */
- pp->m_skipping_null_url = false;
+ m_skipping_null_url = false;
return;
}
- if (pp->url_format != URL_FORMAT_NONE)
- pp_string (pp, get_end_url_string (pp));
+ if (m_url_format != URL_FORMAT_NONE)
+ pp_string (this, get_end_url_string (this));
}
#if CHECKING_P
@@ -2925,7 +2924,7 @@ class test_pretty_printer : public pretty_printer
int max_line_length)
{
pp_set_prefix (this, xstrdup ("PREFIX: "));
- wrapping.rule = rule;
+ pp_prefixing_rule (this) = rule;
pp_set_line_maximum_length (this, max_line_length);
}
};
@@ -3018,7 +3017,7 @@ test_urls ()
{
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_NONE;
+ pp.set_url_format (URL_FORMAT_NONE);
pp_begin_url (&pp, "http://example.com");
pp_string (&pp, "This is a link");
pp_end_url (&pp);
@@ -3028,7 +3027,7 @@ test_urls ()
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_begin_url (&pp, "http://example.com");
pp_string (&pp, "This is a link");
pp_end_url (&pp);
@@ -3038,7 +3037,7 @@ test_urls ()
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_BEL;
+ pp.set_url_format (URL_FORMAT_BEL);
pp_begin_url (&pp, "http://example.com");
pp_string (&pp, "This is a link");
pp_end_url (&pp);
@@ -3054,7 +3053,7 @@ test_null_urls ()
{
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_NONE;
+ pp.set_url_format (URL_FORMAT_NONE);
pp_begin_url (&pp, nullptr);
pp_string (&pp, "This isn't a link");
pp_end_url (&pp);
@@ -3064,7 +3063,7 @@ test_null_urls ()
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_begin_url (&pp, nullptr);
pp_string (&pp, "This isn't a link");
pp_end_url (&pp);
@@ -3074,7 +3073,7 @@ test_null_urls ()
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_BEL;
+ pp.set_url_format (URL_FORMAT_BEL);
pp_begin_url (&pp, nullptr);
pp_string (&pp, "This isn't a link");
pp_end_url (&pp);
@@ -3122,7 +3121,7 @@ test_urlification ()
{
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_NONE;
+ pp.set_url_format (URL_FORMAT_NONE);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-foption%> %<unrecognized%> bar");
ASSERT_STREQ ("foo `-foption' `unrecognized' bar",
@@ -3130,7 +3129,7 @@ test_urlification ()
}
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-foption%> %<unrecognized%> bar");
ASSERT_STREQ
@@ -3140,7 +3139,7 @@ test_urlification ()
}
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_BEL;
+ pp.set_url_format (URL_FORMAT_BEL);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-foption%> %<unrecognized%> bar");
ASSERT_STREQ
@@ -3153,7 +3152,7 @@ test_urlification ()
/* Use of "%qs". */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %qs %qs bar",
"-foption", "unrecognized");
@@ -3167,7 +3166,7 @@ test_urlification ()
a mixture of phase 1 and phase 2. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-f%s%> bar",
"option");
@@ -3180,7 +3179,7 @@ test_urlification ()
quoted region. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-f%sion%> bar %<-f%sion%> baz",
"opt", "opt");
@@ -3192,7 +3191,7 @@ test_urlification ()
/* Likewise. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<%sption%> bar %<-f%sion%> baz",
"-fo", "opt");
@@ -3205,7 +3204,7 @@ test_urlification ()
between a mixture of phase 1 and multiple phase 2. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-f%s%s%> bar",
"opt", "ion");
@@ -3217,7 +3216,7 @@ test_urlification ()
/* Mixed usage of %< and %s with a prefix. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_set_prefix (&pp, xstrdup ("PREFIX"));
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-f%s%> bar",
@@ -3230,7 +3229,7 @@ test_urlification ()
/* Example of mixed %< and %s with numbered args. */
{
pretty_printer pp;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
pp_printf_with_urlifier (&pp, &urlifier,
"foo %<-f%2$st%1$sn%> bar",
"io", "op");
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index 14a225eefe06..99e55dc6a3c0 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -189,25 +189,12 @@ struct pp_wrapping_mode_t
int line_cutoff;
};
-/* Maximum characters per line in automatic line wrapping mode.
- Zero means don't wrap lines. */
-#define pp_line_cutoff(PP) (PP)->wrapping.line_cutoff
-
-/* Prefixing rule used in formatting a diagnostic message. */
-#define pp_prefixing_rule(PP) (PP)->wrapping.rule
-
-/* Get or set the wrapping mode as a single entity. */
-#define pp_wrapping_mode(PP) (PP)->wrapping
-
/* The type of a hook that formats client-specific data onto a pretty_printer.
A client-supplied formatter returns true if everything goes well,
otherwise it returns false. */
typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *,
int, bool, bool, bool, bool *, const char **);
-/* Client supplied function used to decode formats. */
-#define pp_format_decoder(PP) (PP)->format_decoder
-
/* Base class for an optional client-supplied object for doing additional
processing between stages 2 and 3 of formatted printing. */
class format_postprocessor
@@ -218,31 +205,51 @@ class format_postprocessor
virtual void handle (pretty_printer *) = 0;
};
-/* TRUE if a newline character needs to be added before further
- formatting. */
-#define pp_needs_newline(PP) (PP)->need_newline
+inline bool & pp_needs_newline (pretty_printer *pp);
/* True if PRETTY-PRINTER is in line-wrapping mode. */
#define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
-/* The amount of whitespace to be emitted when starting a new line. */
-#define pp_indentation(PP) (PP)->indent_skip
-
-/* True if identifiers are translated to the locale character set on
- output. */
-#define pp_translate_identifiers(PP) (PP)->translate_identifiers
-
-/* True if colors should be shown. */
-#define pp_show_color(PP) (PP)->show_color
+inline output_buffer *&pp_buffer (pretty_printer *pp);
+inline output_buffer *pp_buffer (const pretty_printer *pp);
+inline const char *pp_get_prefix (const pretty_printer *pp);
+extern char *pp_take_prefix (pretty_printer *);
+extern void pp_destroy_prefix (pretty_printer *);
+inline int &pp_line_cutoff (pretty_printer *pp);
+inline diagnostic_prefixing_rule_t &pp_prefixing_rule (pretty_printer *pp);
+inline pp_wrapping_mode_t &pp_wrapping_mode (pretty_printer *pp);
+inline int & pp_indentation (pretty_printer *pp);
+inline bool & pp_translate_identifiers (pretty_printer *pp);
+inline bool & pp_show_color (pretty_printer *pp);
+inline printer_fn &pp_format_decoder (pretty_printer *pp);
+inline format_postprocessor *& pp_format_postprocessor (pretty_printer *pp);
class urlifier;
/* The data structure that contains the bare minimum required to do
- proper pretty-printing. Clients may derived from this structure
+ proper pretty-printing. Clients may derive from this structure
and add additional fields they need. */
class pretty_printer
{
public:
+ friend inline output_buffer *&pp_buffer (pretty_printer *pp);
+ friend inline output_buffer *pp_buffer (const pretty_printer *pp);
+ friend inline const char *pp_get_prefix (const pretty_printer *pp);
+ friend char *pp_take_prefix (pretty_printer *);
+ friend void pp_destroy_prefix (pretty_printer *);
+ friend inline int &pp_line_cutoff (pretty_printer *pp);
+ friend inline diagnostic_prefixing_rule_t &
+ pp_prefixing_rule (pretty_printer *pp);
+ friend inline const diagnostic_prefixing_rule_t &
+ pp_prefixing_rule (const pretty_printer *pp);
+ friend inline pp_wrapping_mode_t &pp_wrapping_mode (pretty_printer *pp);
+ friend bool & pp_needs_newline (pretty_printer *pp);
+ friend int & pp_indentation (pretty_printer *pp);
+ friend bool & pp_translate_identifiers (pretty_printer *pp);
+ friend bool & pp_show_color (pretty_printer *pp);
+ friend printer_fn &pp_format_decoder (pretty_printer *pp);
+ friend format_postprocessor *& pp_format_postprocessor (pretty_printer *pp);
+
/* Default construct a pretty printer with specified
maximum line length cut off limit. */
explicit pretty_printer (int = 0);
@@ -252,25 +259,67 @@ public:
virtual pretty_printer *clone () const;
+ void set_output_stream (FILE *outfile)
+ {
+ m_buffer->stream = outfile;
+ }
+
+ void set_prefix (char *prefix);
+
+ void emit_prefix ();
+
+ void format (text_info *text,
+ const urlifier *urlifier);
+
+ void maybe_space ();
+
+ bool supports_urls_p () const { return m_url_format != URL_FORMAT_NONE; }
+ diagnostic_url_format get_url_format () const { return m_url_format; }
+ void set_url_format (diagnostic_url_format url_format)
+ {
+ m_url_format = url_format;
+ }
+
+ void begin_url (const char *url);
+ void end_url ();
+
+ /* Switch into verbatim mode and return the old mode. */
+ pp_wrapping_mode_t
+ set_verbatim_wrapping ()
+ {
+ const pp_wrapping_mode_t oldmode = pp_wrapping_mode (this);
+ pp_line_cutoff (this) = 0;
+ pp_prefixing_rule (this) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
+ return oldmode;
+ }
+
+ void set_padding (pp_padding padding) { m_padding = padding; }
+ pp_padding get_padding () const { return m_padding; }
+
+ void clear_state ();
+ void set_real_maximum_length ();
+ int remaining_character_count_for_line ();
+
+private:
/* Where we print external representation of ENTITY. */
- output_buffer *buffer;
+ output_buffer *m_buffer;
/* The prefix for each new line. If non-NULL, this is "owned" by the
pretty_printer, and will eventually be free-ed. */
- char *prefix;
+ char *m_prefix;
/* Where to put whitespace around the entity being formatted. */
- pp_padding padding;
+ pp_padding m_padding;
/* The real upper bound of number of characters per line, taking into
account the case of a very very looong prefix. */
- int maximum_length;
+ int m_maximum_length;
/* Indentation count. */
- int indent_skip;
+ int m_indent_skip;
/* Current wrapping mode. */
- pp_wrapping_mode_t wrapping;
+ pp_wrapping_mode_t m_wrapping;
/* If non-NULL, this function formats a TEXT into the BUFFER. When called,
TEXT->format_spec points to a format code. FORMAT_DECODER should call
@@ -281,7 +330,7 @@ public:
returns, TEXT->format_spec should point to the last character processed.
The QUOTE and BUFFER_PTR are passed in, to allow for deferring-handling
of format codes (e.g. %H and %I in the C++ frontend). */
- printer_fn format_decoder;
+ printer_fn m_format_decoder;
/* If non-NULL, this is called by pp_format once after all format codes
have been processed, to allow for client-specific postprocessing.
@@ -290,28 +339,112 @@ public:
format_postprocessor *m_format_postprocessor;
/* Nonzero if current PREFIX was emitted at least once. */
- bool emitted_prefix;
+ bool m_emitted_prefix;
/* Nonzero means one should emit a newline before outputting anything. */
- bool need_newline;
+ bool m_need_newline;
/* Nonzero means identifiers are translated to the locale character
set on output. */
- bool translate_identifiers;
+ bool m_translate_identifiers;
/* Nonzero means that text should be colorized. */
- bool show_color;
+ bool m_show_color;
/* Whether URLs should be emitted, and which terminator to use. */
- diagnostic_url_format url_format;
+ diagnostic_url_format m_url_format;
- /* If true, then we've had a pp_begin_url (nullptr), and so the
- next pp_end_url should be a no-op. */
+ /* If true, then we've had a begin_url (nullptr), and so the
+ next end_url should be a no-op. */
bool m_skipping_null_url;
};
+inline output_buffer *&
+pp_buffer (pretty_printer *pp)
+{
+ return pp->m_buffer;
+}
+
+inline output_buffer *
+pp_buffer (const pretty_printer *pp)
+{
+ return pp->m_buffer;
+}
+
inline const char *
-pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
+pp_get_prefix (const pretty_printer *pp)
+{
+ return pp->m_prefix;
+}
+
+/* TRUE if a newline character needs to be added before further
+ formatting. */
+inline bool &
+pp_needs_newline (pretty_printer *pp)
+{
+ return pp->m_need_newline;
+}
+
+/* The amount of whitespace to be emitted when starting a new line. */
+inline int &
+pp_indentation (pretty_printer *pp)
+{
+ return pp->m_indent_skip;
+}
+
+/* True if identifiers are translated to the locale character set on
+ output. */
+inline bool &
+pp_translate_identifiers (pretty_printer *pp)
+{
+ return pp->m_translate_identifiers;
+}
+
+/* True if colors should be shown. */
+inline bool &
+pp_show_color (pretty_printer *pp)
+{
+ return pp->m_show_color;
+}
+
+inline printer_fn &
+pp_format_decoder (pretty_printer *pp)
+{
+ return pp->m_format_decoder;
+}
+
+inline format_postprocessor *&
+pp_format_postprocessor (pretty_printer *pp)
+{
+ return pp->m_format_postprocessor;
+}
+
+/* Maximum characters per line in automatic line wrapping mode.
+ Zero means don't wrap lines. */
+inline int &
+pp_line_cutoff (pretty_printer *pp)
+{
+ return pp->m_wrapping.line_cutoff;
+}
+
+/* Prefixing rule used in formatting a diagnostic message. */
+inline diagnostic_prefixing_rule_t &
+pp_prefixing_rule (pretty_printer *pp)
+{
+ return pp->m_wrapping.rule;
+}
+inline const diagnostic_prefixing_rule_t &
+pp_prefixing_rule (const pretty_printer *pp)
+{
+ return pp->m_wrapping.rule;
+}
+
+/* Get or set the wrapping mode as a single entity. */
+inline pp_wrapping_mode_t &
+pp_wrapping_mode (pretty_printer *pp)
+{
+ return pp->m_wrapping;
+}
#define pp_space(PP) pp_character (PP, ' ')
#define pp_left_paren(PP) pp_character (PP, '(')
@@ -375,17 +508,18 @@ pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
: (ID)))
-#define pp_buffer(PP) (PP)->buffer
-
extern void pp_set_line_maximum_length (pretty_printer *, int);
-extern void pp_set_prefix (pretty_printer *, char *);
-extern char *pp_take_prefix (pretty_printer *);
-extern void pp_destroy_prefix (pretty_printer *);
-extern int pp_remaining_character_count_for_line (pretty_printer *);
+inline void pp_set_prefix (pretty_printer *pp, char *prefix)
+{
+ pp->set_prefix (prefix);
+}
extern void pp_clear_output_area (pretty_printer *);
extern const char *pp_formatted_text (pretty_printer *);
extern const char *pp_last_position_in_text (const pretty_printer *);
-extern void pp_emit_prefix (pretty_printer *);
+inline void pp_emit_prefix (pretty_printer *pp)
+{
+ pp->emit_prefix ();
+}
extern void pp_append_text (pretty_printer *, const char *, const char *);
extern void pp_newline_and_flush (pretty_printer *);
extern void pp_newline_and_indent (pretty_printer *, int);
@@ -413,8 +547,11 @@ extern void pp_verbatim (pretty_printer *, const char *, ...)
ATTRIBUTE_GCC_PPDIAG(2,3);
extern void pp_flush (pretty_printer *);
extern void pp_really_flush (pretty_printer *);
-extern void pp_format (pretty_printer *, text_info *,
- const urlifier * = nullptr);
+inline void pp_format (pretty_printer *pp, text_info *text,
+ const urlifier *urlifier = nullptr)
+{
+ pp->format (text, urlifier);
+}
extern void pp_output_formatted_text (pretty_printer *,
const urlifier * = nullptr);
extern void pp_format_verbatim (pretty_printer *, text_info *);
@@ -429,24 +566,32 @@ extern void pp_write_text_to_stream (pretty_printer *);
extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool);
extern void pp_write_text_as_html_like_dot_to_stream (pretty_printer *pp);
-extern void pp_maybe_space (pretty_printer *);
+inline void pp_maybe_space (pretty_printer *pp)
+{
+ pp->maybe_space ();
+}
extern void pp_begin_quote (pretty_printer *, bool);
extern void pp_end_quote (pretty_printer *, bool);
-extern void pp_begin_url (pretty_printer *pp, const char *url);
-extern void pp_end_url (pretty_printer *pp);
+inline void
+pp_begin_url (pretty_printer *pp, const char *url)
+{
+ pp->begin_url (url);
+}
+
+inline void
+pp_end_url (pretty_printer *pp)
+{
+ pp->end_url ();
+}
/* Switch into verbatim mode and return the old mode. */
inline pp_wrapping_mode_t
-pp_set_verbatim_wrapping_ (pretty_printer *pp)
+pp_set_verbatim_wrapping (pretty_printer *pp)
{
- pp_wrapping_mode_t oldmode = pp_wrapping_mode (pp);
- pp_line_cutoff (pp) = 0;
- pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
- return oldmode;
+ return pp->set_verbatim_wrapping ();
}
-#define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (PP)
extern const char *identifier_to_locale (const char *);
extern void *(*identifier_to_locale_alloc) (size_t);
diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc
index ecb689f56a94..69c2e196e041 100644
--- a/gcc/print-rtl.cc
+++ b/gcc/print-rtl.cc
@@ -2070,7 +2070,7 @@ void
dump_value_slim (FILE *f, const_rtx x, int verbose)
{
pretty_printer rtl_slim_pp;
- rtl_slim_pp.buffer->stream = f;
+ rtl_slim_pp.set_output_stream (f);
print_value (&rtl_slim_pp, x, verbose);
pp_flush (&rtl_slim_pp);
}
@@ -2081,7 +2081,7 @@ void
dump_insn_slim (FILE *f, const rtx_insn *x)
{
pretty_printer rtl_slim_pp;
- rtl_slim_pp.buffer->stream = f;
+ rtl_slim_pp.set_output_stream (f);
print_insn_with_notes (&rtl_slim_pp, x);
pp_flush (&rtl_slim_pp);
}
@@ -2095,7 +2095,7 @@ dump_rtl_slim (FILE *f, const rtx_insn *first, const rtx_insn *last,
{
const rtx_insn *insn, *tail;
pretty_printer rtl_slim_pp;
- rtl_slim_pp.buffer->stream = f;
+ rtl_slim_pp.set_output_stream (f);
tail = last ? NEXT_INSN (last) : NULL;
for (insn = first;
diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 4e1acf04d442..0dda09a99e3f 100644
--- a/gcc/print-tree.cc
+++ b/gcc/print-tree.cc
@@ -955,7 +955,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
fprintf (file, "def_stmt ");
{
pretty_printer pp;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp_gimple_stmt_1 (&pp, SSA_NAME_DEF_STMT (node), indent + 4,
TDF_NONE);
pp_flush (&pp);
diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index eb75d1bdb260..3d8cff76aaf9 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -2882,7 +2882,7 @@ dump_rgn_dependencies_dot (FILE *file)
int bb;
pretty_printer pp;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp_printf (&pp, "digraph SchedDG {\n");
for (bb = 0; bb < current_nr_blocks; ++bb)
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.c
index b53b347bb4fa..d71b75f44cca 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.c
@@ -530,7 +530,7 @@ dump_refcnt_info (const hash_map<const region *, int> ®ion_to_refcnt,
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = stderr;
+ pp.set_output_stream (stderr);
for (const auto ®ion_refcnt : region_to_refcnt)
{
diff --git a/gcc/text-art/canvas.cc b/gcc/text-art/canvas.cc
index 5bb33b2c6fac..8e5d96808d8c 100644
--- a/gcc/text-art/canvas.cc
+++ b/gcc/text-art/canvas.cc
@@ -80,8 +80,8 @@ canvas::print_to_pp (pretty_printer *pp,
pp_string (pp, per_line_prefix);
pretty_printer line_pp;
- line_pp.show_color = pp->show_color;
- line_pp.url_format = pp->url_format;
+ pp_show_color (&line_pp) = pp_show_color (pp);
+ line_pp.set_url_format (pp->get_url_format ());
const int final_x_in_row = get_final_x_in_row (y);
for (int x = 0; x <= final_x_in_row; x++)
{
@@ -133,7 +133,7 @@ canvas::debug (bool styled) const
if (styled)
{
pp_show_color (&pp) = true;
- pp.url_format = determine_url_format (DIAGNOSTICS_URL_AUTO);
+ pp.set_url_format (determine_url_format (DIAGNOSTICS_URL_AUTO));
}
print_to_pp (&pp);
fprintf (stderr, "%s\n", pp_formatted_text (&pp));
@@ -383,7 +383,7 @@ test_canvas_urls ()
{
pretty_printer pp;
pp_show_color (&pp) = true;
- pp.url_format = URL_FORMAT_ST;
+ pp.set_url_format (URL_FORMAT_ST);
assert_canvas_streq (SELFTEST_LOCATION, canvas, &pp,
(/* Line 1. */
"\n"
@@ -400,7 +400,7 @@ test_canvas_urls ()
{
pretty_printer pp;
pp_show_color (&pp) = true;
- pp.url_format = URL_FORMAT_BEL;
+ pp.set_url_format (URL_FORMAT_BEL);
assert_canvas_streq (SELFTEST_LOCATION, canvas, &pp,
(/* Line 1. */
"\n"
diff --git a/gcc/text-art/dump.h b/gcc/text-art/dump.h
index e94f308f8cee..4659d1424b50 100644
--- a/gcc/text-art/dump.h
+++ b/gcc/text-art/dump.h
@@ -63,7 +63,7 @@ void dump_to_file (const T &obj, FILE *outf)
pp_format_decoder (&pp) = default_tree_printer;
if (outf == stderr)
pp_show_color (&pp) = pp_show_color (global_dc->printer);
- pp.buffer->stream = outf;
+ pp.set_output_stream (outf);
text_art::theme *theme = global_dc->get_diagram_theme ();
dump_to_pp (obj, theme, &pp);
diff --git a/gcc/text-art/selftests.cc b/gcc/text-art/selftests.cc
index 5b4679b0cda1..2b113b6b0177 100644
--- a/gcc/text-art/selftests.cc
+++ b/gcc/text-art/selftests.cc
@@ -71,7 +71,7 @@ selftest::assert_canvas_streq (const location &loc,
if (styled)
{
pp_show_color (&pp) = true;
- pp.url_format = URL_FORMAT_DEFAULT;
+ pp.set_url_format (URL_FORMAT_DEFAULT);
}
assert_canvas_streq (loc, canvas, &pp, expected_str);
}
diff --git a/gcc/text-art/style.cc b/gcc/text-art/style.cc
index 5c58d432cf48..e5e9bdfdf7b7 100644
--- a/gcc/text-art/style.cc
+++ b/gcc/text-art/style.cc
@@ -232,7 +232,7 @@ style::print_changes (pretty_printer *pp,
{
if (!old_style.m_url.empty ())
pp_end_url (pp);
- if (pp->url_format != URL_FORMAT_NONE
+ if (pp->supports_urls_p ()
&& !new_style.m_url.empty ())
{
/* Adapted from pp_begin_url, but encoding the
@@ -241,7 +241,7 @@ style::print_changes (pretty_printer *pp,
pp_string (pp, "\33]8;;");
for (auto ch : new_style.m_url)
pp_unicode_character (pp, ch);
- switch (pp->url_format)
+ switch (pp->get_url_format ())
{
default:
case URL_FORMAT_NONE:
diff --git a/gcc/text-art/styled-string.cc b/gcc/text-art/styled-string.cc
index 78c65498921a..988fe8a742aa 100644
--- a/gcc/text-art/styled-string.cc
+++ b/gcc/text-art/styled-string.cc
@@ -566,7 +566,7 @@ styled_string::from_fmt_va (style_manager &sm,
text_info text (fmt, args, errno);
pretty_printer pp;
pp_show_color (&pp) = true;
- pp.url_format = URL_FORMAT_DEFAULT;
+ pp.set_url_format (URL_FORMAT_DEFAULT);
pp_format_decoder (&pp) = format_decoder;
pp_format (&pp, &text);
pp_output_formatted_text (&pp);
diff --git a/gcc/tree-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc
index 0ad6c5beb81c..f82ef305c06c 100644
--- a/gcc/tree-diagnostic-path.cc
+++ b/gcc/tree-diagnostic-path.cc
@@ -2284,7 +2284,7 @@ control_flow_tests (const line_table_case &case_)
{
std::unique_ptr<pretty_printer> event_pp
= std::unique_ptr<pretty_printer> (global_dc->printer->clone ());
- pp_show_color (event_pp) = 0;
+ pp_show_color (event_pp.get ()) = false;
test_control_flow_1 (case_, event_pp.get ());
test_control_flow_2 (case_, event_pp.get ());
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 83324086c85b..f87393ee94d6 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -347,7 +347,7 @@ dot_rdg_1 (FILE *file, struct graph *rdg)
int i;
pretty_printer pp;
pp_needs_newline (&pp) = false;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
fprintf (file, "digraph RDG {\n");
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index 601cf215ca84..4bb946bb0e83 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -4814,7 +4814,7 @@ maybe_init_pretty_print (FILE *file)
pp_translate_identifiers (tree_pp) = false;
}
- tree_pp->buffer->stream = file;
+ tree_pp->set_output_stream (file);
}
static void
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 45400306d647..05cb308e6821 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -284,7 +284,7 @@ vrange::dump (FILE *file) const
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
vrange_printer vrange_pp (&pp);
this->accept (vrange_pp);
pp_flush (&pp);
@@ -297,7 +297,7 @@ irange_bitmask::dump (FILE *file) const
pretty_printer pp;
pp_needs_newline (&pp) = true;
- pp.buffer->stream = file;
+ pp.set_output_stream (file);
pp_string (&pp, "MASK ");
unsigned len_mask, len_val;
if (print_hex_buf_size (m_mask, &len_mask)
--
2.26.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed 3/3] pretty_printer: convert chunk_info into a class
2024-06-12 13:37 [pushed 1/3] pretty_printer: rename instances named "buffer" to "pp" David Malcolm
2024-06-12 13:37 ` [pushed 2/3] pretty_printer: make all fields private David Malcolm
@ 2024-06-12 13:37 ` David Malcolm
1 sibling, 0 replies; 3+ messages in thread
From: David Malcolm @ 2024-06-12 13:37 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
No functional change intended.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
Pushed to trunk as r15-1210-g1cae1a5ce088c1.
gcc/cp/ChangeLog:
* error.cc (append_formatted_chunk): Move part of body into
chunk_info::append_formatted_chunk.
gcc/ChangeLog:
* dumpfile.cc (dump_pretty_printer::emit_items): Update for
changes to chunk_info.
* pretty-print.cc (chunk_info::append_formatted_chunk): New, based
on code in cp/error.cc's append_formatted_chunk.
(chunk_info::pop_from_output_buffer): New, based on code in
pp_output_formatted_text and dump_pretty_printer::emit_items.
(on_begin_quote): Convert to...
(chunk_info::on_begin_quote): ...this.
(on_end_quote): Convert to...
(chunk_info::on_end_quote): ...this.
(pretty_printer::format): Update for chunk_info becoming a class
and its fields gaining "m_" prefixes. Update for on_begin_quote
and on_end_quote moving to chunk_info.
(quoting_info::handle_phase_3): Update for changes to chunk_info.
(pp_output_formatted_text): Likewise. Move cleanup code to
chunk_info::pop_from_output_buffer.
* pretty-print.h (class output_buffer): New forward decl.
(class urlifier): New forward decl.
(struct chunk_info): Convert to...
(class chunk_info): ...this. Add friend class pretty_printer.
(chunk_info::get_args): New accessor.
(chunk_info::get_quoting_info): New accessor.
(chunk_info::append_formatted_chunk): New decl.
(chunk_info::pop_from_output_buffer): New decl.
(chunk_info::on_begin_quote): New decl.
(chunk_info::on_end_quote): New decl.
(chunk_info::prev): Rename to...
(chunk_info::m_prev): ...this.
(chunk_info::args): Rename to...
(chunk_info::m_args): ...this.
(output_buffer::cur_chunk_array): Drop "struct" from decl.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
gcc/cp/error.cc | 10 +----
gcc/dumpfile.cc | 9 ++---
gcc/pretty-print.cc | 96 ++++++++++++++++++++++++++++-----------------
gcc/pretty-print.h | 30 ++++++++++++--
4 files changed, 90 insertions(+), 55 deletions(-)
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 01ad794df8e3..171a352c85fd 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -4307,14 +4307,8 @@ static void
append_formatted_chunk (pretty_printer *pp, const char *content)
{
output_buffer *buffer = pp_buffer (pp);
- struct chunk_info *chunk_array = buffer->cur_chunk_array;
- const char **args = chunk_array->args;
-
- unsigned int chunk_idx;
- for (chunk_idx = 0; args[chunk_idx]; chunk_idx++)
- ;
- args[chunk_idx++] = content;
- args[chunk_idx] = NULL;
+ chunk_info *chunk_array = buffer->cur_chunk_array;
+ chunk_array->append_formatted_chunk (content);
}
/* Create a copy of CONTENT, with quotes added, and,
diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc
index 097f9bcfff21..82bd8b06bebf 100644
--- a/gcc/dumpfile.cc
+++ b/gcc/dumpfile.cc
@@ -819,8 +819,8 @@ void
dump_pretty_printer::emit_items (optinfo *dest)
{
output_buffer *buffer = pp_buffer (this);
- struct chunk_info *chunk_array = buffer->cur_chunk_array;
- const char **args = chunk_array->args;
+ chunk_info *chunk_array = buffer->cur_chunk_array;
+ const char * const *args = chunk_array->get_args ();
gcc_assert (buffer->obstack == &buffer->formatted_obstack);
gcc_assert (buffer->line_length == 0);
@@ -847,10 +847,7 @@ dump_pretty_printer::emit_items (optinfo *dest)
/* Ensure that we consumed all of stashed_items. */
gcc_assert (stashed_item_idx == m_stashed_items.length ());
- /* Deallocate the chunk structure and everything after it (i.e. the
- associated series of formatted strings). */
- buffer->cur_chunk_array = chunk_array->prev;
- obstack_free (&buffer->chunk_obstack, chunk_array);
+ chunk_array->pop_from_output_buffer (*buffer);
}
/* Subroutine of dump_pretty_printer::emit_items
diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index 271cd650c4d1..639e2b881586 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -1239,29 +1239,53 @@ private:
std::vector<run> m_phase_3_quotes;
};
-static void
-on_begin_quote (const output_buffer &buf,
- unsigned chunk_idx,
- const urlifier *urlifier)
+/* Adds a chunk to the end of formatted output, so that it
+ will be printed by pp_output_formatted_text. */
+
+void
+chunk_info::append_formatted_chunk (const char *content)
+{
+ unsigned int chunk_idx;
+ for (chunk_idx = 0; m_args[chunk_idx]; chunk_idx++)
+ ;
+ m_args[chunk_idx++] = content;
+ m_args[chunk_idx] = nullptr;
+}
+
+/* Deallocate the current chunk structure and everything after it (i.e. the
+ associated series of formatted strings). */
+
+void
+chunk_info::pop_from_output_buffer (output_buffer &buf)
+{
+ delete m_quotes;
+ buf.cur_chunk_array = m_prev;
+ obstack_free (&buf.chunk_obstack, this);
+}
+
+void
+chunk_info::on_begin_quote (const output_buffer &buf,
+ unsigned chunk_idx,
+ const urlifier *urlifier)
{
if (!urlifier)
return;
- if (!buf.cur_chunk_array->m_quotes)
- buf.cur_chunk_array->m_quotes = new quoting_info ();
- buf.cur_chunk_array->m_quotes->on_begin_quote (buf, chunk_idx);
+ if (!m_quotes)
+ m_quotes = new quoting_info ();
+ m_quotes->on_begin_quote (buf, chunk_idx);
}
-static void
-on_end_quote (pretty_printer *pp,
- output_buffer &buf,
- unsigned chunk_idx,
- const urlifier *urlifier)
+void
+chunk_info::on_end_quote (pretty_printer *pp,
+ output_buffer &buf,
+ unsigned chunk_idx,
+ const urlifier *urlifier)
{
if (!urlifier)
return;
- if (!buf.cur_chunk_array->m_quotes)
- buf.cur_chunk_array->m_quotes = new quoting_info ();
- buf.cur_chunk_array->m_quotes->on_end_quote (pp, buf, chunk_idx, *urlifier);
+ if (!m_quotes)
+ m_quotes = new quoting_info ();
+ m_quotes->on_end_quote (pp, buf, chunk_idx, *urlifier);
}
/* The following format specifiers are recognized as being client independent:
@@ -1333,13 +1357,12 @@ pretty_printer::format (text_info *text,
const char **formatters[PP_NL_ARGMAX];
/* Allocate a new chunk structure. */
- struct chunk_info *new_chunk_array
- = XOBNEW (&buffer->chunk_obstack, struct chunk_info);
+ chunk_info *new_chunk_array = XOBNEW (&buffer->chunk_obstack, chunk_info);
- new_chunk_array->prev = buffer->cur_chunk_array;
+ new_chunk_array->m_prev = buffer->cur_chunk_array;
new_chunk_array->m_quotes = nullptr;
buffer->cur_chunk_array = new_chunk_array;
- const char **args = new_chunk_array->args;
+ const char **args = new_chunk_array->m_args;
/* Formatting phase 1: split up TEXT->format_spec into chunks in
pp_buffer (PP)->args[]. Even-numbered chunks are to be output
@@ -1380,13 +1403,13 @@ pretty_printer::format (text_info *text,
obstack_grow (&buffer->chunk_obstack, colorstr, strlen (colorstr));
p++;
- on_begin_quote (*buffer, chunk, urlifier);
+ buffer->cur_chunk_array->on_begin_quote (*buffer, chunk, urlifier);
continue;
}
case '>':
{
- on_end_quote (this, *buffer, chunk, urlifier);
+ buffer->cur_chunk_array->on_end_quote (this, *buffer, chunk, urlifier);
const char *colorstr = colorize_stop (m_show_color);
obstack_grow (&buffer->chunk_obstack, colorstr, strlen (colorstr));
@@ -1584,7 +1607,7 @@ pretty_printer::format (text_info *text,
if (quote)
{
pp_begin_quote (this, m_show_color);
- on_begin_quote (*buffer, chunk, urlifier);
+ buffer->cur_chunk_array->on_begin_quote (*buffer, chunk, urlifier);
}
switch (*p)
@@ -1756,7 +1779,8 @@ pretty_printer::format (text_info *text,
if (quote)
{
- on_end_quote (this, *buffer, chunk, urlifier);
+ buffer->cur_chunk_array->on_end_quote (this, *buffer,
+ chunk, urlifier);
pp_end_quote (this, m_show_color);
}
@@ -1840,8 +1864,9 @@ quoting_info::handle_phase_3 (pretty_printer *pp,
{
unsigned int chunk;
output_buffer * const buffer = pp_buffer (pp);
- struct chunk_info *chunk_array = buffer->cur_chunk_array;
- const char **args = chunk_array->args;
+ chunk_info *chunk_array = buffer->cur_chunk_array;
+ const char * const *args = chunk_array->get_args ();
+ quoting_info *quoting = chunk_array->get_quoting_info ();
/* We need to construct the string into an intermediate buffer
for this case, since using pp_string can introduce prefixes
@@ -1856,9 +1881,9 @@ quoting_info::handle_phase_3 (pretty_printer *pp,
correspond to. */
size_t start_of_run_byte_offset = 0;
std::vector<quoting_info::run>::const_iterator iter_run
- = buffer->cur_chunk_array->m_quotes->m_phase_3_quotes.begin ();
+ = quoting->m_phase_3_quotes.begin ();
std::vector<quoting_info::run>::const_iterator end_runs
- = buffer->cur_chunk_array->m_quotes->m_phase_3_quotes.end ();
+ = quoting->m_phase_3_quotes.end ();
for (chunk = 0; args[chunk]; chunk++)
{
size_t start_of_chunk_idx = combined_buf.object_size ();
@@ -1913,8 +1938,9 @@ pp_output_formatted_text (pretty_printer *pp,
{
unsigned int chunk;
output_buffer * const buffer = pp_buffer (pp);
- struct chunk_info *chunk_array = buffer->cur_chunk_array;
- const char **args = chunk_array->args;
+ chunk_info *chunk_array = buffer->cur_chunk_array;
+ const char * const *args = chunk_array->get_args ();
+ quoting_info *quoting = chunk_array->get_quoting_info ();
gcc_assert (buffer->obstack == &buffer->formatted_obstack);
@@ -1924,18 +1950,14 @@ pp_output_formatted_text (pretty_printer *pp,
/* If we have any deferred urlification, handle it now. */
if (urlifier
&& pp->supports_urls_p ()
- && buffer->cur_chunk_array->m_quotes
- && buffer->cur_chunk_array->m_quotes->has_phase_3_quotes_p ())
- buffer->cur_chunk_array->m_quotes->handle_phase_3 (pp, *urlifier);
+ && quoting
+ && quoting->has_phase_3_quotes_p ())
+ quoting->handle_phase_3 (pp, *urlifier);
else
for (chunk = 0; args[chunk]; chunk++)
pp_string (pp, args[chunk]);
- /* Deallocate the chunk structure and everything after it (i.e. the
- associated series of formatted strings). */
- delete buffer->cur_chunk_array->m_quotes;
- buffer->cur_chunk_array = chunk_array->prev;
- obstack_free (&buffer->chunk_obstack, chunk_array);
+ chunk_array->pop_from_output_buffer (*buffer);
}
/* Helper subroutine of output_verbatim and verbatim. Do the appropriate
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index 99e55dc6a3c0..b41d3ce31d22 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -70,16 +70,38 @@ enum diagnostic_prefixing_rule_t
};
class quoting_info;
+class output_buffer;
+class urlifier;
/* The chunk_info data structure forms a stack of the results from the
first phase of formatting (pp_format) which have not yet been
output (pp_output_formatted_text). A stack is necessary because
the diagnostic starter may decide to generate its own output by way
of the formatter. */
-struct chunk_info
+class chunk_info
{
+ friend class pretty_printer;
+
+public:
+ const char * const *get_args () const { return m_args; }
+ quoting_info *get_quoting_info () const { return m_quotes; }
+
+ void append_formatted_chunk (const char *content);
+
+ void pop_from_output_buffer (output_buffer &buf);
+
+private:
+ void on_begin_quote (const output_buffer &buf,
+ unsigned chunk_idx,
+ const urlifier *urlifier);
+
+ void on_end_quote (pretty_printer *pp,
+ output_buffer &buf,
+ unsigned chunk_idx,
+ const urlifier *urlifier);
+
/* Pointer to previous chunk on the stack. */
- struct chunk_info *prev;
+ chunk_info *m_prev;
/* Array of chunks to output. Each chunk is a NUL-terminated string.
In the first phase of formatting, even-numbered chunks are
@@ -87,7 +109,7 @@ struct chunk_info
The second phase replaces all odd-numbered chunks with formatted
text, and the third phase simply emits all the chunks in sequence
with appropriate line-wrapping. */
- const char *args[PP_NL_ARGMAX * 2];
+ const char *m_args[PP_NL_ARGMAX * 2];
/* If non-null, information on quoted text runs within the chunks
for use by a urlifier. */
@@ -114,7 +136,7 @@ public:
struct obstack *obstack;
/* Stack of chunk arrays. These come from the chunk_obstack. */
- struct chunk_info *cur_chunk_array;
+ chunk_info *cur_chunk_array;
/* Where to output formatted text. */
FILE *stream;
--
2.26.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-12 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12 13:37 [pushed 1/3] pretty_printer: rename instances named "buffer" to "pp" David Malcolm
2024-06-12 13:37 ` [pushed 2/3] pretty_printer: make all fields private David Malcolm
2024-06-12 13:37 ` [pushed 3/3] pretty_printer: convert chunk_info into a class David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).