GCC Middle and Back End API Reference
|
Public Member Functions | |
sarif_result () | |
void | on_nested_diagnostic (diagnostic_context *context, const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, sarif_builder *builder) |
void | on_diagram (diagnostic_context *context, const diagnostic_diagram &diagram, sarif_builder *builder) |
sarif_property_bag & | get_or_create_properties () |
enum kind | get_kind () const final override |
void | print (pretty_printer *pp, bool formatted) const final override |
void | set (const char *key, value *v) |
value * | get (const char *key) const |
void | set_string (const char *key, const char *utf8_value) |
void | set_integer (const char *key, long v) |
void | set_float (const char *key, double v) |
void | set_bool (const char *key, bool v) |
void | dump (FILE *, bool formatted) const |
Private Types | |
typedef hash_map< char *, value *, simple_hashmap_traits< nofree_string_hash, value * > > | map_t |
Private Member Functions | |
void | add_related_location (json::object *location_obj) |
Private Attributes | |
json::array * | m_related_locations_arr |
map_t | m_map |
auto_vec< const char * > | m_keys |
Subclass of sarif_object for SARIF result objects (SARIF v2.1.0 section 3.27).
|
privateinherited |
|
inline |
|
private |
Add LOCATION_OBJ to this result's "relatedLocations" array, creating it if it doesn't yet exist.
References json::array::append(), ggc_alloc(), m_related_locations_arr, and json::object::set().
Referenced by on_diagram(), and on_nested_diagnostic().
class json::value.
Dump this json::value tree to OUTF. The key/value pairs of json::objects are printed in the order in which the keys were originally inserted.
References ggc_alloc(), pp_buffer, pp_flush(), and json::value::print().
Referenced by json_output_format::flush_to_file(), and generate_results().
Get the json::value * for KEY. The object retains ownership of the value.
References gcc_assert, json::object::get(), json::object::m_map, and NULL.
Referenced by json::object::get(), and sarif_object::get_or_create_properties().
|
inlinefinaloverridevirtualinherited |
Implements json::value.
References json::JSON_OBJECT.
|
inherited |
class sarif_object : public json::object.
References json::object::get(), ggc_alloc(), json::JSON_OBJECT, and json::object::set().
void sarif_result::on_diagram | ( | diagnostic_context * | context, |
const diagnostic_diagram & | diagram, | ||
sarif_builder * | builder ) |
Handle diagrams that occur within a diagnostic group. The closest thing in SARIF seems to be to add a location to the "releatedLocations" property (SARIF v2.1.0 section 3.27.22), and to put the diagram into the "message" property of that location (SARIF v2.1.0 section 3.28.5).
References add_related_location(), and ggc_alloc().
Referenced by sarif_builder::emit_diagram().
void sarif_result::on_nested_diagnostic | ( | diagnostic_context * | context, |
const diagnostic_info & | diagnostic, | ||
diagnostic_t | orig_diag_kind, | ||
sarif_builder * | builder ) |
class sarif_result : public sarif_object.
Handle secondary diagnostics that occur within a diagnostic group. The closest SARIF seems to have to nested diagnostics is the "relatedLocations" property of result objects (SARIF v2.1.0 section 3.27.22), so we lazily set this property and populate the array if and when secondary diagnostics occur (such as notes to a warning).
References add_related_location(), ggc_alloc(), NULL, pp_clear_output_area(), pp_formatted_text(), and diagnostic_context::printer.
Referenced by sarif_builder::end_diagnostic().
|
finaloverridevirtualinherited |
Implementation of json::value::print for json::object.
Implements json::value.
References FOR_EACH_VEC_ELT, ggc_alloc(), i, json::object::m_keys, json::object::m_map, pp_character(), pp_indent(), pp_indentation, pp_newline(), pp_space, pp_string(), json::value::print(), and print_escaped_json_string().
Referenced by generate_results().
Set the json::value * for KEY, taking ownership of V (and taking a copy of KEY if necessary).
References gcc_assert, hash_map< KeyId, Value, Traits >::get(), ggc_alloc(), json::object::m_keys, json::object::m_map, and hash_map< KeyId, Value, Traits >::put().
Referenced by optrecord_json_writer::add_record(), add_related_location(), generate_results(), sarif_object::get_or_create_properties(), optrecord_json_writer::inlining_chain_to_json(), json_from_location_range(), optrecord_json_writer::optinfo_to_json(), optrecord_json_writer::optrecord_json_writer(), output_intermediate_json_line(), output_json_intermediate_file(), optrecord_json_writer::pass_to_json(), sarif_invocation::prepare_to_flush(), sarif_ice_notification::sarif_ice_notification(), sarif_thread_flow::sarif_thread_flow(), json::object::set_bool(), json::object::set_float(), json::object::set_integer(), and json::object::set_string().
Set value of KEY within this object to the JSON literal true or false, based on V.
References json::object::set().
Referenced by sarif_invocation::prepare_to_flush().
Set value of KEY within this object to a JSON floating point value based on V.
References json::object::set().
Referenced by make_json_for_timevar_time_def().
Set value of KEY within this object to a JSON integer value based on V.
References json::object::set().
Referenced by optrecord_json_writer::impl_location_to_json(), json_from_expanded_location(), optrecord_json_writer::location_to_json(), make_json_for_timevar_time_def(), output_intermediate_json_line(), optrecord_json_writer::pass_to_json(), and optrecord_json_writer::profile_count_to_json().
Set value of KEY within this object to a JSON string value based on UTF8_VALUE.
References ggc_alloc(), and json::object::set().
Referenced by generate_results(), optrecord_json_writer::impl_location_to_json(), optrecord_json_writer::inlining_chain_to_json(), json_from_expanded_location(), json_from_location_range(), optrecord_json_writer::location_to_json(), optrecord_json_writer::optinfo_to_json(), optrecord_json_writer::optrecord_json_writer(), output_json_intermediate_file(), optrecord_json_writer::pass_to_json(), optrecord_json_writer::profile_count_to_json(), sarif_ice_notification::sarif_ice_notification(), and sarif_thread_flow::sarif_thread_flow().
Referenced by json::object::print(), and json::object::set().
|
privateinherited |
Referenced by json::object::get(), json::object::print(), json::object::set(), and json::object::~object().
|
private |
Referenced by add_related_location().