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