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