diff options
Diffstat (limited to 'gcc/pretty-print.h')
-rw-r--r-- | gcc/pretty-print.h | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 95577063da5..a60be3285ea 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -73,6 +73,9 @@ struct chunk_info whose fields should not be accessed directly by clients. */ struct output_buffer { + output_buffer (); + ~output_buffer (); + /* Obstack where the text is built up. */ struct obstack formatted_obstack; @@ -157,8 +160,14 @@ typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *, /* The data structure that contains the bare minimum required to do proper pretty-printing. Clients may derived from this structure and add additional fields they need. */ -struct pretty_print_info +struct pretty_printer { + // Default construct a pretty printer with specified prefix + // and a maximum line length cut off limit. + explicit pretty_printer (const char* = NULL, int = 0); + + virtual ~pretty_printer (); + /* Where we print external representation of ENTITY. */ output_buffer *buffer; @@ -240,26 +249,8 @@ pp_get_prefix (const pretty_printer *pp) { return pp->prefix; } #define pp_backquote(PP) pp_character (PP, '`') #define pp_doublequote(PP) pp_character (PP, '"') #define pp_underscore(PP) pp_character (PP, '_') -#define pp_newline_and_flush(PP) \ - do { \ - pp_newline (PP); \ - pp_flush (PP); \ - pp_needs_newline (PP) = false; \ - } while (0) -#define pp_newline_and_indent(PP, N) \ - do { \ - pp_indentation (PP) += N; \ - pp_newline (PP); \ - pp_indent (PP); \ - pp_needs_newline (PP) = false; \ - } while (0) #define pp_maybe_newline_and_indent(PP, N) \ if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N) -#define pp_separate_with(PP, C) \ - do { \ - pp_character (PP, C); \ - pp_space (PP); \ - } while (0) #define pp_scalar(PP, FORMAT, SCALAR) \ do \ { \ @@ -283,7 +274,6 @@ pp_get_prefix (const pretty_printer *pp) { return pp->prefix; } #define pp_buffer(PP) (PP)->buffer -extern void pp_construct (pretty_printer *, const char *, int); extern void pp_set_line_maximum_length (pretty_printer *, int); extern void pp_set_prefix (pretty_printer *, const char *); extern void pp_destroy_prefix (pretty_printer *); @@ -293,6 +283,9 @@ 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 *); 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); +extern void pp_separate_with (pretty_printer *, char); /* If we haven't already defined a front-end-specific diagnostics style, use the generic one. */ |