]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostics: support XML and JSON kinds of logical locations
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 6 May 2025 13:26:18 +0000 (09:26 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 6 May 2025 13:26:18 +0000 (09:26 -0400)
commit9fb44cc4823106729d086713dd022a4590703a4c
tree93efb07f8a0edd5f6c1d5d2f271205b9d8504d4f
parentf25e178b8c2cc868168b0a29ab03260fbefa4ff7
diagnostics: support XML and JSON kinds of logical locations

gcc/ChangeLog:
* diagnostic-format-sarif.cc (maybe_get_sarif_kind): Add cases for
new kinds of logical location.
* doc/libgdiagnostics/topics/logical-locations.rst: Add new kinds
of logical location for handling XML and JSON.
* libgdiagnostics.cc (impl_logical_location_manager::get_kind):
Add cases for new kinds of logical location.
(diagnostic_text_sink::text_starter): Likewise, introducing a
macro for this.
(diagnostic_manager_debug_dump_logical_location): Likewise.
* libgdiagnostics.h (enum diagnostic_logical_location_kind_t): Add
new kinds of logical location for handling XML and JSON.
* libsarifreplay.cc (handle_logical_location_object): Add entries
to "kind_values" for decoding sarif logical location kinds
relating to XML and JSON.
* logical-location.h (enum logical_location_kind): Add new kinds
of logical location for handling XML and JSON.

gcc/testsuite/ChangeLog:
* libgdiagnostics.dg/test-nested-logical-locations-json-c.py: New test.
* libgdiagnostics.dg/test-nested-logical-locations-json.c: New test.
* sarif-replay.dg/2.1.0-valid/3.33.7-json-example.sarif: New test.
* sarif-replay.dg/2.1.0-valid/3.33.7-xml-example.sarif: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic-format-sarif.cc
gcc/doc/libgdiagnostics/topics/logical-locations.rst
gcc/libgdiagnostics.cc
gcc/libgdiagnostics.h
gcc/libsarifreplay.cc
gcc/logical-location.h
gcc/testsuite/libgdiagnostics.dg/test-nested-logical-locations-json-c.py [new file with mode: 0644]
gcc/testsuite/libgdiagnostics.dg/test-nested-logical-locations-json.c [new file with mode: 0644]
gcc/testsuite/sarif-replay.dg/2.1.0-valid/3.33.7-json-example.sarif [new file with mode: 0644]
gcc/testsuite/sarif-replay.dg/2.1.0-valid/3.33.7-xml-example.sarif [new file with mode: 0644]