GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "diagnostic.h"
#include "selftest-diagnostic.h"
#include "diagnostic-metadata.h"
#include "diagnostic-path.h"
#include "diagnostic-format.h"
#include "diagnostic-buffer.h"
#include "json.h"
#include "selftest.h"
#include "diagnostic-client-data-hooks.h"
#include "logical-location.h"
Data Structures | |
class | diagnostic_json_format_buffer |
class | json_output_format |
class | json_stderr_output_format |
class | json_file_output_format |
Macros | |
#define | INCLUDE_VECTOR |
#define INCLUDE_VECTOR |
JSON output for diagnostics Copyright (C) 2018-2025 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/>.
|
static |
Populate CONTEXT in preparation for JSON output (either to stderr, or to a file) using FMT. Return a reference to *FMT.
References gcc_assert, pp_show_color(), diagnostic_context::set_output_format(), and diagnostic_context::set_show_highlight_colors().
Referenced by diagnostic_output_format_init_json_file(), and diagnostic_output_format_init_json_stderr().
diagnostic_output_format & diagnostic_output_format_init_json_file | ( | diagnostic_context & | context, |
bool | formatted, | ||
const char * | base_file_name ) |
Populate CONTEXT in preparation for JSON output to a file named BASE_FILE_NAME.gcc.json. Return a reference to the context's new sink.
References base_file_name(), and diagnostic_output_format_init_json().
Referenced by diagnostic_output_format_init().
diagnostic_output_format & diagnostic_output_format_init_json_stderr | ( | diagnostic_context & | context, |
bool | formatted ) |
Populate CONTEXT in preparation for JSON output to stderr. Return a reference to the context's new sink.
References diagnostic_output_format_init_json().
Referenced by diagnostic_output_format_init().
|
static |
Generate a JSON object for LOC.
References diagnostic_column_policy::converted_column(), DIAGNOSTICS_COLUMN_UNIT_BYTE, DIAGNOSTICS_COLUMN_UNIT_DISPLAY, expand_location(), gcc_assert, i, INT_MIN, and diagnostic_context::m_column_unit.
Referenced by json_from_fixit_hint(), json_from_location_range(), and make_json_for_path().
|
static |
Generate a JSON object for HINT.
References json_from_expanded_location().
Referenced by json_output_format::on_report_diagnostic().
|
static |
Generate a JSON object for LOC_RANGE.
References get_finish(), get_pure_location(), get_start(), json_from_expanded_location(), text, and UNKNOWN_LOCATION.
Referenced by json_output_format::on_report_diagnostic().
|
static |
Generate a JSON object for METADATA.
References diagnostic_metadata::get_cwe().
Referenced by json_output_format::on_report_diagnostic().
|
static |
Make a JSON value for PATH.
References pretty_printer::clone(), diagnostic_context::get_client_data_hooks(), i, json_from_expanded_location(), path, and pp_formatted_text().
Referenced by json_output_format::on_report_diagnostic().