aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-10-02 10:44:54 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-10-02 10:44:54 -0400
commitdf7525d352379b4179a5872b7779d2a55c51891b (patch)
treeff7628e0e0fa52c9c6403d8da2afbdd1cc2f28a0 /libcpp/files.c
parent8f076a05a8dac3f11fc2de0a005ef89bc7f79925 (diff)
downloadgcc-df7525d352379b4179a5872b7779d2a55c51891b.zip
gcc-df7525d352379b4179a5872b7779d2a55c51891b.tar.gz
gcc-df7525d352379b4179a5872b7779d2a55c51891b.tar.bz2
diagnostics::output_spec: support client-specific keys
This patch adds the ability for users of diagnostics::output_spec to add custom key/values pairs to -fdiagnostics-{add,set}-output=SCHEME:KEY=VALUE The intent is for allow e.g. capturing compiler-specific information in SARIF sinks (CFGs, inheritance hierarchies, etc) gcc/ChangeLog: * diagnostics/output-spec.cc: (scheme_handler::parse_bool_value): Convert to... (key_handler::parse_bool_value): ...this. (scheme_handler::parse_enum_value): Convert to... (key_handler::parse_enum_value): ...this. (struct text_scheme_handler::decoded_args): Eliminate, moving fields into class text_scheme_handler. (text_scheme_handler::text_scheme_handler): Initialize the new fields. Add a "dc" param and use it to initialize m_show_color. (struct sarif_scheme_handler::decoded_args): Eliminate, moving fields into class sarif_scheme_handler. (sarif_scheme_handler::sarif_scheme_handler): Initialize the new fields. (struct html_scheme_handler::decoded_args): Eliminate, moving fields into class html_scheme_handler. (html_scheme_handler::html_scheme_handler): Initialize the new fields. (context::report_unknown_key): Get keys from scheme rather than passing them in. Support client keys. (context::parse_and_make_sink): Pass dc to output_factory ctor. (output_factory::output_factory): Pass dc to text_scheme_handler. (output_factory::get_scheme_handler): Make return non-const. (output_factory::make_sink): Move key-handling here, rather than in individual sinks. (context::handle_kv): New. (text_scheme_handler::make_sink): Eliminate key decoding. (text_scheme_handler::decode_kv): Convert to... (text_scheme_handler::maybe_handle_kv): ...this... (text_scheme_handler::get_keys): ...and this. (sarif_scheme_handler::make_sink): Eliminate key decoding. (sarif_scheme_handler::decode_kv): Convert to... (sarif_scheme_handler::maybe_handle_kv): ...this... (sarif_scheme_handler::get_keys): ...and this. (html_scheme_handler::make_sink): Eliminate key decoding. (html_scheme_handler::decode_kv): Convert to... (html_scheme_handler::maybe_handle_kv): ...this... (html_scheme_handler::get_keys): ...and this. (struct selftest::parser_test): Add "client_keys" arg, and update for new param ordering. (selftest::parser_test::parse_and_make_sink): New. (selftest::test_output_arg_parsing): Move auto-fixes to caller. (class selftest::test_key_handler): New. (selftest::test_client_arg_parsing): New test. (selftest::output_spec_cc_tests): Call it. * diagnostics/output-spec.h (class key_handler): New. (class scheme_handler): Move here from output-spec.cc. (context::report_unknown_key): Simplify params. (context::handle_kv): Update params. (context::context): Add "client_keys" param. (context::m_client_keys): New field. (struct dc_spec_context): Update order of params. Add "client_keys" param. * libgdiagnostics.cc (spec_context::spec_context): Pass nullptr for client keys. * opts-diagnostic.cc (opt_spec_context::opt_spec_context): Likewise. Update for new param ordering. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'libcpp/files.c')
0 files changed, 0 insertions, 0 deletions