|
GCC Middle and Back End API Reference
|
Namespaces | |
| namespace | changes |
| namespace | digraphs |
| namespace | dumping |
| namespace | logging |
| namespace | logical_locations |
| namespace | output_spec |
| namespace | paths |
| namespace | state_graphs |
Typedefs | |
| typedef void(*) | text_starter_fn(text_sink &, const diagnostic_info *) |
| template<typename TextOrHtml> | |
| using | start_span_fn |
| typedef void(*) | text_finalizer_fn(text_sink &, const diagnostic_info *, enum kindkind) |
Enumerations | |
| enum class | kind { last_diagnostic_kind , pop , any , tot_num_diagnostic_kinds } |
| enum class | location_relationship_kind { includes , is_included_by , relevant , NUM_KINDS } |
| enum class | diagnostic_artifact_role { analysis_target , debug_output_file , result_file , scanned_file , traced_file , NUM_ROLES } |
| enum class | sarif_serialization_kind { json , num_values } |
| enum class | sarif_version { v2_1_0 , v2_2_prerelease_2024_08_08 , num_versions } |
Functions | |
| void | default_text_starter (diagnostics::text_sink &, const diagnostics::diagnostic_info *) |
| template<typename TextOrHtml> | |
| void | default_start_span_fn (const diagnostics::location_print_policy &, TextOrHtml &text_or_html, expanded_location) |
| void | default_text_finalizer (diagnostics::text_sink &, const diagnostics::diagnostic_info *, enum diagnostics::kind) |
| int | num_digits (uint64_t) |
| const char * | get_text_for_kind (enum kindkind kindkind) |
| const char * | get_debug_string_for_kind (enum kindkind kindkind) |
| const char * | get_color_for_kind (enum kindkind kindkind) |
| static int | convert_column_unit (file_cache &fc, enum diagnostics_column_unit column_unit, int tabstop, expanded_location s) |
| static void | print_escaped_string (pretty_printer *pp, const char *text) |
| static void | print_parseable_fixits (file_cache &fc, pretty_printer *pp, rich_location *richloc, enum diagnostics_column_unit column_unit, int tabstop) |
| char * | get_cwe_url (int cwe) |
| void | output_format_init (context &dc, const char *main_input_filename_, const char *base_file_name, enum diagnostics_output_format format, bool json_formatting) |
| pretty_printer * | get_printer (to_text &) |
| text_starter_fn & | text_starter (context *dc) |
| start_span_fn< to_text > & | start_span (context *dc) |
| text_finalizer_fn & | text_finalizer (context *dc) |
| static const char * | default_charset_callback (const char *) |
| static const char * | find_end_of_line (const char *s, size_t len) |
| static std::unique_ptr< xml::element > | make_div (std::string class_) |
| static std::unique_ptr< xml::element > | make_span (std::string class_) |
| static void | add_nesting_level_attr (xml::element &element, int nesting_level) |
| static void | print_pre_source (xml::printer &xp, const char *text) |
| static const char * | get_pf_class_for_alert_div (enum kind diag_kind) |
| static const char * | get_pf_class_for_alert_icon (enum kind diag_kind) |
| static const char * | get_label_for_logical_location_kind (enum logical_locations::kind kindkind) |
| static void | add_labelled_value (xml::printer &xp, std::string id, std::string label, std::string value, bool quote_value) |
| output_file | open_html_output_file (context &dc, line_maps *line_maps, const char *base_file_name) |
| std::unique_ptr< sink > | make_html_sink (context &dc, const line_maps &line_maps, const html_generation_options &html_gen_opts, output_file output_file_) |
| void | print_path_as_html (xml::printer &xp, const paths::path &path, context &dc, html_label_writer *event_label_writer, const source_print_policy &dspp) |
| void | maybe_unwind_expanded_macro_loc (text_sink &text_output, location_t where) |
| void | virt_loc_aware_text_finalizer (text_sink &text_output, const diagnostic_info *diagnostic) |
| static std::unique_ptr< json::string > | make_date_time_string_for_current_time () |
| static const char * | get_artifact_role_string (enum diagnostic_artifact_role role) |
| static const char * | get_string_for_location_relationship_kind (enum location_relationship_kind kindkind) |
| static int | bt_callback (void *data, uintptr_t pc, const char *filename, int lineno, const char *function) |
| static const char * | maybe_get_sarif_level (enum kind diag_kind) |
| static char * | make_rule_id_for_diagnostic_kind (enum kind diag_kind) |
| static char * | make_pwd_uri_str () |
| static const char * | maybe_get_sarif_kind (enum logical_locations::kind kindkind) |
| static void | copy_any_property_bag (const digraphs::object &input_obj, sarif_object &output_obj) |
| std::unique_ptr< sarif_graph > | make_sarif_graph (const digraphs::digraph &g, sarif_builder *builder, sarif_location_manager *sarif_location_mgr) |
| std::unique_ptr< sarif_node > | make_sarif_node (const digraphs::node &n, sarif_builder *builder, sarif_location_manager *sarif_location_mgr) |
| std::unique_ptr< sarif_edge > | make_sarif_edge (const digraphs::edge &e, sarif_builder *builder) |
| label_text | make_sarif_url_for_event (const sarif_code_flow *code_flow, paths::event_id_t event_id) |
| static std::string | escape_braces (const char *text) |
| static void | set_string_property_escaping_braces (json::object &obj, const char *property_name, const char *value) |
| static const char * | sarif_version_to_url (enum sarif_version version) |
| static const char * | sarif_version_to_property (enum sarif_version version) |
| static void | sarif_begin_embedded_link (pretty_printer *pp) |
| static void | sarif_end_embedded_link (pretty_printer *pp, const char *url) |
| static sink & | init_sarif_sink (context &dc, std::unique_ptr< sarif_sink > fmt) |
| sink & | init_sarif_stderr (context &dc, const line_maps *line_maps, bool formatted) |
| output_file | open_sarif_output_file (context &dc, line_maps *line_maps, const char *base_file_name, enum sarif_serialization_kind serialization_kind) |
| sink & | init_sarif_file (context &dc, line_maps *line_maps, bool formatted, const char *base_file_name) |
| sink & | init_sarif_stream (context &dc, const line_maps *line_maps, bool formatted, FILE *stream) |
| std::unique_ptr< sink > | make_sarif_sink (context &dc, const line_maps &line_maps, std::unique_ptr< sarif_serialization_format > serialization, const sarif_generation_options &sarif_gen_opts, output_file output_file_) |
| static const char * | get_dump_string_for_sarif_version (enum sarif_version version) |
| void | maybe_open_sarif_sink_for_socket (context &dc) |
| template<> | |
| void | default_start_span_fn< to_text > (const location_print_policy &loc_policy, to_text &out, expanded_location exploc) |
| template<> | |
| void | default_start_span_fn< to_html > (const location_print_policy &loc_policy, to_html &out, expanded_location exploc) |
| static unsigned | get_bullet_point_unichar (bool unicode) |
| static bool | use_unicode_p (const context &dc) |
| static unsigned | get_bullet_point_unichar (context &dc) |
| void | default_text_finalizer (text_sink &text_output, const diagnostic_info *diagnostic, enum kindkind) |
Variables | |
| static const char *const | diagnostic_kind_text [] |
| static const char *const | diagnostic_kind_debug_text [] |
| static const char *const | diagnostic_kind_color [] |
| static const char *const | HTML_STYLE |
| const char *const | HTML_SCRIPT |
| static const char *const | bt_stop [] |
Hooks for cfg representation specific functions. Copyright (C) 2003-2026 Free Software Foundation, Inc. Contributed by Sebastian Pop <s.pop@laposte.net> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Forward decl.
Declarations relating to class gcc_rich_location Copyright (C) 2014-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Various declarations for pretty formatting of GIMPLE statements and expressions. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Declarations for variables relating to reading the source file. Used by parsers, lexical analyzers, and error message routines. Copyright (C) 1993-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Default macros to initialize the lang_hooks data structure. Copyright (C) 2001-2026 Free Software Foundation, Inc. Contributed by Alexandre Oliva <aoliva@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
The lang_hooks data structure. Copyright (C) 2001-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
FIXME: This file should be #include-d after tree.h (for enum tree_code).
Print RTL for GCC. Copyright (C) 1987-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Support for buffering diagnostics before flushing them to output sinks. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Determining the results of applying fix-it hints. Copyright (C) 2016-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Additional metadata about a client for a diagnostic context. Copyright (C) 2022-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Options relating to the meaning of column numbers. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Declare diagnostics::context and related types. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Counts of per-kind diagnostics. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Various declarations for language-independent diagnostics subroutines. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Converting directed graphs to dot. Copyright (C) 2025-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Utilities for implementing "dump" functions for the diagnostics subsystem. Copyright (C) 2025-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Caching input files for use by diagnostics. Copyright (C) 2004-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
HTML output for diagnostics. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
An enum used to discriminate severities of diagnostics. Copyright (C) 1998-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Helper class for deferring path creation until a diagnostic is emitted. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Debugging code for logging what the diagnostics subsystem is doing. Copyright (C) 2025-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Logical location support, without knowledge of "tree". Copyright (C) 2022-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Code for unwinding macro expansions in diagnostics. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Additional metadata for a diagnostic. Copyright (C) 2019-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Stacks of set of classifications of diagnostics. Copyright (C) 1999-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Stacks of set of classifications of diagnostics. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Hooks for giving client-specific meaning to option ids. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Declaration of struct diagnostics::option_id. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
RAII class for managing FILE * for diagnostic formats. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
A namespace for handling the DSL of the arguments of -fdiagnostics-add-output= and -fdiagnostics-set-output= which look like: SCHEME[:KEY=VALUE(,KEY=VALUE)*] We call this an output spec.
Support for the DSL of -fdiagnostics-add-output= and -fdiagnostics-set-output=. Copyright (C) 2024-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Paths through the code associated with a diagnostic. Copyright (C) 2019-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Convenient but inefficient creation of location_t values. Copyright (C) 2023-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
SARIF output for diagnostics. Copyright (C) 2023-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Declarations for managing different output formats for diagnostics. Copyright (C) 2023-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Classes for adding special effects when quoting source code. Copyright (C) 2024-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Options relating to printing the user's source code. Copyright (C) 2000-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Disable warnings about quoting issues in the pp_xxx calls below that (intentionally) don't follow GCC diagnostic conventions.
Classic text-based output of diagnostics. Copyright (C) 2023-2026 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
| using diagnostics::start_span_fn |
| typedef void(*) diagnostics::text_finalizer_fn(text_sink &, const diagnostic_info *, enum kind) |
| typedef void(*) diagnostics::text_starter_fn(text_sink &, const diagnostic_info *) |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
static |
|
static |
References add_nesting_level_attr().
Referenced by diagnostics::html_builder::add_at_nesting_level(), add_nesting_level_attr(), and diagnostics::html_builder::push_nesting_level().
|
static |
A callback function passed to the backtrace_full function.
References json::array::append(), bt_callback(), bt_stop, free(), i, diagnostics::bt_closure::m_frames_arr, and json::array::size().
Referenced by bt_callback(), and diagnostics::sarif_builder::make_stack_from_backtrace().
|
static |
Given an expanded_location, convert the column (which is in 1-based bytes) to the requested units, without converting the origin. Return -1 if the column is invalid (<= 0).
References convert_column_unit(), DIAGNOSTICS_COLUMN_UNIT_BYTE, DIAGNOSTICS_COLUMN_UNIT_DISPLAY, gcc_unreachable, and location_compute_display_column().
Referenced by diagnostics::column_options::convert_column(), convert_column_unit(), and print_parseable_fixits().
|
static |
References json::value::clone(), copy_any_property_bag(), json::object::get(), json::object::get_key(), json::object::get_num_keys(), diagnostics::sarif_object::get_or_create_properties(), diagnostics::digraphs::object::get_property_bag(), i, and json::object::set().
Referenced by copy_any_property_bag(), make_sarif_edge(), make_sarif_graph(), and make_sarif_node().
|
static |
Input charset configuration.
References default_charset_callback().
Referenced by default_charset_callback(), and diagnostics::file_cache::initialize_input_context().
| void diagnostics::default_start_span_fn | ( | const diagnostics::location_print_policy & | , |
| TextOrHtml & | text_or_html, | ||
| expanded_location | ) |
| void diagnostics::default_start_span_fn< to_html > | ( | const location_print_policy & | loc_policy, |
| to_html & | out, | ||
| expanded_location | exploc ) |
| void diagnostics::default_start_span_fn< to_text > | ( | const location_print_policy & | loc_policy, |
| to_text & | out, | ||
| expanded_location | exploc ) |
| void diagnostics::default_text_finalizer | ( | diagnostics::text_sink & | , |
| const diagnostics::diagnostic_info * | , | ||
| enum diagnostics::kind | ) |
References default_text_finalizer().
Referenced by default_text_finalizer(), default_text_finalizer(), emit_json_diagnostic(), diagnostics::context::initialize(), and tree_diagnostics_defaults().
| void diagnostics::default_text_finalizer | ( | text_sink & | text_output, |
| const diagnostic_info * | diagnostic, | ||
| enum | kind ) |
| void diagnostics::default_text_starter | ( | diagnostics::text_sink & | text_output, |
| const diagnostics::diagnostic_info * | diagnostic ) |
|
static |
In "3.11.5 Messages with placeholders":
"Within both plain text and formatted message strings, the characters
"{" and "}" SHALL be represented by the character sequences
"{{" and "}}" respectively."
References escape_braces().
Referenced by escape_braces(), and set_string_property_escaping_braces().
|
static |
Helper function for file_cache_slot::get_next_line (), to find the end of the next line. Returns with the memchr convention, i.e. nullptr if a line terminator was not found. We need to determine line endings in the same manner that libcpp does: any of \n, \r\n, or \r is a line ending.
References end(), and find_end_of_line().
Referenced by find_end_of_line(), and diagnostics::file_cache_slot::get_next_line().
|
static |
Get a string for ROLE corresponding to the SARIF v2.1.0 section 3.24.6 "roles" property.
References analysis_target, debug_output_file, gcc_unreachable, get_artifact_role_string(), result_file, scanned_file, and traced_file.
Referenced by get_artifact_role_string(), and diagnostics::sarif_artifact::populate_roles().
|
static |
Get the unicode code point for bullet points when showing nested diagnostics.
References get_bullet_point_unichar().
Referenced by diagnostics::text_sink::build_indent_prefix(), get_bullet_point_unichar(), and get_bullet_point_unichar().
|
static |
Get the unicode code point for bullet points when showing nested diagnostics.
References get_bullet_point_unichar(), and use_unicode_p().
| const char * diagnostics::get_color_for_kind | ( | enum kind | kind | ) |
Get a color name for diagnostics of type KIND Result could be nullptr.
References diagnostic_kind_color, and get_color_for_kind().
Referenced by diagnostics::text_sink::build_prefix(), get_color_for_kind(), diagnostics::text_sink::print_any_cwe(), diagnostics::text_sink::print_any_rules(), and diagnostics::text_sink::print_option_information().
| char * diagnostics::get_cwe_url | ( | int | cwe | ) |
Generate a URL string describing CWE. The caller is responsible for freeing the string.
References get_cwe_url().
Referenced by get_cwe_url(), diagnostics::html_builder::make_element_for_metadata(), diagnostics::sarif_builder::make_reporting_descriptor_object_for_cwe_id(), and diagnostics::text_sink::print_any_cwe().
| const char * diagnostics::get_debug_string_for_kind | ( | enum kind | kind | ) |
References diagnostic_kind_debug_text, and get_debug_string_for_kind().
Referenced by get_debug_string_for_kind(), and diagnostics::logging::log_function_params::log_param_kind().
|
static |
References gcc_unreachable, get_dump_string_for_sarif_version(), v2_1_0, and v2_2_prerelease_2024_08_08.
Referenced by diagnostics::sarif_generation_options::dump(), and get_dump_string_for_sarif_version().
|
static |
References diagnostics::logical_locations::array, diagnostics::logical_locations::attribute, diagnostics::logical_locations::comment, diagnostics::logical_locations::declaration, diagnostics::logical_locations::dtd, diagnostics::logical_locations::element, diagnostics::logical_locations::function, gcc_unreachable, get_label_for_logical_location_kind(), diagnostics::logical_locations::member, diagnostics::logical_locations::module_, diagnostics::logical_locations::namespace_, diagnostics::logical_locations::object, diagnostics::logical_locations::parameter, diagnostics::logical_locations::processing_instruction, diagnostics::logical_locations::property, diagnostics::logical_locations::return_type, diagnostics::logical_locations::text, diagnostics::logical_locations::type, diagnostics::logical_locations::unknown, diagnostics::logical_locations::value, and diagnostics::logical_locations::variable.
Referenced by get_label_for_logical_location_kind(), and diagnostics::html_builder::make_element_for_diagnostic().
|
static |
See https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts
References gcc_unreachable, and get_pf_class_for_alert_div().
Referenced by get_pf_class_for_alert_div(), and diagnostics::html_builder::make_element_for_diagnostic().
|
static |
References gcc_unreachable, and get_pf_class_for_alert_icon().
Referenced by get_pf_class_for_alert_icon(), and diagnostics::html_builder::make_element_for_diagnostic().
|
extern |
References get_printer(), and diagnostics::to_text::m_pp.
Referenced by get_printer().
|
static |
| const char * diagnostics::get_text_for_kind | ( | enum kind | kind | ) |
Get unlocalized string describing KIND.
References diagnostic_kind_text, and get_text_for_kind().
Referenced by diagnostics::text_sink::build_prefix(), diagnostics::counters::dump(), fancy_abort(), get_text_for_kind(), diagnostics::html_builder::make_element_for_diagnostic(), and make_rule_id_for_diagnostic_kind().
| sink & diagnostics::init_sarif_file | ( | context & | dc, |
| line_maps * | line_maps, | ||
| bool | formatted, | ||
| const char * | base_file_name ) |
Populate DC in preparation for SARIF output to a file named BASE_FILE_NAME.sarif. Return a reference to the new sink.
References gcc_assert, init_sarif_file(), init_sarif_sink(), json, and open_sarif_output_file().
Referenced by init_sarif_file(), and output_format_init().
|
static |
Populate CONTEXT in preparation for SARIF output (either to stderr, or to a file). Return a reference to *FMT.
References gcc_assert, init_sarif_sink(), diagnostics::context::set_sink(), and diagnostics::sink::update_printer().
Referenced by init_sarif_file(), init_sarif_sink(), init_sarif_stderr(), and init_sarif_stream().
Populate DC in preparation for SARIF output to stderr. Return a reference to the new sink.
References gcc_assert, init_sarif_sink(), and init_sarif_stderr().
Referenced by init_sarif_stderr(), and output_format_init().
| sink & diagnostics::init_sarif_stream | ( | context & | dc, |
| const line_maps * | line_maps, | ||
| bool | formatted, | ||
| FILE * | stream ) |
Populate DC in preparation for SARIF output to STREAM. Return a reference to the new sink.
References gcc_assert, init_sarif_sink(), and init_sarif_stream().
Referenced by init_sarif_stream().
|
static |
Make a JSON string for the current date and time. See SARIF v2.1.0 section 3.9 "Date/time properties". Given that we don't run at the very beginning/end of the process, it doesn't make sense to be more accurate than the current second.
References make_date_time_string_for_current_time().
Referenced by make_date_time_string_for_current_time(), diagnostics::sarif_invocation::prepare_to_flush(), and diagnostics::sarif_invocation::sarif_invocation().
|
static |
References make_div().
Referenced by diagnostics::html_builder::add_graph_for_logical_loc(), make_div(), and diagnostics::html_builder::make_element_for_diagnostic().
| std::unique_ptr< sink > diagnostics::make_html_sink | ( | context & | dc, |
| const line_maps & | line_maps, | ||
| const html_generation_options & | html_gen_opts, | ||
| output_file | output_file_ ) |
References make_html_sink(), and diagnostics::sink::update_printer().
Referenced by make_html_sink(), and diagnostics::output_spec::html_scheme_handler::make_sink().
|
static |
Get the PWD, or nullptr, as an absolute file-based URI, adding a trailing forward slash (as required by SARIF v2.1.0 section 3.14.14).
References FILE_PREFIX, gcc_assert, and make_pwd_uri_str().
Referenced by diagnostics::sarif_builder::make_artifact_location_object_for_pwd(), and make_pwd_uri_str().
|
static |
Make a string for DIAG_KIND suitable for use a ruleId (SARIF v2.1.0 section 3.27.5) as a fallback for when we don't have anything better to use.
References gcc_assert, get_text_for_kind(), and make_rule_id_for_diagnostic_kind().
Referenced by diagnostics::sarif_builder::make_result_object(), and make_rule_id_for_diagnostic_kind().
| std::unique_ptr< sarif_edge > diagnostics::make_sarif_edge | ( | const digraphs::edge & | e, |
| sarif_builder * | builder ) |
References copy_any_property_bag(), diagnostics::sarif_builder::make_message_object(), and make_sarif_edge().
Referenced by make_sarif_edge(), make_sarif_graph(), and diagnostics::digraphs::edge::to_json_sarif_edge().
| std::unique_ptr< sarif_graph > diagnostics::make_sarif_graph | ( | const digraphs::digraph & | g, |
| sarif_builder * | builder, | ||
| sarif_location_manager * | sarif_location_mgr ) |
References copy_any_property_bag(), g, i, diagnostics::sarif_builder::make_message_object(), make_sarif_edge(), make_sarif_graph(), and make_sarif_node().
Referenced by diagnostics::digraphs::digraph::make_json_sarif_graph(), diagnostics::sarif_builder::make_result_object(), make_sarif_graph(), diagnostics::sarif_builder::report_digraph_for_logical_location(), diagnostics::sarif_builder::report_global_digraph(), and diagnostics::sarif_property_bag::set_graph().
| std::unique_ptr< sarif_node > diagnostics::make_sarif_node | ( | const digraphs::node & | n, |
| sarif_builder * | builder, | ||
| sarif_location_manager * | sarif_location_mgr ) |
| std::unique_ptr< sink > diagnostics::make_sarif_sink | ( | context & | dc, |
| const line_maps & | line_maps, | ||
| std::unique_ptr< sarif_serialization_format > | serialization, | ||
| const sarif_generation_options & | sarif_gen_opts, | ||
| output_file | output_file_ ) |
References make_sarif_sink(), and diagnostics::sink::update_printer().
Referenced by make_sarif_sink(), and diagnostics::output_spec::sarif_scheme_handler::make_sink().
| label_text diagnostics::make_sarif_url_for_event | ( | const sarif_code_flow * | code_flow, |
| paths::event_id_t | event_id ) |
References gcc_assert, diagnostics::sarif_code_flow::get_index_within_parent(), diagnostics::sarif_result::get_index_within_parent(), diagnostics::sarif_thread_flow::get_index_within_parent(), diagnostics::sarif_thread_flow_location::get_index_within_parent(), diagnostics::sarif_code_flow::get_parent(), diagnostics::sarif_thread_flow::get_parent(), diagnostics::sarif_thread_flow_location::get_parent(), diagnostics::sarif_code_flow::get_thread_flow_loc_obj(), diagnostic_event_id_t::known_p(), and make_sarif_url_for_event().
Referenced by make_sarif_url_for_event(), and diagnostics::sarif_builder::sarif_token_printer::print_tokens().
|
static |
|
static |
Attempt to get a string for a logicalLocation's "kind" property (SARIF v2.1.0 section 3.33.7). Return nullptr if unknown.
References diagnostics::logical_locations::array, diagnostics::logical_locations::attribute, diagnostics::logical_locations::comment, diagnostics::logical_locations::declaration, diagnostics::logical_locations::dtd, diagnostics::logical_locations::element, diagnostics::logical_locations::function, gcc_unreachable, maybe_get_sarif_kind(), diagnostics::logical_locations::member, diagnostics::logical_locations::module_, diagnostics::logical_locations::namespace_, diagnostics::logical_locations::object, diagnostics::logical_locations::parameter, diagnostics::logical_locations::processing_instruction, diagnostics::logical_locations::property, diagnostics::logical_locations::return_type, diagnostics::logical_locations::text, diagnostics::logical_locations::type, diagnostics::logical_locations::unknown, diagnostics::logical_locations::value, and diagnostics::logical_locations::variable.
Referenced by diagnostics::sarif_builder::ensure_sarif_logical_location_for(), and maybe_get_sarif_kind().
|
static |
Attempt to convert DIAG_KIND to a suitable value for the "level" property (SARIF v2.1.0 section 3.27.10). Return nullptr if there isn't one.
References maybe_get_sarif_level().
Referenced by diagnostics::sarif_builder::make_result_object(), and maybe_get_sarif_level().
| void diagnostics::maybe_open_sarif_sink_for_socket | ( | context & | dc | ) |
| void diagnostics::maybe_unwind_expanded_macro_loc | ( | text_sink & | text_output, |
| location_t | where ) |
Unwind the different macro expansions that lead to the token which
location is WHERE and emit diagnostics showing the resulting
unwound macro expansion trace. Let's look at an example to see how
the trace looks like. Suppose we have this piece of code,
artificially annotated with the line numbers to increase
legibility:
$ cat -n test.c
1 #define OPERATE(OPRD1, OPRT, OPRD2) \
2 OPRD1 OPRT OPRD2;
3
4 #define SHIFTL(A,B) \
5 OPERATE (A,<<,B)
6
7 #define MULT(A) \
8 SHIFTL (A,1)
9
10 void
11 g ()
12 {
13 MULT (1.0);// 1.0 << 1; <-- so this is an error.
14 }
Here is the diagnostic that we want the compiler to generate:
test.c: In function ‘g’:
test.c:5:14: error: invalid operands to binary << (have ‘double’ and ‘int’)
test.c:2:9: note: in definition of macro 'OPERATE'
test.c:8:3: note: in expansion of macro 'SHIFTL'
test.c:13:3: note: in expansion of macro 'MULT'
The part that goes from the third to the fifth line of this
diagnostic (the lines containing the 'note:' string) is called the
unwound macro expansion trace. That's the part generated by this
function.
References diagnostics::text_sink::append_note(), expand_location_to_spelling_point(), FOR_EACH_VEC_ELT, line_table, diagnostics::loc_map_pair::map, maybe_unwind_expanded_macro_loc(), and diagnostics::loc_map_pair::where.
Referenced by maybe_unwind_expanded_macro_loc(), and virt_loc_aware_text_finalizer().
|
extern |
Compute the number of digits in the decimal representation of an integer.
Get the number of digits in the decimal representation of VALUE.
References num_digits().
Referenced by dump_location_info(), and num_digits().
| diagnostics::output_file diagnostics::open_html_output_file | ( | context & | dc, |
| line_maps * | line_maps, | ||
| const char * | base_file_name ) |
Attempt to open BASE_FILE_NAME.html for writing. Return a non-null output_file, or return a null output_file and complain to DC using LINE_MAPS.
References diagnostics::context::emit_diagnostic_with_group(), fopen, open_html_output_file(), diagnostics::output_file::output_file(), and UNKNOWN_LOCATION.
Referenced by diagnostics::output_spec::html_scheme_handler::make_sink(), and open_html_output_file().
| output_file diagnostics::open_sarif_output_file | ( | context & | dc, |
| line_maps * | line_maps, | ||
| const char * | base_file_name, | ||
| enum sarif_serialization_kind | serialization_kind ) |
Attempt to open BASE_FILE_NAME.sarif for writing JSON. Return a non-null output_file, or return a null output_file and complain to DC using LINE_MAPS.
References gcc_unreachable, json, open_sarif_output_file(), and diagnostics::output_file::try_to_open().
Referenced by init_sarif_file(), diagnostics::output_spec::sarif_scheme_handler::make_sink(), and open_sarif_output_file().
| void diagnostics::output_format_init | ( | context & | dc, |
| const char * | main_input_filename_, | ||
| const char * | base_file_name, | ||
| enum diagnostics_output_format | format, | ||
| bool | json_formatting ) |
Set the output format for DC to FORMAT, using BASE_FILE_NAME for file-based output formats.
References DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE, DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR, DIAGNOSTICS_OUTPUT_FORMAT_TEXT, gcc_unreachable, init_sarif_file(), init_sarif_stderr(), line_table, output_format_init(), and diagnostics::sink::set_main_input_filename().
Referenced by common_handle_option(), driver_handle_option(), and output_format_init().
|
static |
Helper function for print_parseable_fixits. Print TEXT to PP, obeying the escaping rules for -fdiagnostics-parseable-fixits.
References gcc_assert, pp_character(), pp_printf(), pp_string(), and print_escaped_string().
Referenced by print_escaped_string(), and print_parseable_fixits().
|
static |
Implementation of -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT. Print a machine-parseable version of all fixits in RICHLOC to PP, using COLUMN_UNIT to express columns. Use TABSTOP when handling DIAGNOSTICS_COLUMN_UNIT_DISPLAY.
References convert_column_unit(), expand_location(), gcc_assert, i, pp_newline(), pp_printf(), pp_set_prefix(), pp_string(), pp_take_prefix(), print_escaped_string(), and print_parseable_fixits().
Referenced by print_parseable_fixits(), and diagnostics::context::report_diagnostic().
|
extern |
Print PATH_ as HTML to XP, using DC and DSPP for settings. If non-null, use EVENT_LABEL_WRITER when writing events.
References diagnostics::source_print_policy::get_options(), diagnostics::context::get_reference_printer(), diagnostics::source_printing_options::show_event_links_p, and diagnostics::context::show_path_depths_p().
Referenced by diagnostics::html_builder::make_element_for_diagnostic().
|
static |
|
static |
Print the start of an embedded link to PP, as per 3.11.6.
References pp_character(), and sarif_begin_embedded_link().
Referenced by diagnostics::sarif_builder::sarif_token_printer::print_tokens(), and sarif_begin_embedded_link().
|
static |
Print the end of an embedded link to PP, as per 3.11.6.
References pp_character(), pp_string(), and sarif_end_embedded_link().
Referenced by diagnostics::sarif_builder::sarif_token_printer::print_tokens(), and sarif_end_embedded_link().
|
static |
Convert VERSION to a value for the "version" property of a "sarifLog" object (SARIF v2.1.0 section 3.13.2).
References gcc_unreachable, sarif_version_to_property(), v2_1_0, and v2_2_prerelease_2024_08_08.
Referenced by diagnostics::sarif_builder::make_top_level_object(), and sarif_version_to_property().
|
static |
Convert VERSION to a value for the "$schema" property of a "sarifLog" object (SARIF v2.1.0 section 3.13.3).
References gcc_unreachable, sarif_version_to_url(), v2_1_0, and v2_2_prerelease_2024_08_08.
Referenced by diagnostics::sarif_builder::make_top_level_object(), and sarif_version_to_url().
|
static |
References escape_braces(), json::object::set_string(), and set_string_property_escaping_braces().
Referenced by diagnostics::sarif_builder::make_message_object(), diagnostics::sarif_builder::make_message_object_for_diagram(), diagnostics::sarif_builder::make_multiformat_message_string(), and set_string_property_escaping_braces().
|
inline |
Client supplied function called between disjoint spans of source code, so that the context can print something to indicate that a new span of source code has begun.
|
inline |
Client supplied function called after a diagnostic message is displayed (for text-based diagnostic output).
Referenced by diagnostics::text_sink::on_report_diagnostic(), and tree_diagnostics_defaults().
|
inline |
Client supplied function to announce a diagnostic (for text-based diagnostic output).
Referenced by diagnostic_manager::diagnostic_manager(), diagnostics::text_sink::on_report_diagnostic(), and tree_diagnostics_defaults().
Return true if DC's theme supports unicode characters.
References diagnostics::context::get_diagram_theme(), and use_unicode_p().
Referenced by get_bullet_point_unichar(), and use_unicode_p().
| void diagnostics::virt_loc_aware_text_finalizer | ( | text_sink & | text_output, |
| const diagnostic_info * | diagnostic ) |
This is a diagnostic finalizer implementation that is aware of virtual locations produced by libcpp. It has to be called by the diagnostic finalizer of front ends that uses libcpp and wish to get diagnostics involving tokens resulting from macro expansion. For a given location, if said location belongs to a token resulting from a macro expansion, this starter prints the context of the token. E.g, for multiply nested macro expansion, it unwinds the nested macro expansions and prints them in a manner that is similar to what is done for function call stacks, or template instantiation contexts.
References diagnostic_location(), maybe_unwind_expanded_macro_loc(), and virt_loc_aware_text_finalizer().
Referenced by virt_loc_aware_text_finalizer().
|
static |
Functions at which to stop the backtrace print. It's not particularly helpful to print the callers of these functions.
Referenced by bt_callback().
|
static |
Referenced by get_color_for_kind().
|
static |
Referenced by get_debug_string_for_kind().
|
static |
Referenced by get_text_for_kind().
| const char* const diagnostics::HTML_SCRIPT |
A little JavaScript for ease of navigation. Keys j/k move forward and backward cyclically through a list of focus ids (written out in another <script> tag as the HTML is flushed).
|
static |
class html_builder.
Style information for writing out HTML paths. Colors taken from https://pf3.patternfly.org/v3/styles/color-palette/