GCC Middle and Back End API Reference
diagnostic-format-json.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "diagnostic.h"
#include "selftest-diagnostic.h"
#include "diagnostic-metadata.h"
#include "json.h"
#include "selftest.h"
#include "diagnostic.def"
Include dependency graph for diagnostic-format-json.cc:

Data Structures

class  json_output_format
 
class  json_stderr_output_format
 
class  json_file_output_format
 

Macros

#define DEFINE_DIAGNOSTIC_KIND(K, T, C)   (T),
 

Functions

json::valuejson_from_expanded_location (diagnostic_context *context, location_t loc)
 
static json::objectjson_from_location_range (diagnostic_context *context, const location_range *loc_range, unsigned range_idx)
 
static json::objectjson_from_fixit_hint (diagnostic_context *context, const fixit_hint *hint)
 
static json::objectjson_from_metadata (const diagnostic_metadata *metadata)
 
static void diagnostic_output_format_init_json (diagnostic_context *context)
 
void diagnostic_output_format_init_json_stderr (diagnostic_context *context, bool formatted)
 
void diagnostic_output_format_init_json_file (diagnostic_context *context, bool formatted, const char *base_file_name)
 

Macro Definition Documentation

◆ DEFINE_DIAGNOSTIC_KIND

#define DEFINE_DIAGNOSTIC_KIND ( K,
T,
C )   (T),

Function Documentation

◆ diagnostic_output_format_init_json()

◆ diagnostic_output_format_init_json_file()

void 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.   

References base_file_name(), diagnostic_output_format_init_json(), ggc_alloc(), and diagnostic_context::set_output_format().

Referenced by diagnostic_output_format_init().

◆ diagnostic_output_format_init_json_stderr()

void diagnostic_output_format_init_json_stderr ( diagnostic_context * context,
bool formatted )
Populate CONTEXT in preparation for JSON output to stderr.   

References diagnostic_output_format_init_json(), ggc_alloc(), and diagnostic_context::set_output_format().

Referenced by diagnostic_output_format_init().

◆ json_from_expanded_location()

◆ json_from_fixit_hint()

static json::object * json_from_fixit_hint ( diagnostic_context * context,
const fixit_hint * hint )
static
Generate a JSON object for HINT.   

References ggc_alloc(), and json_from_expanded_location().

Referenced by json_output_format::on_end_diagnostic().

◆ json_from_location_range()

static json::object * json_from_location_range ( diagnostic_context * context,
const location_range * loc_range,
unsigned range_idx )
static

◆ json_from_metadata()

static json::object * json_from_metadata ( const diagnostic_metadata * metadata)
static
Generate a JSON object for METADATA.   

References diagnostic_metadata::get_cwe(), and ggc_alloc().

Referenced by json_output_format::on_end_diagnostic().