GCC Middle and Back End API Reference
pretty-print.h
Go to the documentation of this file.
1/* Various declarations for language-independent pretty-print subroutines.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_PRETTY_PRINT_H
22#define GCC_PRETTY_PRINT_H
23
24#include "obstack.h"
25#include "rich-location.h"
26#include "diagnostic-url.h"
27
28/* Maximum number of format string arguments. */
29#define PP_NL_ARGMAX 30
30
31/* The type of a text to be formatted according a format specification
32 along with a list of things. */
34{
35 text_info () = default;
36 text_info (const char *format_spec,
37 va_list *args_ptr,
38 int err_no,
39 void **data = nullptr,
40 rich_location *rich_loc = nullptr)
41 : m_format_spec (format_spec),
42 m_args_ptr (args_ptr),
43 m_err_no (err_no),
44 m_data (data),
45 m_richloc (rich_loc)
46 {
47 }
48
49 void set_location (unsigned int idx, location_t loc,
50 enum range_display_kind range_display_kind);
51 location_t get_location (unsigned int index_of_location) const;
52
53 const char *m_format_spec;
54 va_list *m_args_ptr;
55 int m_err_no; /* for %m */
56 void **m_data;
57 rich_location *m_richloc;
58};
59
60/* How often diagnostics are prefixed by their locations:
61 o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported;
62 o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once;
63 o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical
64 line is started. */
71
73class output_buffer;
74class pp_token_list;
75class urlifier;
76
77namespace pp_markup {
78 class context;
79} // namespace pp_markup
80
81/* The output buffer datatype. This is best seen as an abstract datatype
82 whose fields should not be accessed directly by clients. */
84{
85public:
87 output_buffer (const output_buffer &) = delete;
92
95
96 void dump (FILE *out, int indent) const;
97 void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
98
99 /* Obstack where the text is built up. */
101
102 /* Obstack containing a chunked representation of the format
103 specification plus arguments. */
105
106 /* Currently active obstack: one of the above two. This is used so
107 that the text formatters don't need to know which phase we're in. */
109
110 /* Topmost element in a stack of arrays of formatted chunks.
111 These come from the chunk_obstack. */
113
114 /* Where to output formatted text. */
115 FILE *m_stream;
116
117 /* The amount of characters output so far. */
119
120 /* This must be large enough to hold any printed integer or
121 floating-point value. */
122 char m_digit_buffer[128];
123
124 /* Nonzero means that text should be flushed when
125 appropriate. Otherwise, text is buffered until either
126 pp_really_flush or pp_clear_output_area are called. */
128};
129
130/* Finishes constructing a NULL-terminated character string representing
131 the buffered text. */
132inline const char *
134{
135 obstack_1grow (buff->m_obstack, '\0');
136 return (const char *) obstack_base (buff->m_obstack);
137}
138
139/* Append to the output buffer a string specified by its
140 STARTing character and LENGTH. */
141inline void
142output_buffer_append_r (output_buffer *buff, const char *start, int length)
143{
144 gcc_checking_assert (start);
145 obstack_grow (buff->m_obstack, start, length);
146 for (int i = 0; i < length; i++)
147 if (start[i] == '\n')
148 buff->m_line_length = 0;
149 else
150 buff->m_line_length++;
151}
152
153/* Return a pointer to the last character emitted in the
154 output_buffer. A NULL pointer means no character available. */
155inline const char *
157{
158 const char *p = NULL;
159 struct obstack *text = buff->m_obstack;
160
161 if (obstack_base (text) != obstack_next_free (text))
162 p = ((const char *) obstack_next_free (text)) - 1;
163 return p;
164}
165
166
167/* The type of pretty-printer flags passed to clients. */
168typedef unsigned int pp_flags;
169
174
175/* Structure for switching in and out of verbatim mode in a convenient
176 manner. */
178{
179 /* Current prefixing rule. */
181
182 /* The ideal upper bound of number of characters per line, as suggested
183 by front-end. */
185};
186
187/* The type of a hook that formats client-specific data onto a pretty_printer.
188 A client-supplied formatter returns true if everything goes well,
189 otherwise it returns false. */
190typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *,
191 int, bool, bool, bool, bool *, pp_token_list &);
192
193/* Base class for an optional client-supplied object for doing additional
194 processing between stages 2 and 3 of formatted printing. */
196{
197 public:
199 virtual format_postprocessor *clone() const = 0;
200 virtual void handle (pretty_printer *) = 0;
201};
202
203/* Abstract base class for writing formatted tokens to the pretty_printer's
204 text buffer, allowing for output formats and dumpfiles to override
205 how different kinds of tokens are handled. */
206
208{
209public:
210 virtual ~token_printer () {}
211 virtual void print_tokens (pretty_printer *pp,
212 const pp_token_list &tokens) = 0;
213};
214
215inline bool & pp_needs_newline (pretty_printer *pp);
216
217/* True if PRETTY-PRINTER is in line-wrapping mode. */
218#define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
219
221inline output_buffer *pp_buffer (const pretty_printer *pp);
222inline const char *pp_get_prefix (const pretty_printer *pp);
223extern char *pp_take_prefix (pretty_printer *);
224extern void pp_destroy_prefix (pretty_printer *);
225inline int &pp_line_cutoff (pretty_printer *pp);
228inline int & pp_indentation (pretty_printer *pp);
229inline bool & pp_translate_identifiers (pretty_printer *pp);
230inline bool & pp_show_color (pretty_printer *pp);
233inline bool & pp_show_highlight_colors (pretty_printer *pp);
234
235class urlifier;
236
237/* The data structure that contains the bare minimum required to do
238 proper pretty-printing. Clients may derive from this structure
239 and add additional fields they need. */
241{
242public:
243 friend inline output_buffer *&pp_buffer (pretty_printer *pp);
244 friend inline output_buffer *pp_buffer (const pretty_printer *pp);
245 friend inline const char *pp_get_prefix (const pretty_printer *pp);
246 friend char *pp_take_prefix (pretty_printer *);
247 friend void pp_destroy_prefix (pretty_printer *);
248 friend inline int &pp_line_cutoff (pretty_printer *pp);
249 friend inline diagnostic_prefixing_rule_t &
251 friend inline const diagnostic_prefixing_rule_t &
254 friend bool & pp_needs_newline (pretty_printer *pp);
255 friend int & pp_indentation (pretty_printer *pp);
256 friend bool & pp_translate_identifiers (pretty_printer *pp);
257 friend bool & pp_show_color (pretty_printer *pp);
260 friend bool & pp_show_highlight_colors (pretty_printer *pp);
261
263 const urlifier *);
264
265 /* Default construct a pretty printer with specified
266 maximum line length cut off limit. */
267 explicit pretty_printer (int = 0);
268 explicit pretty_printer (const pretty_printer &other);
269
270 virtual ~pretty_printer ();
271
272 virtual std::unique_ptr<pretty_printer> clone () const;
273
274 void set_output_stream (FILE *outfile)
275 {
276 m_buffer->m_stream = outfile;
277 }
278
280 {
281 m_token_printer = tp; // borrowed
282 }
283
284 void set_prefix (char *prefix);
285
286 void emit_prefix ();
287
288 void format (text_info &text);
289
290 void maybe_space ();
291
292 bool supports_urls_p () const { return m_url_format != URL_FORMAT_NONE; }
295 {
296 m_url_format = url_format;
297 }
298
299 void begin_url (const char *url);
300 void end_url ();
301
302 /* Switch into verbatim mode and return the old mode. */
305 {
306 const pp_wrapping_mode_t oldmode = pp_wrapping_mode (this);
307 pp_line_cutoff (this) = 0;
309 return oldmode;
310 }
311
312 void set_padding (pp_padding padding) { m_padding = padding; }
313 pp_padding get_padding () const { return m_padding; }
314
315 void clear_state ();
318
319 void dump (FILE *out, int indent) const;
320 void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
321
322private:
323 /* Where we print external representation of ENTITY. */
325
326 /* The prefix for each new line. If non-NULL, this is "owned" by the
327 pretty_printer, and will eventually be free-ed. */
328 char *m_prefix;
329
330 /* Where to put whitespace around the entity being formatted. */
332
333 /* The real upper bound of number of characters per line, taking into
334 account the case of a very very looong prefix. */
336
337 /* Indentation count. */
339
340 /* Current wrapping mode. */
342
343 /* If non-NULL, this function formats a TEXT into the BUFFER. When called,
344 TEXT->format_spec points to a format code. FORMAT_DECODER should call
345 pp_string (and related functions) to add data to the BUFFER.
346 FORMAT_DECODER can read arguments from *TEXT->args_pts using VA_ARG.
347 If the BUFFER needs additional characters from the format string, it
348 should advance the TEXT->format_spec as it goes. When FORMAT_DECODER
349 returns, TEXT->format_spec should point to the last character processed.
350 The QUOTE and FORMATTED_TOKEN_LIST are passed in, to allow for
351 deferring-handling of format codes (e.g. %H and %I in
352 the C++ frontend). */
354
355 /* If non-NULL, this is called by pp_format once after all format codes
356 have been processed, to allow for client-specific postprocessing.
357 This is used by the C++ frontend for handling the %H and %I
358 format codes (which interract with each other). */
360
361 /* This is used by pp_output_formatted_text after it has converted all
362 formatted chunks into a single list of tokens.
363 Can be nullptr.
364 Borrowed from the output format or from dump_pretty_printer. */
366
367 /* Nonzero if current PREFIX was emitted at least once. */
369
370 /* Nonzero means one should emit a newline before outputting anything. */
372
373 /* Nonzero means identifiers are translated to the locale character
374 set on output. */
376
377 /* Nonzero means that text should be colorized. */
379
380 /* True means that pertinent sections within the text should be
381 highlighted with color. */
383
384 /* Whether URLs should be emitted, and which terminator to use. */
386
387 /* If true, then we've had a begin_url (nullptr), and so the
388 next end_url should be a no-op. */
390};
391
392inline output_buffer *&
394{
395 return pp->m_buffer;
396}
397
398inline output_buffer *
400{
401 return pp->m_buffer;
402}
403
404inline const char *
406{
407 return pp->m_prefix;
408}
409
410/* TRUE if a newline character needs to be added before further
411 formatting. */
412inline bool &
414{
415 return pp->m_need_newline;
416}
417
418/* The amount of whitespace to be emitted when starting a new line. */
419inline int &
421{
422 return pp->m_indent_skip;
423}
424
425/* True if identifiers are translated to the locale character set on
426 output. */
427inline bool &
432
433/* True if colors should be shown. */
434inline bool &
436{
437 return pp->m_show_color;
438}
439
440inline printer_fn &
442{
443 return pp->m_format_decoder;
444}
445
446inline format_postprocessor *&
451
452inline bool &
457
458/* Maximum characters per line in automatic line wrapping mode.
459 Zero means don't wrap lines. */
460inline int &
462{
463 return pp->m_wrapping.line_cutoff;
464}
465
466/* Prefixing rule used in formatting a diagnostic message. */
469{
470 return pp->m_wrapping.rule;
471}
472inline const diagnostic_prefixing_rule_t &
474{
475 return pp->m_wrapping.rule;
476}
477
478/* Get or set the wrapping mode as a single entity. */
479inline pp_wrapping_mode_t &
481{
482 return pp->m_wrapping;
483}
484
485#define pp_space(PP) pp_character (PP, ' ')
486#define pp_left_paren(PP) pp_character (PP, '(')
487#define pp_right_paren(PP) pp_character (PP, ')')
488#define pp_left_bracket(PP) pp_character (PP, '[')
489#define pp_right_bracket(PP) pp_character (PP, ']')
490#define pp_left_brace(PP) pp_character (PP, '{')
491#define pp_right_brace(PP) pp_character (PP, '}')
492#define pp_semicolon(PP) pp_character (PP, ';')
493#define pp_comma(PP) pp_character (PP, ',')
494#define pp_dot(PP) pp_character (PP, '.')
495#define pp_colon(PP) pp_character (PP, ':')
496#define pp_colon_colon(PP) pp_string (PP, "::")
497#define pp_arrow(PP) pp_string (PP, "->")
498#define pp_equal(PP) pp_character (PP, '=')
499#define pp_question(PP) pp_character (PP, '?')
500#define pp_bar(PP) pp_character (PP, '|')
501#define pp_bar_bar(PP) pp_string (PP, "||")
502#define pp_carret(PP) pp_character (PP, '^')
503#define pp_ampersand(PP) pp_character (PP, '&')
504#define pp_ampersand_ampersand(PP) pp_string (PP, "&&")
505#define pp_less(PP) pp_character (PP, '<')
506#define pp_less_equal(PP) pp_string (PP, "<=")
507#define pp_greater(PP) pp_character (PP, '>')
508#define pp_greater_equal(PP) pp_string (PP, ">=")
509#define pp_plus(PP) pp_character (PP, '+')
510#define pp_minus(PP) pp_character (PP, '-')
511#define pp_star(PP) pp_character (PP, '*')
512#define pp_slash(PP) pp_character (PP, '/')
513#define pp_modulo(PP) pp_character (PP, '%')
514#define pp_exclamation(PP) pp_character (PP, '!')
515#define pp_complement(PP) pp_character (PP, '~')
516#define pp_quote(PP) pp_character (PP, '\'')
517#define pp_backquote(PP) pp_character (PP, '`')
518#define pp_doublequote(PP) pp_character (PP, '"')
519#define pp_underscore(PP) pp_character (PP, '_')
520#define pp_maybe_newline_and_indent(PP, N) \
521 if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
522#define pp_scalar(PP, FORMAT, SCALAR) \
523 do \
524 { \
525 sprintf (pp_buffer (PP)->m_digit_buffer, FORMAT, SCALAR); \
526 pp_string (PP, pp_buffer (PP)->m_digit_buffer); \
527 } \
528 while (0)
529#define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I)
530#define pp_unsigned_wide_integer(PP, I) \
531 pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
532#define pp_vrange(PP, R) \
533 do \
534 { \
535 vrange_printer vrange_pp (PP); \
536 (R)->accept (vrange_pp); \
537 } \
538 while (0)
539#define pp_double(PP, F) pp_scalar (PP, "%f", F)
540#define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
541
542#define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \
543 ? identifier_to_locale (ID) \
544 : (ID)))
545
546
547extern void pp_set_line_maximum_length (pretty_printer *, int);
548inline void pp_set_prefix (pretty_printer *pp, char *prefix)
549{
550 pp->set_prefix (prefix);
551}
552extern void pp_clear_output_area (pretty_printer *);
553extern const char *pp_formatted_text (pretty_printer *);
554extern const char *pp_last_position_in_text (const pretty_printer *);
555inline void pp_emit_prefix (pretty_printer *pp)
556{
557 pp->emit_prefix ();
558}
559extern void pp_append_text (pretty_printer *, const char *, const char *);
560extern void pp_newline_and_flush (pretty_printer *);
561extern void pp_newline_and_indent (pretty_printer *, int);
562extern void pp_separate_with (pretty_printer *, char);
563
564/* If we haven't already defined a front-end-specific diagnostics
565 style, use the generic one. */
566#ifdef GCC_DIAG_STYLE
567#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
568#else
569#define GCC_PPDIAG_STYLE __gcc_diag__
570#endif
571
572/* This header may be included before diagnostics-core.h, hence the duplicate
573 definitions to allow for GCC-specific formats. */
574#if GCC_VERSION >= 3005
575#define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
576#else
577#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
578#endif
579extern void pp_printf (pretty_printer *, const char *, ...)
580 ATTRIBUTE_GCC_PPDIAG(2,3);
581
582extern void pp_printf_n (pretty_printer *, unsigned HOST_WIDE_INT n,
583 const char *, const char *, ...)
584 ATTRIBUTE_GCC_PPDIAG(3,5)
585 ATTRIBUTE_GCC_PPDIAG(4,5);
586
587extern void pp_verbatim (pretty_printer *, const char *, ...)
588 ATTRIBUTE_GCC_PPDIAG(2,3);
589extern void pp_flush (pretty_printer *);
590extern void pp_really_flush (pretty_printer *);
591inline void pp_format (pretty_printer *pp, text_info *text)
592{
593 gcc_assert (text);
594 pp->format (*text);
595}
596extern void pp_output_formatted_text (pretty_printer *,
597 const urlifier * = nullptr);
598extern void pp_format_verbatim (pretty_printer *, text_info *);
599
600extern void pp_indent (pretty_printer *);
601extern void pp_newline (pretty_printer *);
602extern void pp_character (pretty_printer *, int);
603extern void pp_string (pretty_printer *, const char *);
604extern void pp_string_n (pretty_printer *, const char *, size_t);
605extern void pp_unicode_character (pretty_printer *, unsigned);
606
607extern void pp_write_text_to_stream (pretty_printer *);
608extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool);
609extern void pp_write_text_as_html_like_dot_to_stream (pretty_printer *pp);
610
611inline void pp_maybe_space (pretty_printer *pp)
612{
613 pp->maybe_space ();
614}
615
616extern void pp_begin_quote (pretty_printer *, bool);
617extern void pp_end_quote (pretty_printer *, bool);
618
619inline void
620pp_begin_url (pretty_printer *pp, const char *url)
621{
622 pp->begin_url (url);
623}
624
625inline void
626pp_end_url (pretty_printer *pp)
627{
628 pp->end_url ();
629}
630
631/* Switch into verbatim mode and return the old mode. */
632inline pp_wrapping_mode_t
633pp_set_verbatim_wrapping (pretty_printer *pp)
634{
635 return pp->set_verbatim_wrapping ();
636}
637
638extern const char *identifier_to_locale (const char *);
639extern void *(*identifier_to_locale_alloc) (size_t);
640extern void (*identifier_to_locale_free) (void *);
641
642/* Print I to PP in decimal. */
643
644inline void
645pp_wide_integer (pretty_printer *pp, HOST_WIDE_INT i)
646{
647 pp_scalar (pp, HOST_WIDE_INT_PRINT_DEC, i);
648}
649
650inline void
651pp_wide_int (pretty_printer *pp, const wide_int_ref &w, signop sgn)
652{
653 unsigned int len;
654 print_dec_buf_size (w, sgn, &len);
655 if (UNLIKELY (len > sizeof (pp_buffer (pp)->m_digit_buffer)))
656 pp_wide_int_large (pp, w, sgn);
657 else
658 {
659 print_dec (w, pp_buffer (pp)->m_digit_buffer, sgn);
660 pp_string (pp, pp_buffer (pp)->m_digit_buffer);
661 }
662}
663
664template<unsigned int N, typename T>
665void pp_wide_integer (pretty_printer *pp, const poly_int<N, T> &);
666
667#endif /* GCC_PRETTY_PRINT_H */
Definition genoutput.cc:150
Definition pretty-print.h:196
virtual ~format_postprocessor()
Definition pretty-print.h:198
virtual void handle(pretty_printer *)=0
virtual format_postprocessor * clone() const =0
Definition pretty-print.h:84
int m_line_length
Definition pretty-print.h:118
output_buffer()
Definition pretty-print.cc:746
char m_digit_buffer[128]
Definition pretty-print.h:122
pp_formatted_chunks * push_formatted_chunks()
Definition pretty-print.cc:773
void DEBUG_FUNCTION dump() const
Definition pretty-print.h:97
bool m_flush_p
Definition pretty-print.h:127
output_buffer(const output_buffer &)=delete
void pop_formatted_chunks()
Definition pretty-print.cc:788
FILE * m_stream
Definition pretty-print.h:115
~output_buffer()
Definition pretty-print.cc:762
output_buffer & operator=(const output_buffer &)=delete
output_buffer(output_buffer &&)=delete
struct obstack * m_obstack
Definition pretty-print.h:108
struct obstack m_formatted_obstack
Definition pretty-print.h:100
struct obstack m_chunk_obstack
Definition pretty-print.h:104
pp_formatted_chunks * m_cur_formatted_chunks
Definition pretty-print.h:112
Definition pretty-print-format-impl.h:366
Definition pretty-print-format-impl.h:300
Definition pretty-print.h:241
friend pp_wrapping_mode_t & pp_wrapping_mode(pretty_printer *pp)
Definition pretty-print.h:480
void set_real_maximum_length()
Definition pretty-print.cc:932
friend char * pp_take_prefix(pretty_printer *)
Definition pretty-print.cc:2405
diagnostic_url_format get_url_format() const
Definition pretty-print.h:293
void format(text_info &text)
Definition pretty-print.cc:1681
friend bool & pp_needs_newline(pretty_printer *pp)
Definition pretty-print.h:413
void maybe_space()
Definition pretty-print.cc:2749
void clear_state()
Definition pretty-print.cc:955
bool m_show_color
Definition pretty-print.h:378
format_postprocessor * m_format_postprocessor
Definition pretty-print.h:359
pp_wrapping_mode_t m_wrapping
Definition pretty-print.h:341
void set_padding(pp_padding padding)
Definition pretty-print.h:312
virtual ~pretty_printer()
Definition pretty-print.cc:2510
int remaining_character_count_for_line()
Definition pretty-print.cc:2565
void set_token_printer(token_printer *tp)
Definition pretty-print.h:279
void set_url_format(diagnostic_url_format url_format)
Definition pretty-print.h:294
pp_padding get_padding() const
Definition pretty-print.h:313
friend output_buffer *& pp_buffer(pretty_printer *pp)
Definition pretty-print.h:393
void set_output_stream(FILE *outfile)
Definition pretty-print.h:274
int m_indent_skip
Definition pretty-print.h:338
bool m_skipping_null_url
Definition pretty-print.h:389
bool m_need_newline
Definition pretty-print.h:371
pp_padding m_padding
Definition pretty-print.h:331
friend const char * pp_get_prefix(const pretty_printer *pp)
Definition pretty-print.h:405
virtual std::unique_ptr< pretty_printer > clone() const
Definition pretty-print.cc:2522
bool supports_urls_p() const
Definition pretty-print.h:292
friend void pp_destroy_prefix(pretty_printer *)
Definition pretty-print.cc:2414
friend format_postprocessor *& pp_format_postprocessor(pretty_printer *pp)
Definition pretty-print.h:447
token_printer * m_token_printer
Definition pretty-print.h:365
output_buffer * m_buffer
Definition pretty-print.h:324
friend bool & pp_translate_identifiers(pretty_printer *pp)
Definition pretty-print.h:428
pp_wrapping_mode_t set_verbatim_wrapping()
Definition pretty-print.h:304
friend diagnostic_prefixing_rule_t & pp_prefixing_rule(pretty_printer *pp)
Definition pretty-print.h:468
char * m_prefix
Definition pretty-print.h:328
friend int & pp_indentation(pretty_printer *pp)
Definition pretty-print.h:420
friend void pp_output_formatted_text(pretty_printer *, const urlifier *)
Definition pretty-print.cc:2222
bool m_emitted_prefix
Definition pretty-print.h:368
void begin_url(const char *url)
Definition pretty-print.cc:3055
friend int & pp_line_cutoff(pretty_printer *pp)
Definition pretty-print.h:461
pretty_printer(int=0)
Definition pretty-print.cc:2457
diagnostic_url_format m_url_format
Definition pretty-print.h:385
bool m_translate_identifiers
Definition pretty-print.h:375
friend bool & pp_show_color(pretty_printer *pp)
Definition pretty-print.h:435
int m_maximum_length
Definition pretty-print.h:335
void DEBUG_FUNCTION dump() const
Definition pretty-print.h:320
void emit_prefix()
Definition pretty-print.cc:2425
printer_fn m_format_decoder
Definition pretty-print.h:353
void end_url()
Definition pretty-print.cc:3105
friend bool & pp_show_highlight_colors(pretty_printer *pp)
Definition pretty-print.h:453
bool m_show_highlight_colors
Definition pretty-print.h:382
void set_prefix(char *prefix)
Definition pretty-print.cc:2391
friend printer_fn & pp_format_decoder(pretty_printer *pp)
Definition pretty-print.h:441
Definition pretty-print.h:208
virtual void print_tokens(pretty_printer *pp, const pp_token_list &tokens)=0
virtual ~token_printer()
Definition pretty-print.h:210
Definition pretty-print-urlifier.h:27
diagnostic_url_format
Definition diagnostic-url.h:37
@ URL_FORMAT_NONE
Definition diagnostic-url.h:39
static struct obstack obstack
Definition gcc.cc:360
Definition coretypes.h:172
i
Definition poly-int.h:776
pp_wrapping_mode_t & pp_wrapping_mode(pretty_printer *pp)
Definition pretty-print.h:480
bool(* printer_fn)(pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &)
Definition pretty-print.h:190
char * pp_take_prefix(pretty_printer *)
Definition pretty-print.cc:2405
bool & pp_needs_newline(pretty_printer *pp)
Definition pretty-print.h:413
void output_buffer_append_r(output_buffer *buff, const char *start, int length)
Definition pretty-print.h:142
pp_padding
Definition pretty-print.h:171
@ pp_none
Definition pretty-print.h:172
@ pp_after
Definition pretty-print.h:172
@ pp_before
Definition pretty-print.h:172
const char * output_buffer_formatted_text(output_buffer *buff)
Definition pretty-print.h:133
output_buffer *& pp_buffer(pretty_printer *pp)
Definition pretty-print.h:393
const char * pp_get_prefix(const pretty_printer *pp)
Definition pretty-print.h:405
void pp_destroy_prefix(pretty_printer *)
Definition pretty-print.cc:2414
format_postprocessor *& pp_format_postprocessor(pretty_printer *pp)
Definition pretty-print.h:447
bool & pp_translate_identifiers(pretty_printer *pp)
Definition pretty-print.h:428
diagnostic_prefixing_rule_t & pp_prefixing_rule(pretty_printer *pp)
Definition pretty-print.h:468
int & pp_indentation(pretty_printer *pp)
Definition pretty-print.h:420
int & pp_line_cutoff(pretty_printer *pp)
Definition pretty-print.h:461
diagnostic_prefixing_rule_t
Definition pretty-print.h:66
@ DIAGNOSTICS_SHOW_PREFIX_NEVER
Definition pretty-print.h:68
@ DIAGNOSTICS_SHOW_PREFIX_ONCE
Definition pretty-print.h:67
@ DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE
Definition pretty-print.h:69
const char * output_buffer_last_position_in_text(const output_buffer *buff)
Definition pretty-print.h:156
bool & pp_show_color(pretty_printer *pp)
Definition pretty-print.h:435
unsigned int pp_flags
Definition pretty-print.h:168
bool & pp_show_highlight_colors(pretty_printer *pp)
Definition pretty-print.h:453
printer_fn & pp_format_decoder(pretty_printer *pp)
Definition pretty-print.h:441
Definition pretty-print.h:178
diagnostic_prefixing_rule_t rule
Definition pretty-print.h:180
int line_cutoff
Definition pretty-print.h:184
Definition pretty-print.h:34
int m_err_no
Definition pretty-print.h:55
va_list * m_args_ptr
Definition pretty-print.h:54
void ** m_data
Definition pretty-print.h:56
text_info()=default
void set_location(unsigned int idx, location_t loc, enum range_display_kind range_display_kind)
Definition pretty-print.cc:726
text_info(const char *format_spec, va_list *args_ptr, int err_no, void **data=nullptr, rich_location *rich_loc=nullptr)
Definition pretty-print.h:36
location_t get_location(unsigned int index_of_location) const
Definition pretty-print.cc:734
const char * m_format_spec
Definition pretty-print.h:53
rich_location * m_richloc
Definition pretty-print.h:57
#define NULL
Definition system.h:50
#define bool
Definition system.h:886
#define DEBUG_FUNCTION
Definition system.h:1236
#define gcc_checking_assert(EXPR)
Definition system.h:821