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
72class quoting_info;
73class output_buffer;
74class urlifier;
75
76namespace pp_markup {
77 class context;
78} // namespace pp_markup
79
80/* The chunk_info data structure forms a stack of the results from the
81 first phase of formatting (pp_format) which have not yet been
82 output (pp_output_formatted_text). A stack is necessary because
83 the diagnostic starter may decide to generate its own output by way
84 of the formatter. */
86{
87 friend class pretty_printer;
88 friend class pp_markup::context;
89
90public:
91 const char * const *get_args () const { return m_args; }
93
94 void append_formatted_chunk (const char *content);
95
97
98private:
99 void on_begin_quote (const output_buffer &buf,
100 unsigned chunk_idx,
101 const urlifier *urlifier);
102
104 output_buffer &buf,
105 unsigned chunk_idx,
106 const urlifier *urlifier);
107
108 /* Pointer to previous chunk on the stack. */
110
111 /* Array of chunks to output. Each chunk is a NUL-terminated string.
112 In the first phase of formatting, even-numbered chunks are
113 to be output verbatim, odd-numbered chunks are format specifiers.
114 The second phase replaces all odd-numbered chunks with formatted
115 text, and the third phase simply emits all the chunks in sequence
116 with appropriate line-wrapping. */
117 const char *m_args[PP_NL_ARGMAX * 2];
118
119 /* If non-null, information on quoted text runs within the chunks
120 for use by a urlifier. */
122};
123
124/* The output buffer datatype. This is best seen as an abstract datatype
125 whose fields should not be accessed directly by clients. */
127{
128public:
129 output_buffer ();
131
132 /* Obstack where the text is built up. */
134
135 /* Obstack containing a chunked representation of the format
136 specification plus arguments. */
138
139 /* Currently active obstack: one of the above two. This is used so
140 that the text formatters don't need to know which phase we're in. */
142
143 /* Stack of chunk arrays. These come from the chunk_obstack. */
145
146 /* Where to output formatted text. */
147 FILE *stream;
148
149 /* The amount of characters output so far. */
151
152 /* This must be large enough to hold any printed integer or
153 floating-point value. */
154 char digit_buffer[128];
155
156 /* Nonzero means that text should be flushed when
157 appropriate. Otherwise, text is buffered until either
158 pp_really_flush or pp_clear_output_area are called. */
160};
161
162/* Finishes constructing a NULL-terminated character string representing
163 the buffered text. */
164inline const char *
166{
167 obstack_1grow (buff->obstack, '\0');
168 return (const char *) obstack_base (buff->obstack);
169}
170
171/* Append to the output buffer a string specified by its
172 STARTing character and LENGTH. */
173inline void
174output_buffer_append_r (output_buffer *buff, const char *start, int length)
175{
176 gcc_checking_assert (start);
177 obstack_grow (buff->obstack, start, length);
178 for (int i = 0; i < length; i++)
179 if (start[i] == '\n')
180 buff->line_length = 0;
181 else
182 buff->line_length++;
183}
184
185/* Return a pointer to the last character emitted in the
186 output_buffer. A NULL pointer means no character available. */
187inline const char *
189{
190 const char *p = NULL;
191 struct obstack *text = buff->obstack;
192
193 if (obstack_base (text) != obstack_next_free (text))
194 p = ((const char *) obstack_next_free (text)) - 1;
195 return p;
196}
197
198
199/* The type of pretty-printer flags passed to clients. */
200typedef unsigned int pp_flags;
201
206
207/* Structure for switching in and out of verbatim mode in a convenient
208 manner. */
210{
211 /* Current prefixing rule. */
213
214 /* The ideal upper bound of number of characters per line, as suggested
215 by front-end. */
217};
218
219/* The type of a hook that formats client-specific data onto a pretty_printer.
220 A client-supplied formatter returns true if everything goes well,
221 otherwise it returns false. */
222typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *,
223 int, bool, bool, bool, bool *, const char **);
224
225/* Base class for an optional client-supplied object for doing additional
226 processing between stages 2 and 3 of formatted printing. */
228{
229 public:
231 virtual format_postprocessor *clone() const = 0;
232 virtual void handle (pretty_printer *) = 0;
233};
234
235inline bool & pp_needs_newline (pretty_printer *pp);
236
237/* True if PRETTY-PRINTER is in line-wrapping mode. */
238#define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
239
241inline output_buffer *pp_buffer (const pretty_printer *pp);
242inline const char *pp_get_prefix (const pretty_printer *pp);
243extern char *pp_take_prefix (pretty_printer *);
244extern void pp_destroy_prefix (pretty_printer *);
245inline int &pp_line_cutoff (pretty_printer *pp);
248inline int & pp_indentation (pretty_printer *pp);
249inline bool & pp_translate_identifiers (pretty_printer *pp);
250inline bool & pp_show_color (pretty_printer *pp);
253inline bool & pp_show_highlight_colors (pretty_printer *pp);
254
255class urlifier;
256
257/* The data structure that contains the bare minimum required to do
258 proper pretty-printing. Clients may derive from this structure
259 and add additional fields they need. */
261{
262public:
263 friend inline output_buffer *&pp_buffer (pretty_printer *pp);
264 friend inline output_buffer *pp_buffer (const pretty_printer *pp);
265 friend inline const char *pp_get_prefix (const pretty_printer *pp);
266 friend char *pp_take_prefix (pretty_printer *);
267 friend void pp_destroy_prefix (pretty_printer *);
268 friend inline int &pp_line_cutoff (pretty_printer *pp);
269 friend inline diagnostic_prefixing_rule_t &
271 friend inline const diagnostic_prefixing_rule_t &
274 friend bool & pp_needs_newline (pretty_printer *pp);
275 friend int & pp_indentation (pretty_printer *pp);
276 friend bool & pp_translate_identifiers (pretty_printer *pp);
277 friend bool & pp_show_color (pretty_printer *pp);
280 friend bool & pp_show_highlight_colors (pretty_printer *pp);
281
282 /* Default construct a pretty printer with specified
283 maximum line length cut off limit. */
284 explicit pretty_printer (int = 0);
285 explicit pretty_printer (const pretty_printer &other);
286
287 virtual ~pretty_printer ();
288
289 virtual pretty_printer *clone () const;
290
291 void set_output_stream (FILE *outfile)
292 {
293 m_buffer->stream = outfile;
294 }
295
296 void set_prefix (char *prefix);
297
298 void emit_prefix ();
299
300 void format (text_info *text,
301 const urlifier *urlifier);
302
303 void maybe_space ();
304
305 bool supports_urls_p () const { return m_url_format != URL_FORMAT_NONE; }
308 {
309 m_url_format = url_format;
310 }
311
312 void begin_url (const char *url);
313 void end_url ();
314
315 /* Switch into verbatim mode and return the old mode. */
318 {
319 const pp_wrapping_mode_t oldmode = pp_wrapping_mode (this);
320 pp_line_cutoff (this) = 0;
322 return oldmode;
323 }
324
325 void set_padding (pp_padding padding) { m_padding = padding; }
326 pp_padding get_padding () const { return m_padding; }
327
328 void clear_state ();
331
332private:
333 /* Where we print external representation of ENTITY. */
335
336 /* The prefix for each new line. If non-NULL, this is "owned" by the
337 pretty_printer, and will eventually be free-ed. */
338 char *m_prefix;
339
340 /* Where to put whitespace around the entity being formatted. */
342
343 /* The real upper bound of number of characters per line, taking into
344 account the case of a very very looong prefix. */
346
347 /* Indentation count. */
349
350 /* Current wrapping mode. */
352
353 /* If non-NULL, this function formats a TEXT into the BUFFER. When called,
354 TEXT->format_spec points to a format code. FORMAT_DECODER should call
355 pp_string (and related functions) to add data to the BUFFER.
356 FORMAT_DECODER can read arguments from *TEXT->args_pts using VA_ARG.
357 If the BUFFER needs additional characters from the format string, it
358 should advance the TEXT->format_spec as it goes. When FORMAT_DECODER
359 returns, TEXT->format_spec should point to the last character processed.
360 The QUOTE and BUFFER_PTR are passed in, to allow for deferring-handling
361 of format codes (e.g. %H and %I in the C++ frontend). */
363
364 /* If non-NULL, this is called by pp_format once after all format codes
365 have been processed, to allow for client-specific postprocessing.
366 This is used by the C++ frontend for handling the %H and %I
367 format codes (which interract with each other). */
369
370 /* Nonzero if current PREFIX was emitted at least once. */
372
373 /* Nonzero means one should emit a newline before outputting anything. */
375
376 /* Nonzero means identifiers are translated to the locale character
377 set on output. */
379
380 /* Nonzero means that text should be colorized. */
382
383 /* True means that pertinent sections within the text should be
384 highlighted with color. */
386
387 /* Whether URLs should be emitted, and which terminator to use. */
389
390 /* If true, then we've had a begin_url (nullptr), and so the
391 next end_url should be a no-op. */
393};
394
395inline output_buffer *&
397{
398 return pp->m_buffer;
399}
400
401inline output_buffer *
403{
404 return pp->m_buffer;
405}
406
407inline const char *
409{
410 return pp->m_prefix;
411}
412
413/* TRUE if a newline character needs to be added before further
414 formatting. */
415inline bool &
417{
418 return pp->m_need_newline;
419}
420
421/* The amount of whitespace to be emitted when starting a new line. */
422inline int &
424{
425 return pp->m_indent_skip;
426}
427
428/* True if identifiers are translated to the locale character set on
429 output. */
430inline bool &
435
436/* True if colors should be shown. */
437inline bool &
439{
440 return pp->m_show_color;
441}
442
443inline printer_fn &
445{
446 return pp->m_format_decoder;
447}
448
449inline format_postprocessor *&
454
455inline bool &
460
461/* Maximum characters per line in automatic line wrapping mode.
462 Zero means don't wrap lines. */
463inline int &
465{
466 return pp->m_wrapping.line_cutoff;
467}
468
469/* Prefixing rule used in formatting a diagnostic message. */
472{
473 return pp->m_wrapping.rule;
474}
475inline const diagnostic_prefixing_rule_t &
477{
478 return pp->m_wrapping.rule;
479}
480
481/* Get or set the wrapping mode as a single entity. */
482inline pp_wrapping_mode_t &
484{
485 return pp->m_wrapping;
486}
487
488#define pp_space(PP) pp_character (PP, ' ')
489#define pp_left_paren(PP) pp_character (PP, '(')
490#define pp_right_paren(PP) pp_character (PP, ')')
491#define pp_left_bracket(PP) pp_character (PP, '[')
492#define pp_right_bracket(PP) pp_character (PP, ']')
493#define pp_left_brace(PP) pp_character (PP, '{')
494#define pp_right_brace(PP) pp_character (PP, '}')
495#define pp_semicolon(PP) pp_character (PP, ';')
496#define pp_comma(PP) pp_character (PP, ',')
497#define pp_dot(PP) pp_character (PP, '.')
498#define pp_colon(PP) pp_character (PP, ':')
499#define pp_colon_colon(PP) pp_string (PP, "::")
500#define pp_arrow(PP) pp_string (PP, "->")
501#define pp_equal(PP) pp_character (PP, '=')
502#define pp_question(PP) pp_character (PP, '?')
503#define pp_bar(PP) pp_character (PP, '|')
504#define pp_bar_bar(PP) pp_string (PP, "||")
505#define pp_carret(PP) pp_character (PP, '^')
506#define pp_ampersand(PP) pp_character (PP, '&')
507#define pp_ampersand_ampersand(PP) pp_string (PP, "&&")
508#define pp_less(PP) pp_character (PP, '<')
509#define pp_less_equal(PP) pp_string (PP, "<=")
510#define pp_greater(PP) pp_character (PP, '>')
511#define pp_greater_equal(PP) pp_string (PP, ">=")
512#define pp_plus(PP) pp_character (PP, '+')
513#define pp_minus(PP) pp_character (PP, '-')
514#define pp_star(PP) pp_character (PP, '*')
515#define pp_slash(PP) pp_character (PP, '/')
516#define pp_modulo(PP) pp_character (PP, '%')
517#define pp_exclamation(PP) pp_character (PP, '!')
518#define pp_complement(PP) pp_character (PP, '~')
519#define pp_quote(PP) pp_character (PP, '\'')
520#define pp_backquote(PP) pp_character (PP, '`')
521#define pp_doublequote(PP) pp_character (PP, '"')
522#define pp_underscore(PP) pp_character (PP, '_')
523#define pp_maybe_newline_and_indent(PP, N) \
524 if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
525#define pp_scalar(PP, FORMAT, SCALAR) \
526 do \
527 { \
528 sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
529 pp_string (PP, pp_buffer (PP)->digit_buffer); \
530 } \
531 while (0)
532#define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I)
533#define pp_unsigned_wide_integer(PP, I) \
534 pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
535#define pp_vrange(PP, R) \
536 do \
537 { \
538 vrange_printer vrange_pp (PP); \
539 (R)->accept (vrange_pp); \
540 } \
541 while (0)
542#define pp_double(PP, F) pp_scalar (PP, "%f", F)
543#define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
544
545#define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \
546 ? identifier_to_locale (ID) \
547 : (ID)))
548
549
550extern void pp_set_line_maximum_length (pretty_printer *, int);
551inline void pp_set_prefix (pretty_printer *pp, char *prefix)
552{
553 pp->set_prefix (prefix);
554}
555extern void pp_clear_output_area (pretty_printer *);
556extern const char *pp_formatted_text (pretty_printer *);
557extern const char *pp_last_position_in_text (const pretty_printer *);
558inline void pp_emit_prefix (pretty_printer *pp)
559{
560 pp->emit_prefix ();
561}
562extern void pp_append_text (pretty_printer *, const char *, const char *);
563extern void pp_newline_and_flush (pretty_printer *);
564extern void pp_newline_and_indent (pretty_printer *, int);
565extern void pp_separate_with (pretty_printer *, char);
566
567/* If we haven't already defined a front-end-specific diagnostics
568 style, use the generic one. */
569#ifdef GCC_DIAG_STYLE
570#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
571#else
572#define GCC_PPDIAG_STYLE __gcc_diag__
573#endif
574
575/* This header may be included before diagnostics-core.h, hence the duplicate
576 definitions to allow for GCC-specific formats. */
577#if GCC_VERSION >= 3005
578#define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
579#else
580#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
581#endif
582extern void pp_printf (pretty_printer *, const char *, ...)
583 ATTRIBUTE_GCC_PPDIAG(2,3);
584
585extern void pp_verbatim (pretty_printer *, const char *, ...)
586 ATTRIBUTE_GCC_PPDIAG(2,3);
587extern void pp_flush (pretty_printer *);
588extern void pp_really_flush (pretty_printer *);
589inline void pp_format (pretty_printer *pp, text_info *text,
590 const urlifier *urlifier = nullptr)
591{
592 pp->format (text, urlifier);
593}
594extern void pp_output_formatted_text (pretty_printer *,
595 const urlifier * = nullptr);
596extern void pp_format_verbatim (pretty_printer *, text_info *);
597
598extern void pp_indent (pretty_printer *);
599extern void pp_newline (pretty_printer *);
600extern void pp_character (pretty_printer *, int);
601extern void pp_string (pretty_printer *, const char *);
602extern void pp_string_n (pretty_printer *, const char *, size_t);
603extern void pp_unicode_character (pretty_printer *, unsigned);
604
605extern void pp_write_text_to_stream (pretty_printer *);
606extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool);
607extern void pp_write_text_as_html_like_dot_to_stream (pretty_printer *pp);
608
609inline void pp_maybe_space (pretty_printer *pp)
610{
611 pp->maybe_space ();
612}
613
614extern void pp_begin_quote (pretty_printer *, bool);
615extern void pp_end_quote (pretty_printer *, bool);
616
617inline void
618pp_begin_url (pretty_printer *pp, const char *url)
619{
620 pp->begin_url (url);
621}
622
623inline void
624pp_end_url (pretty_printer *pp)
625{
626 pp->end_url ();
627}
628
629/* Switch into verbatim mode and return the old mode. */
630inline pp_wrapping_mode_t
631pp_set_verbatim_wrapping (pretty_printer *pp)
632{
633 return pp->set_verbatim_wrapping ();
634}
635
636extern const char *identifier_to_locale (const char *);
637extern void *(*identifier_to_locale_alloc) (size_t);
638extern void (*identifier_to_locale_free) (void *);
639
640/* Print I to PP in decimal. */
641
642inline void
643pp_wide_integer (pretty_printer *pp, HOST_WIDE_INT i)
644{
645 pp_scalar (pp, HOST_WIDE_INT_PRINT_DEC, i);
646}
647
648inline void
649pp_wide_int (pretty_printer *pp, const wide_int_ref &w, signop sgn)
650{
651 unsigned int len;
652 print_dec_buf_size (w, sgn, &len);
653 if (UNLIKELY (len > sizeof (pp_buffer (pp)->digit_buffer)))
654 pp_wide_int_large (pp, w, sgn);
655 else
656 {
657 print_dec (w, pp_buffer (pp)->digit_buffer, sgn);
658 pp_string (pp, pp_buffer (pp)->digit_buffer);
659 }
660}
661
662template<unsigned int N, typename T>
663void pp_wide_integer (pretty_printer *pp, const poly_int<N, T> &);
664
665#endif /* GCC_PRETTY_PRINT_H */
Definition pretty-print.h:86
void append_formatted_chunk(const char *content)
Definition pretty-print.cc:1249
const char *const * get_args() const
Definition pretty-print.h:91
const char * m_args[PP_NL_ARGMAX *2]
Definition pretty-print.h:117
void on_begin_quote(const output_buffer &buf, unsigned chunk_idx, const urlifier *urlifier)
Definition pretty-print.cc:1270
void on_end_quote(pretty_printer *pp, output_buffer &buf, unsigned chunk_idx, const urlifier *urlifier)
Definition pretty-print.cc:1282
chunk_info * m_prev
Definition pretty-print.h:109
quoting_info * m_quotes
Definition pretty-print.h:121
void pop_from_output_buffer(output_buffer &buf)
Definition pretty-print.cc:1262
quoting_info * get_quoting_info() const
Definition pretty-print.h:92
Definition genoutput.cc:147
Definition pretty-print.h:228
virtual ~format_postprocessor()
Definition pretty-print.h:230
virtual void handle(pretty_printer *)=0
virtual format_postprocessor * clone() const =0
Definition pretty-print.h:127
bool flush_p
Definition pretty-print.h:159
chunk_info * cur_chunk_array
Definition pretty-print.h:144
output_buffer()
Definition pretty-print.cc:736
struct obstack * obstack
Definition pretty-print.h:141
~output_buffer()
Definition pretty-print.cc:752
FILE * stream
Definition pretty-print.h:147
int line_length
Definition pretty-print.h:150
struct obstack chunk_obstack
Definition pretty-print.h:137
struct obstack formatted_obstack
Definition pretty-print.h:133
char digit_buffer[128]
Definition pretty-print.h:154
Definition pretty-print-markup.h:28
Definition pretty-print.h:261
friend pp_wrapping_mode_t & pp_wrapping_mode(pretty_printer *pp)
Definition pretty-print.h:483
void set_real_maximum_length()
Definition pretty-print.cc:822
friend char * pp_take_prefix(pretty_printer *)
Definition pretty-print.cc:2054
diagnostic_url_format get_url_format() const
Definition pretty-print.h:306
friend bool & pp_needs_newline(pretty_printer *pp)
Definition pretty-print.h:416
virtual pretty_printer * clone() const
Definition pretty-print.cc:2169
void maybe_space()
Definition pretty-print.cc:2370
void clear_state()
Definition pretty-print.cc:845
bool m_show_color
Definition pretty-print.h:381
format_postprocessor * m_format_postprocessor
Definition pretty-print.h:368
pp_wrapping_mode_t m_wrapping
Definition pretty-print.h:351
void set_padding(pp_padding padding)
Definition pretty-print.h:325
virtual ~pretty_printer()
Definition pretty-print.cc:2157
int remaining_character_count_for_line()
Definition pretty-print.cc:2212
void set_url_format(diagnostic_url_format url_format)
Definition pretty-print.h:307
pp_padding get_padding() const
Definition pretty-print.h:326
friend output_buffer *& pp_buffer(pretty_printer *pp)
Definition pretty-print.h:396
void set_output_stream(FILE *outfile)
Definition pretty-print.h:291
int m_indent_skip
Definition pretty-print.h:348
bool m_skipping_null_url
Definition pretty-print.h:392
bool m_need_newline
Definition pretty-print.h:374
pp_padding m_padding
Definition pretty-print.h:341
friend const char * pp_get_prefix(const pretty_printer *pp)
Definition pretty-print.h:408
bool supports_urls_p() const
Definition pretty-print.h:305
friend void pp_destroy_prefix(pretty_printer *)
Definition pretty-print.cc:2063
friend format_postprocessor *& pp_format_postprocessor(pretty_printer *pp)
Definition pretty-print.h:450
output_buffer * m_buffer
Definition pretty-print.h:334
friend bool & pp_translate_identifiers(pretty_printer *pp)
Definition pretty-print.h:431
pp_wrapping_mode_t set_verbatim_wrapping()
Definition pretty-print.h:317
friend diagnostic_prefixing_rule_t & pp_prefixing_rule(pretty_printer *pp)
Definition pretty-print.h:471
char * m_prefix
Definition pretty-print.h:338
friend int & pp_indentation(pretty_printer *pp)
Definition pretty-print.h:423
bool m_emitted_prefix
Definition pretty-print.h:371
void begin_url(const char *url)
Definition pretty-print.cc:2676
friend int & pp_line_cutoff(pretty_printer *pp)
Definition pretty-print.h:464
pretty_printer(int=0)
Definition pretty-print.cc:2106
diagnostic_url_format m_url_format
Definition pretty-print.h:388
bool m_translate_identifiers
Definition pretty-print.h:378
friend bool & pp_show_color(pretty_printer *pp)
Definition pretty-print.h:438
int m_maximum_length
Definition pretty-print.h:345
void format(text_info *text, const urlifier *urlifier)
Definition pretty-print.cc:1356
void emit_prefix()
Definition pretty-print.cc:2074
printer_fn m_format_decoder
Definition pretty-print.h:362
void end_url()
Definition pretty-print.cc:2726
friend bool & pp_show_highlight_colors(pretty_printer *pp)
Definition pretty-print.h:456
bool m_show_highlight_colors
Definition pretty-print.h:385
void set_prefix(char *prefix)
Definition pretty-print.cc:2040
friend printer_fn & pp_format_decoder(pretty_printer *pp)
Definition pretty-print.h:444
Definition pretty-print.cc:1167
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:357
Definition coretypes.h:165
i
Definition poly-int.h:772
pp_wrapping_mode_t & pp_wrapping_mode(pretty_printer *pp)
Definition pretty-print.h:483
#define PP_NL_ARGMAX
Definition pretty-print.h:29
char * pp_take_prefix(pretty_printer *)
Definition pretty-print.cc:2054
bool & pp_needs_newline(pretty_printer *pp)
Definition pretty-print.h:416
void output_buffer_append_r(output_buffer *buff, const char *start, int length)
Definition pretty-print.h:174
pp_padding
Definition pretty-print.h:203
@ pp_none
Definition pretty-print.h:204
@ pp_after
Definition pretty-print.h:204
@ pp_before
Definition pretty-print.h:204
const char * output_buffer_formatted_text(output_buffer *buff)
Definition pretty-print.h:165
output_buffer *& pp_buffer(pretty_printer *pp)
Definition pretty-print.h:396
const char * pp_get_prefix(const pretty_printer *pp)
Definition pretty-print.h:408
void pp_destroy_prefix(pretty_printer *)
Definition pretty-print.cc:2063
format_postprocessor *& pp_format_postprocessor(pretty_printer *pp)
Definition pretty-print.h:450
bool & pp_translate_identifiers(pretty_printer *pp)
Definition pretty-print.h:431
diagnostic_prefixing_rule_t & pp_prefixing_rule(pretty_printer *pp)
Definition pretty-print.h:471
int & pp_indentation(pretty_printer *pp)
Definition pretty-print.h:423
int & pp_line_cutoff(pretty_printer *pp)
Definition pretty-print.h:464
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:188
bool & pp_show_color(pretty_printer *pp)
Definition pretty-print.h:438
bool(* printer_fn)(pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, const char **)
Definition pretty-print.h:222
unsigned int pp_flags
Definition pretty-print.h:200
bool & pp_show_highlight_colors(pretty_printer *pp)
Definition pretty-print.h:456
printer_fn & pp_format_decoder(pretty_printer *pp)
Definition pretty-print.h:444
Definition pretty-print.h:210
diagnostic_prefixing_rule_t rule
Definition pretty-print.h:212
int line_cutoff
Definition pretty-print.h:216
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:716
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:724
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:893
#define gcc_checking_assert(EXPR)
Definition system.h:828