GCC Middle and Back End API Reference
diagnostics/context.h
Go to the documentation of this file.
1/* Declare diagnostics::context and related types.
2 Copyright (C) 2000-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_DIAGNOSTICS_CONTEXT_H
21#define GCC_DIAGNOSTICS_CONTEXT_H
22
23#include "lazily-created.h"
24#include "unique-argv.h"
31#include "diagnostics/logging.h"
32
33namespace diagnostics {
34
35 namespace changes {
36 class change_set;
37 }
38
39 namespace digraphs { class digraph; }
40
42 class manager;
43 }
44
45 class buffer;
47 class diagram;
48 class sink;
49 class text_sink;
50 class metadata;
51
53
54} // namespace diagnostics
55
56namespace text_art
57{
58 class theme;
59} // namespace text_art
60
61namespace xml
62{
63 class printer;
64} // namespace xml
65
66namespace diagnostics {
67
68/* Forward declarations. */
69class context;
72
73typedef void (*text_starter_fn) (text_sink &,
74 const diagnostic_info *);
75
76struct to_text;
77struct to_html;
78
80
81template <typename TextOrHtml>
82using start_span_fn = void (*) (const location_print_policy &,
83 TextOrHtml &text_or_html,
84 expanded_location);
85
86typedef void (*text_finalizer_fn) (text_sink &,
87 const diagnostic_info *,
88 enum kind);
89
90/* A bundle of state for determining column numbers in diagnostics
91 (tab stops, whether to start at 0 or 1, etc).
92 Uses a file_cache to handle tabs. */
93
95{
96public:
97 column_policy (const context &dc);
98
99 int converted_column (expanded_location s) const;
100
101 label_text get_location_text (const expanded_location &s,
102 bool show_column,
103 bool colorize) const;
104
105 int get_tabstop () const { return m_column_options.m_tabstop; }
106
107private:
110};
111
112/* A bundle of state for printing locations within diagnostics
113 (e.g. "FILENAME:LINE:COLUMN"), to isolate the interactions between
114 context and the start_span callbacks. */
115
117{
118public:
119 location_print_policy (const context &dc);
121
122 bool show_column_p () const { return m_show_column; }
123
124 const column_policy &
126
127 void
129 pretty_printer &pp,
130 const expanded_location &exploc);
131
132 void
134 xml::printer &xp,
135 const expanded_location &exploc);
136
137private:
140};
141
142/* Abstract base class for optionally supplying extra tags when writing
143 out annotation labels in HTML output. */
144
146{
147public:
148 virtual ~html_label_writer () {}
149 virtual void begin_label () = 0;
150 virtual void end_label () = 0;
151};
152
153/* A bundle of state for printing source within a diagnostic,
154 to isolate the interactions between context and the
155 implementation of diagnostic_show_locus. */
156
158{
159public:
163
164 void
166 const rich_location &richloc,
167 enum kind diagnostic_kind,
168 source_effect_info *effect_info) const;
169
170 void
172 const rich_location &richloc,
173 enum kind diagnostic_kind,
174 source_effect_info *effect_info,
175 html_label_writer *label_writer) const;
176
178 get_options () const { return m_options; }
179
182
185
186 file_cache &
187 get_file_cache () const { return m_file_cache; }
188
191 {
192 return m_escape_format;
193 }
194
197
199 {
200 return m_location_policy.get_column_policy ();
201 }
202
204 {
205 return m_location_policy;
206 }
207
208private:
214
215 /* Other data copied from context. */
218};
219
220/* This class encapsulates the state of the diagnostics subsystem
221 as a whole (either directly, or via owned objects of other classes, to
222 avoid global variables).
223
224 It has responsibility for:
225 - being a central place for clients to report diagnostics
226 - reporting those diagnostics to zero or more output sinks
227 (e.g. text vs SARIF)
228 - providing a "dump" member function for a debug dump of the state of
229 the diagnostics subsytem
230 - direct vs buffered diagnostics (see class diagnostics::buffer)
231 - tracking the original argv of the program (for SARIF output)
232 - crash-handling
233
234 It delegates responsibility to various other classes:
235 - the various output sinks (instances of diagnostics::sink
236 subclasses)
237 - formatting of messages (class pretty_printer)
238 - an optional urlifier to inject URLs into formatted messages
239 - counting the number of diagnostics reported of each kind
240 (class diagnostics::counters)
241 - calling out to a option_id_manager to determine if
242 a particular warning is enabled or disabled
243 - tracking pragmas that enable/disable warnings in a range of
244 source code
245 - a cache for use when quoting the user's source code (class file_cache)
246 - a text_art::theme
247 - a diagnostics::changes::change_set for generating patches from fix-it hints
248 - diagnostics::client_data_hooks for metadata.
249
250 Try to avoid adding new responsibilities to this class itself, to avoid
251 the "blob" anti-pattern. */
252
254{
255public:
256 /* Give access to m_text_callbacks. */
257 // FIXME: these need updating
258 friend text_starter_fn &
259 text_starter (context *dc);
261 start_span (context *dc);
262 friend text_finalizer_fn &
264
266 friend class text_sink;
267 friend class buffer;
268
269 typedef void (*set_locations_callback_t) (const context &,
271
272 void initialize (int n_opts);
273 void color_init (int value);
274 void urls_init (int value);
275 void set_pretty_printer (std::unique_ptr<pretty_printer> pp);
276 void refresh_output_sinks ();
277
278 void finish ();
279
280 void dump (FILE *out, int indent) const;
281 void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
282
284
285 bool execution_failed_p () const;
286
287 void set_original_argv (unique_argv original_argv);
288 const char * const *get_original_argv ()
289 {
290 return const_cast<const char * const *> (m_original_argv);
291 }
292
297
298 void
300 bool should_skip_bom);
301
302 void begin_group ();
303 void end_group ();
304
305 void push_nesting_level ();
306 void pop_nesting_level ();
307 void set_nesting_level (int new_level);
308
309 bool warning_enabled_at (location_t loc, option_id opt_id);
310
311 bool option_unspecified_p (option_id opt_id) const
312 {
313 return m_option_classifier.option_unspecified_p (opt_id);
314 }
315
317 {
318 return m_lock > 0;
319 }
320
322 rich_location &richloc,
323 const metadata *metadata,
324 option_id opt_id,
325 const char *gmsgid, ...)
328 rich_location &richloc,
329 const metadata *metadata,
330 option_id opt_id,
331 const char *gmsgid, va_list *ap)
333
335 void report_verbatim (text_info &);
336
337 /* Report a directed graph associated with the run as a whole
338 to any sinks that support directed graphs. */
339 void
341
342 enum kind
344 enum kind new_kind,
345 location_t where)
346 {
348 (m_logger, "diagnostics::context::classify_diagnostics")
349 .log_param_option_id ("option_id", opt_id)
350 .log_param_kind ("new_kind", new_kind)
351 .log_param_location_t ("where", where);
352 logging::auto_inc_depth depth_sentinel (m_logger);
353
354 return m_option_classifier.classify_diagnostic (this,
355 opt_id,
356 new_kind,
357 where);
358 }
359
360 void push_diagnostics (location_t where)
361 {
363 (m_logger, "diagnostics::context::push_diagnostics")
364 .log_param_location_t ("where", where);
365 logging::auto_inc_depth depth_sentinel (m_logger);
366
367 m_option_classifier.push ();
368 }
369 void pop_diagnostics (location_t where)
370 {
372 (m_logger, "diagnostics::context::pop_diagnostics")
373 .log_param_location_t ("where", where);
374 logging::auto_inc_depth depth_sentinel (m_logger);
375
376 m_option_classifier.pop (where);
377 }
378
379 void maybe_show_locus (const rich_location &richloc,
380 const source_printing_options &opts,
381 enum kind diagnostic_kind,
382 pretty_printer &pp,
383 source_effect_info *effect_info);
384 void maybe_show_locus_as_html (const rich_location &richloc,
385 const source_printing_options &opts,
386 enum kind diagnostic_kind,
387 xml::printer &xp,
388 source_effect_info *effect_info,
389 html_label_writer *label_writer);
390
391 void emit_diagram (const diagram &diag);
392
393 /* Various setters for use by option-handling logic. */
394 void set_sink (std::unique_ptr<sink> sink_);
396
397 std::unique_ptr<client_data_hooks>
398 set_client_data_hooks (std::unique_ptr<client_data_hooks> hooks);
399
400 void push_owned_urlifier (std::unique_ptr<urlifier>);
401 void push_borrowed_urlifier (const urlifier &);
402 void pop_urlifier ();
403
406 {
408 }
409 void set_report_bug (bool val) { m_report_bug = val; }
414 void set_show_cwe (bool val) { m_show_cwe = val; }
415 void set_show_rules (bool val) { m_show_rules = val; }
416 void set_show_highlight_colors (bool val);
418 {
419 m_path_format = val;
420 }
421 void set_show_path_depths (bool val) { m_show_path_depths = val; }
423 void set_show_nesting (bool val);
424 void set_show_nesting_locations (bool val);
425 void set_show_nesting_levels (bool val);
426 void set_max_errors (int val) { m_max_errors = val; }
428 {
429 m_escape_format = val;
430 }
431
432 void set_format_decoder (printer_fn format_decoder);
434
435 /* Various accessors. */
437 {
439 }
440 bool show_path_depths_p () const { return m_show_path_depths; }
441 sink &get_sink (size_t idx) const;
444 {
445 return m_escape_format;
446 }
447
448 file_cache &
450 {
452 return *m_file_cache;
453 }
454
460 {
461 return m_client_data_hooks;
462 }
463
466
467 const urlifier *get_urlifier () const;
468
469 text_art::theme *get_diagram_theme () const { return m_diagrams.m_theme; }
470
472 {
473 return m_diagnostic_counters.m_count_for_kind[static_cast<size_t> (kind)];
474 }
475 int diagnostic_count (enum kind kind) const
476 {
477 return m_diagnostic_counters.get_count (kind);
478 }
479
480 /* Option-related member functions. */
481 inline bool option_enabled_p (option_id opt_id) const
482 {
483 if (!m_option_id_mgr)
484 return true;
485 return m_option_id_mgr->option_enabled_p (opt_id);
486 }
487
488 inline char *make_option_name (option_id opt_id,
489 enum kind orig_diag_kind,
490 enum kind diag_kind) const
491 {
492 if (!m_option_id_mgr)
493 return nullptr;
494 return m_option_id_mgr->make_option_name (opt_id,
495 orig_diag_kind,
496 diag_kind);
497 }
498
499 inline char *make_option_url (option_id opt_id) const
500 {
501 if (!m_option_id_mgr)
502 return nullptr;
503 return m_option_id_mgr->make_option_url (opt_id);
504 }
505
506 void
507 set_option_id_manager (std::unique_ptr<option_id_manager> option_id_mgr,
508 unsigned lang_mask);
509
510 unsigned get_lang_mask () const
511 {
512 return m_lang_mask;
513 }
514
515 bool diagnostic_impl (rich_location *, const metadata *,
516 option_id, const char *,
517 va_list *, enum kind) ATTRIBUTE_GCC_DIAG(5,0);
518 bool diagnostic_n_impl (rich_location *, const metadata *,
519 option_id, unsigned HOST_WIDE_INT,
520 const char *, const char *, va_list *,
521 enum kind) ATTRIBUTE_GCC_DIAG(7,0);
522
524 {
525 return m_diagnostic_groups.m_diagnostic_nesting_level;
526 }
527
528 char *build_indent_prefix () const;
529
530 int
531 pch_save (FILE *f)
532 {
533 return m_option_classifier.pch_save (f);
534 }
535
536 int
537 pch_restore (FILE *f)
538 {
539 return m_option_classifier.pch_restore (f);
540 }
541
542
545 {
546 return m_diagnostic_buffer;
547 }
550
551 std::unique_ptr<pretty_printer> clone_printer () const
552 {
553 return m_reference_printer->clone ();
554 }
555
560
561 void
562 add_sink (std::unique_ptr<sink>);
563
565
566 bool supports_fnotice_on_stderr_p () const;
567
568 /* Raise SIGABRT on any diagnostic of severity kind::error or higher. */
569 void
571 {
572 m_abort_on_error = val;
573 }
574
575 /* Accessor for use in serialization, e.g. by C++ modules. */
576 auto &
578 {
579 return m_option_classifier.m_classification_history;
580 }
581
582 void set_main_input_filename (const char *filename);
583
584 void
586 {
587 m_opt_permissive = opt_permissive;
588 }
589
590 void
591 set_fatal_errors (bool fatal_errors)
592 {
593 m_fatal_errors = fatal_errors;
594 }
595
596 void
598 const char *,
599 va_list *))
600 {
601 m_internal_error = cb;
602 }
603
604 void
607 {
609 }
610
611 void
613
621 {
622 return m_source_printing;
623 }
624
627
628 void set_caret_max_width (int value);
629
630private:
632
634
636
637 void check_max_errors (bool flush);
638 void action_after_output (enum kind diag_kind);
639
640 /* Data members.
641 Ideally, all of these would be private. */
642
643private:
644 /* A reference instance of pretty_printer created by the client
645 and owned by the context. Used for cloning when creating/adding
646 output formats.
647 Owned by the context; this would be a std::unique_ptr if
648 context had a proper ctor. */
650
651 /* Cache of source code.
652 Owned by the context; this would be a std::unique_ptr if
653 context had a proper ctor. */
655
656 /* The number of times we have issued diagnostics. */
658
659 /* True if it has been requested that warnings be treated as errors. */
661
662 /* The number of option indexes that can be passed to warning() et
663 al. */
665
666 /* The stack of sets of overridden diagnostic option severities. */
668
669 /* True if we should print any CWE identifiers associated with
670 diagnostics. */
672
673 /* True if we should print any rules associated with diagnostics. */
675
676 /* How should diagnostics::paths::path objects be printed. */
678
679 /* True if we should print stack depths when printing diagnostic paths. */
681
682 /* True if we should print the command line option which controls
683 each diagnostic, if known. */
685
686 /* True if we should raise a SIGABRT on errors. */
688
689public:
690 /* True if we should show the column number on diagnostics. */
692
693 /* True if pedwarns are errors. */
695
696 /* True if permerrors are warnings. */
698
699private:
700 /* The option to associate with turning permerrors into warnings,
701 if any. */
703
704 /* True if errors are fatal. */
706
707public:
708 /* True if all warnings should be disabled. */
710
711 /* True if warnings should be given in system headers. */
713
714private:
715 /* Maximum number of errors to report. */
717
718 /* Client-supplied callbacks for use in text output. */
719 struct {
720 /* This function is called before any message is printed out. It is
721 responsible for preparing message prefix and such. For example, it
722 might say:
723 In file included from "/usr/local/include/curses.h:5:
724 from "/home/gdr/src/nifty_printer.h:56:
725 ...
726 */
728
729 /* This function is called by diagnostic_show_locus in between
730 disjoint spans of source code, so that the context can print
731 something to indicate that a new span of source code has begun. */
734
735 /* This function is called after the diagnostic message is printed. */
738
739 /* Client hook to report an internal error. */
740 void (*m_internal_error) (context *, const char *, va_list *);
741
742 /* Client hook to adjust properties of the given diagnostic that we're
743 about to issue, such as its kind. */
745
746 /* Owned by the context; this would be a std::unique_ptr if
747 context had a proper ctor. */
749 unsigned m_lang_mask;
750
751 /* A stack of optional hooks for adding URLs to quoted text strings in
752 diagnostics. Only used for the main diagnostic message.
753 Typically a single one owner by the context, but can be temporarily
754 overridden by a borrowed urlifier (e.g. on-stack). */
761
762public:
763 /* Auxiliary data for client. */
765
766 /* Used to detect that the last caret was printed at the same location. */
767 location_t m_last_location;
768
769private:
771
773
776
777 /* True if -freport-bug option is used. */
779
780 /* Used to specify additional diagnostic output to be emitted after the
781 rest of the diagnostic. This is for implementing
782 -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT. */
784
785 /* How should non-ASCII/non-printable bytes be escaped when
786 a diagnostic suggests escaping the source code on output. */
788
789 /* If non-NULL, a diagnostics::changes::change_set to which fix-it hints
790 should be applied, for generating patches.
791 Owned by the context; this would be a std::unique_ptr if
792 context had a proper ctor. */
794
795 /* Fields relating to diagnostic groups. */
796 struct {
797 /* How many diagnostic_group instances are currently alive. */
799
800 /* How many nesting levels have been pushed within this group. */
802
803 /* How many diagnostics have been emitted since the bottommost
804 diagnostic_group was pushed. */
806
807 /* The "group+diagnostic" nesting depth from which to inhibit notes. */
810
811 void inhibit_notes_in_group (bool inhibit = true);
812 bool notes_inhibited_in_group () const;
813
814 /* The various sinks to which diagnostics are to be outputted
815 (text vs structured formats such as SARIF).
816 The sinks are owned by the context; this would be a
817 std::vector<std::unique_ptr> if context had a
818 proper ctor. */
820
821 /* Callback to set the locations of call sites along the inlining
822 stack corresponding to a diagnostic location. Needed to traverse
823 the BLOCK_SUPERCONTEXT() chain hanging off the LOCATION_BLOCK()
824 of a diagnostic's location. */
826
827 /* A bundle of hooks for providing data to the context about its client
828 e.g. version information, plugins, etc.
829 Used by SARIF output to give metadata about the client that's
830 producing diagnostics.
831 Owned by the context; this would be a std::unique_ptr if
832 context had a proper ctor. */
834
835 /* Support for diagrams. */
836 struct
837 {
838 /* Theme to use when generating diagrams.
839 Can be NULL (if text art is disabled).
840 Owned by the context; this would be a std::unique_ptr if
841 context had a proper ctor. */
843
845
846 /* Owned by the context. */
848
849 /* Borrowed pointer to the active diagnostics::buffer, if any.
850 If null (the default), then diagnostics that are reported to the
851 context are immediately issued to the output format.
852 If non-null, then diagnostics that are reported to the context
853 are buffered in the buffer, and may be issued to the output format
854 later (if the buffer is flushed), moved to other buffers, or
855 discarded (if the buffer is cleared). */
857
858 /* Owned by the context.
859 Debugging option: if non-NULL, report information to the logger
860 on what the context is doing. */
862};
863
864/* Client supplied function to announce a diagnostic
865 (for text-based diagnostic output). */
866inline text_starter_fn &
871
872/* Client supplied function called between disjoint spans of source code,
873 so that the context can print
874 something to indicate that a new span of source code has begun. */
877{
879}
880
881/* Client supplied function called after a diagnostic message is
882 displayed (for text-based diagnostic output). */
883inline text_finalizer_fn &
888
889} // namespace diagnostics
890
891#endif /* ! GCC_DIAGNOSTICS_CONTEXT_H */
Definition vec.h:1667
Definition buffering.h:59
Definition changes.h:48
Definition client-data-hooks.h:35
Definition diagnostics/context.h:95
int get_tabstop() const
Definition diagnostics/context.h:105
file_cache & m_file_cache
Definition diagnostics/context.h:108
column_options m_column_options
Definition diagnostics/context.h:109
label_text get_location_text(const expanded_location &s, bool show_column, bool colorize) const
Definition diagnostics/context.cc:817
int converted_column(expanded_location s) const
Definition diagnostics/context.cc:809
column_policy(const context &dc)
Definition diagnostics/context.cc:799
Definition diagnostics/context.h:254
void set_report_bug(bool val)
Definition diagnostics/context.h:409
start_span_fn< to_text > m_text_start_span
Definition diagnostics/context.h:732
void set_main_input_filename(const char *filename)
Definition diagnostics/context.cc:526
pretty_printer * m_reference_printer
Definition diagnostics/context.h:649
bool diagnostic_impl(rich_location *, const metadata *, option_id, const char *, va_list *, enum kind) ATTRIBUTE_GCC_DIAG(5
Definition diagnostics/context.cc:1658
void set_show_nesting(bool val)
Definition diagnostics/context.cc:315
text_starter_fn m_begin_diagnostic
Definition diagnostics/context.h:727
void get_any_inlining_info(diagnostic_info *diagnostic)
Definition diagnostics/context.cc:1219
bool option_enabled_p(option_id opt_id) const
Definition diagnostics/context.h:481
set_locations_callback_t m_set_locations_cb
Definition diagnostics/context.h:825
bool m_abort_on_error
Definition diagnostics/context.h:687
void set_diagnostic_buffer(buffer *)
Definition buffering.cc:40
bool m_show_path_depths
Definition diagnostics/context.h:680
bool supports_fnotice_on_stderr_p() const
Definition diagnostics/context.cc:517
buffer * m_diagnostic_buffer
Definition diagnostics/context.h:856
void(* m_internal_error)(context *, const char *, va_list *)
Definition diagnostics/context.h:740
text_finalizer_fn m_end_diagnostic
Definition diagnostics/context.h:736
enum diagnostic_path_format m_path_format
Definition diagnostics/context.h:677
enum diagnostics_escape_format m_escape_format
Definition diagnostics/context.h:787
void refresh_output_sinks()
Definition diagnostics/context.cc:623
const client_data_hooks * get_client_data_hooks() const
Definition diagnostics/context.h:459
bool warning_enabled_at(location_t loc, option_id opt_id)
Definition diagnostics/context.cc:1295
int diagnostic_count(enum kind kind) const
Definition diagnostics/context.h:475
void * m_client_aux_data
Definition diagnostics/context.h:764
void flush_diagnostic_buffer(buffer &)
Definition buffering.cc:95
void maybe_show_locus(const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, pretty_printer &pp, source_effect_info *effect_info)
Definition source-printing.cc:3859
bool m_warning_as_error_requested
Definition diagnostics/context.h:660
bool emitting_diagnostic_p() const
Definition diagnostics/context.h:316
void DEBUG_FUNCTION dump() const
Definition diagnostics/context.h:281
int m_n_opts
Definition diagnostics/context.h:664
column_options m_column_options
Definition diagnostics/context.h:775
void finish()
Definition diagnostics/context.cc:353
struct diagnostics::context::@123301224134201270027146024344211261116312212300 m_text_callbacks
bool emit_diagnostic_with_group(enum kind kind, rich_location &richloc, const metadata *metadata, option_id opt_id, const char *gmsgid,...) ATTRIBUTE_GCC_DIAG(6
Definition diagnostics/context.cc:1313
option_id m_opt_permissive
Definition diagnostics/context.h:702
void pop_urlifier()
Definition diagnostics/context.cc:580
void set_option_id_manager(std::unique_ptr< option_id_manager > option_id_mgr, unsigned lang_mask)
Definition diagnostics/context.cc:555
const char *const * get_original_argv()
Definition diagnostics/context.h:288
std::unique_ptr< client_data_hooks > set_client_data_hooks(std::unique_ptr< client_data_hooks > hooks)
Definition diagnostics/context.cc:533
friend class text_sink
Definition diagnostics/context.h:266
friend start_span_fn< to_text > & start_span(context *dc)
Definition diagnostics/context.h:876
void set_show_cwe(bool val)
Definition diagnostics/context.h:414
changes::change_set * get_fixits_change_set() const
Definition diagnostics/context.h:455
counters m_diagnostic_counters
Definition diagnostics/context.h:657
text_art::theme * m_theme
Definition diagnostics/context.h:842
int pch_restore(FILE *f)
Definition diagnostics/context.h:537
unsigned m_lang_mask
Definition diagnostics/context.h:749
buffer * get_diagnostic_buffer() const
Definition diagnostics/context.h:544
void pop_nesting_level()
Definition diagnostics/context.cc:1855
void report_global_digraph(const lazily_created< digraphs::digraph > &)
Definition diagnostics/context.cc:1594
void set_escape_format(enum diagnostics_escape_format val)
Definition diagnostics/context.h:427
void push_diagnostics(location_t where)
Definition diagnostics/context.h:360
void set_nesting_level(int new_level)
Definition diagnostics/context.cc:1863
logging::logger * get_logger()
Definition diagnostics/context.h:283
void set_fatal_errors(bool fatal_errors)
Definition diagnostics/context.h:591
void remove_all_output_sinks()
Definition diagnostics/context.cc:481
void set_abort_on_error(bool val)
Definition diagnostics/context.h:570
bool m_permissive
Definition diagnostics/context.h:697
void(* m_adjust_diagnostic_info)(const context &, diagnostic_info *)
Definition diagnostics/context.h:744
void set_show_highlight_colors(bool val)
Definition diagnostics/context.cc:641
bool m_inhibit_notes_p
Definition diagnostics/context.h:772
void initialize_input_context(diagnostic_input_charset_callback ccb, bool should_skip_bom)
Definition diagnostics/context.cc:344
void end_group()
Definition diagnostics/context.cc:1827
void set_format_decoder(printer_fn format_decoder)
Definition diagnostics/context.cc:633
int m_group_nesting_depth
Definition diagnostics/context.h:798
int m_emission_count
Definition diagnostics/context.h:805
file_cache * m_file_cache
Definition diagnostics/context.h:654
bool m_show_rules
Definition diagnostics/context.h:674
client_data_hooks * m_client_data_hooks
Definition diagnostics/context.h:833
void inhibit_notes()
Definition diagnostics/context.h:612
bool bool diagnostic_n_impl(rich_location *, const metadata *, option_id, unsigned HOST_WIDE_INT, const char *, const char *, va_list *, enum kind) ATTRIBUTE_GCC_DIAG(7
Definition diagnostics/context.cc:1698
friend text_finalizer_fn & text_finalizer(context *dc)
Definition diagnostics/context.h:884
bool notes_inhibited_in_group() const
Definition diagnostics/context.cc:1093
int m_diagnostic_nesting_level
Definition diagnostics/context.h:801
int & diagnostic_count(enum kind kind)
Definition diagnostics/context.h:471
void clear_diagnostic_buffer(buffer &)
Definition buffering.cc:79
bool show_path_depths_p() const
Definition diagnostics/context.h:440
int m_max_errors
Definition diagnostics/context.h:716
void set_adjust_diagnostic_info_callback(void(*cb)(const context &, diagnostic_info *))
Definition diagnostics/context.h:605
unsigned get_lang_mask() const
Definition diagnostics/context.h:510
const logical_locations::manager * get_logical_location_manager() const
Definition diagnostics/context.cc:591
void set_set_locations_callback(set_locations_callback_t cb)
Definition diagnostics/context.h:293
bool m_show_column
Definition diagnostics/context.h:691
auto_vec< urlifier_stack_node > * m_urlifier_stack
Definition diagnostics/context.h:760
bool m_warn_system_headers
Definition diagnostics/context.h:712
const column_options & get_column_options() const
Definition diagnostics/context.h:626
pretty_printer * get_reference_printer() const
Definition diagnostics/context.h:556
void color_init(int value)
Definition diagnostics/context.cc:255
char ** m_original_argv
Definition diagnostics/context.h:847
void report_verbatim(text_info &)
Definition diagnostics/context.cc:1580
void set_prefixing_rule(diagnostic_prefixing_rule_t rule)
Definition diagnostics/context.cc:650
void set_warning_as_error_requested(bool val)
Definition diagnostics/context.h:405
source_printing_options & get_source_printing_options()
Definition diagnostics/context.h:615
void set_extra_output_kind(enum diagnostics_extra_output_kind kind)
Definition diagnostics/context.h:410
void set_show_path_depths(bool val)
Definition diagnostics/context.h:421
start_span_fn< to_html > m_html_start_span
Definition diagnostics/context.h:733
void set_show_option_requested(bool val)
Definition diagnostics/context.h:422
void(* set_locations_callback_t)(const context &, diagnostic_info *)
Definition diagnostics/context.h:269
void push_borrowed_urlifier(const urlifier &)
Definition diagnostics/context.cc:572
location_t m_last_location
Definition diagnostics/context.h:767
option_classifier m_option_classifier
Definition diagnostics/context.h:667
char * build_indent_prefix() const
void set_original_argv(unique_argv original_argv)
Definition diagnostics/context.cc:542
option_id_manager * m_option_id_mgr
Definition diagnostics/context.h:748
bool bool bool report_diagnostic(diagnostic_info *)
Definition diagnostics/context.cc:1358
std::unique_ptr< pretty_printer > clone_printer() const
Definition diagnostics/context.h:551
void initialize(int n_opts)
Definition diagnostics/context.cc:138
friend class source_print_policy
Definition diagnostics/context.h:265
void set_internal_error_callback(void(*cb)(context *, const char *, va_list *))
Definition diagnostics/context.h:597
enum kind classify_diagnostic(option_id opt_id, enum kind new_kind, location_t where)
Definition diagnostics/context.h:343
void push_nesting_level()
Definition diagnostics/context.cc:1849
void set_max_errors(int val)
Definition diagnostics/context.h:426
char * make_option_name(option_id opt_id, enum kind orig_diag_kind, enum kind diag_kind) const
Definition diagnostics/context.h:488
void push_owned_urlifier(std::unique_ptr< urlifier >)
Definition diagnostics/context.cc:564
friend text_starter_fn & text_starter(context *dc)
Definition diagnostics/context.h:867
bool execution_failed_p() const
Definition diagnostics/context.cc:472
void add_sink(std::unique_ptr< sink >)
Definition diagnostics/context.cc:506
void pop_diagnostics(location_t where)
Definition diagnostics/context.h:369
file_cache & get_file_cache() const
Definition diagnostics/context.h:449
int m_lock
Definition diagnostics/context.h:770
bool m_fatal_errors
Definition diagnostics/context.h:705
void inhibit_notes_in_group(bool inhibit=true)
Definition diagnostics/context.cc:1063
void action_after_output(enum kind diag_kind)
Definition diagnostics/context.cc:979
void initialize_fixits_change_set()
Definition diagnostics/context.cc:659
bool warning_as_error_requested_p() const
Definition diagnostics/context.h:436
struct diagnostics::context::@341201264073143215367363357234376160363014117137 m_diagnostic_groups
text_art::theme * get_diagram_theme() const
Definition diagnostics/context.h:469
logging::logger * m_logger
Definition diagnostics/context.h:861
bool option_unspecified_p(option_id opt_id) const
Definition diagnostics/context.h:311
void set_permissive_option(option_id opt_permissive)
Definition diagnostics/context.h:585
void emit_diagram(const diagram &diag)
Definition diagnostics/context.cc:1740
bool bool int get_diagnostic_nesting_level() const
Definition diagnostics/context.h:523
struct diagnostics::context::@315143341136332350101266143205316065242223315254 m_diagrams
char * make_option_url(option_id opt_id) const
Definition diagnostics/context.h:499
bool m_inhibit_warnings
Definition diagnostics/context.h:709
bool m_report_bug
Definition diagnostics/context.h:778
enum diagnostic_path_format get_path_format() const
Definition diagnostics/context.h:442
void set_pretty_printer(std::unique_ptr< pretty_printer > pp)
Definition diagnostics/context.cc:613
const source_printing_options & get_source_printing_options() const
Definition diagnostics/context.h:620
void set_caret_max_width(int value)
Definition diagnostics/context.cc:122
int pch_save(FILE *f)
Definition diagnostics/context.h:531
source_printing_options m_source_printing
Definition diagnostics/context.h:774
const urlifier * get_urlifier() const
Definition diagnostics/context.cc:599
void set_sink(std::unique_ptr< sink > sink_)
Definition diagnostics/context.cc:488
enum diagnostics_extra_output_kind m_extra_output_kind
Definition diagnostics/context.h:783
void error_recursion() ATTRIBUTE_NORETURN
Definition diagnostics/context.cc:1755
void begin_group()
Definition diagnostics/context.cc:1821
bool m_pedantic_errors
Definition diagnostics/context.h:694
void check_max_errors(bool flush)
Definition diagnostics/context.cc:955
void maybe_show_locus_as_html(const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, xml::printer &xp, source_effect_info *effect_info, html_label_writer *label_writer)
Definition source-printing.cc:3892
int m_inhibiting_notes_from
Definition diagnostics/context.h:808
column_options & get_column_options()
Definition diagnostics/context.h:625
bool m_show_cwe
Definition diagnostics/context.h:671
auto_vec< sink * > m_sinks
Definition diagnostics/context.h:819
void set_show_rules(bool val)
Definition diagnostics/context.h:415
sink & get_sink(size_t idx) const
Definition diagnostics/context.cc:498
void set_show_nesting_locations(bool val)
Definition diagnostics/context.cc:324
auto & get_classification_history()
Definition diagnostics/context.h:577
changes::change_set * m_fixits_change_set
Definition diagnostics/context.h:793
void urls_init(int value)
Definition diagnostics/context.cc:286
void set_text_art_charset(enum diagnostic_text_art_charset charset)
Definition diagnostics/context.cc:1936
void set_path_format(enum diagnostic_path_format val)
Definition diagnostics/context.h:417
bool m_show_option_requested
Definition diagnostics/context.h:684
bool bool emit_diagnostic_with_group_va(enum kind kind, rich_location &richloc, const metadata *metadata, option_id opt_id, const char *gmsgid, va_list *ap) ATTRIBUTE_GCC_DIAG(6
Definition diagnostics/context.cc:1335
bool diagnostic_enabled(diagnostic_info *diagnostic)
Definition diagnostics/context.cc:1251
enum diagnostics_escape_format get_escape_format() const
Definition diagnostics/context.h:443
friend class buffer
Definition diagnostics/context.h:267
void set_show_nesting_levels(bool val)
Definition diagnostics/context.cc:333
Definition diagram.h:35
Definition diagnostics/digraphs.h:123
Definition file-cache.h:82
Definition diagnostics/context.h:146
virtual ~html_label_writer()
Definition diagnostics/context.h:148
Definition diagnostics/context.h:117
bool show_column_p() const
Definition diagnostics/context.h:122
void print_text_span_start(const context &dc, pretty_printer &pp, const expanded_location &exploc)
Definition source-printing.cc:692
column_policy m_column_policy
Definition diagnostics/context.h:138
bool m_show_column
Definition diagnostics/context.h:139
location_print_policy(const context &dc)
Definition diagnostics/context.cc:839
const column_policy & get_column_policy() const
Definition diagnostics/context.h:125
void print_html_span_start(const context &dc, xml::printer &xp, const expanded_location &exploc)
Definition source-printing.cc:703
log_function_params & log_param_location_t(const char *name, location_t value)
Definition logging.h:123
log_function_params & log_param_option_id(const char *name, diagnostics::option_id value)
Definition logging.h:149
log_function_params & log_param_kind(const char *name, enum diagnostics::kind value)
Definition logging.h:160
Definition logging.h:38
Definition logical-locations.h:147
Definition metadata.h:41
Definition option-classifier.h:37
Definition option-id-manager.h:29
Definition sink.h:36
Definition source-printing-effects.h:43
Definition diagnostics/context.h:158
location_print_policy m_location_policy
Definition diagnostics/context.h:210
void print_as_html(xml::printer &xp, const rich_location &richloc, enum kind diagnostic_kind, source_effect_info *effect_info, html_label_writer *label_writer) const
Definition source-printing.cc:3970
start_span_fn< to_html > m_html_start_span_cb
Definition diagnostics/context.h:212
const location_print_policy & get_location_policy() const
Definition diagnostics/context.h:203
file_cache & m_file_cache
Definition diagnostics/context.h:213
start_span_fn< to_text > get_text_start_span_fn() const
Definition diagnostics/context.h:181
text_art::theme * get_diagram_theme() const
Definition diagnostics/context.h:196
enum diagnostics_escape_format m_escape_format
Definition diagnostics/context.h:217
const column_policy & get_column_policy() const
Definition diagnostics/context.h:198
const source_printing_options & m_options
Definition diagnostics/context.h:209
start_span_fn< to_text > m_text_start_span_cb
Definition diagnostics/context.h:211
source_print_policy(const context &)
Definition source-printing.cc:3924
enum diagnostics_escape_format get_escape_format() const
Definition diagnostics/context.h:190
const source_printing_options & get_options() const
Definition diagnostics/context.h:178
void print(pretty_printer &pp, const rich_location &richloc, enum kind diagnostic_kind, source_effect_info *effect_info) const
Definition source-printing.cc:3953
file_cache & get_file_cache() const
Definition diagnostics/context.h:187
start_span_fn< to_html > get_html_start_span_fn() const
Definition diagnostics/context.h:184
text_art::theme * m_diagram_theme
Definition diagnostics/context.h:216
Definition text-sink.h:35
Definition digraph.h:121
Definition lazily-created.h:31
Definition pretty-print.h:241
Definition theme.h:30
Definition pretty-print-urlifier.h:27
Definition xml-printer.h:33
diagnostics_escape_format
Definition context-options.h:41
diagnostic_text_art_charset
Definition context-options.h:101
diagnostic_path_format
Definition context-options.h:67
diagnostics_extra_output_kind
Definition context-options.h:86
const char *(* diagnostic_input_charset_callback)(const char *)
Definition coretypes.h:175
void ATTRIBUTE_NORETURN
Definition diagnostic-core.h:76
#define ATTRIBUTE_GCC_DIAG(m, n)
Definition diagnostic-core.h:71
Definition changes.cc:31
Definition diagnostics/context.h:39
Definition diagnostics/context.h:41
Definition cfghooks.h:26
pretty_printer * get_printer(to_text &)
Definition source-printing.cc:713
text_starter_fn & text_starter(context *dc)
Definition diagnostics/context.h:867
start_span_fn< to_text > & start_span(context *dc)
Definition diagnostics/context.h:876
text_finalizer_fn & text_finalizer(context *dc)
Definition diagnostics/context.h:884
void(* text_finalizer_fn)(text_sink &, const diagnostic_info *, enum kind)
Definition diagnostics/context.h:86
void(* text_starter_fn)(text_sink &, const diagnostic_info *)
Definition diagnostics/context.h:73
void(*)(const location_print_policy &, TextOrHtml &text_or_html, expanded_location) start_span_fn
Definition diagnostics/context.h:82
kind
Definition kinds.h:27
Definition diagnostics/context.h:57
Definition graphviz.h:26
bool(* printer_fn)(pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &)
Definition pretty-print.h:190
diagnostic_prefixing_rule_t
Definition pretty-print.h:66
static void const char va_list ap
Definition read-md.cc:205
Definition libgdiagnostics.cc:1240
Definition column-options.h:28
Definition diagnostics/context.h:756
bool m_owned
Definition diagnostics/context.h:758
urlifier * m_urlifier
Definition diagnostics/context.h:757
Definition counters.h:32
Definition diagnostic-info.h:32
Definition option-id.h:32
Definition source-printing-options.h:31
Definition source-printing.cc:545
Definition source-printing.cc:409
Definition pretty-print.h:34
Definition unique-argv.h:28
#define gcc_assert(EXPR)
Definition system.h:817
#define DEBUG_FUNCTION
Definition system.h:1191