]> git.ipfire.org Git - thirdparty/gcc.git/commit
sarif-replay: support "cached" logical locations [§3.33.3]
authorDavid Malcolm <dmalcolm@redhat.com>
Sat, 1 Feb 2025 13:38:13 +0000 (08:38 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Sat, 1 Feb 2025 13:38:13 +0000 (08:38 -0500)
commitcf24c0fa53870da6e666a97b79c4b053317c4951
tree4e58b9487eec7526ecf7dfdb243d68ba48b89210
parent8ca6bbf84c168056c94b5f0374fb82916ee24772
sarif-replay: support "cached" logical locations [§3.33.3]

Some SARIF files offload most of the properties within logical locations
in the results to an array of "cached" instances in
theRun.logicalLocations, so the information can be consolidated (and to
support the "parentIndex" property, which is PR 116176).

Support such files in sarif-replay.

gcc/ChangeLog:
* libsarifreplay.cc (sarif_replayer::handle_run_obj): Pass run to
handle_result_obj.
(sarif_replayer::handle_result_obj): Add run_obj param and pass it
to handle_location_object and handle_thread_flow_object.
(sarif_replayer::handle_thread_flow_object): Add run_obj param and
pass it to handle_thread_flow_location_object.
(sarif_replayer::handle_thread_flow_location_object): Add run_obj
param and pass it to handle_location_object.
(sarif_replayer::handle_location_object): Add run_obj param and
pass it to handle_logical_location_object.
(sarif_replayer::handle_logical_location_object): Add run_obj
param.  If the run_obj is non-null and has "logicalLocations",
then use these "cached" logical locations if we see an "index"
property, as per §3.33.3

gcc/testsuite/ChangeLog:
* sarif-replay.dg/2.1.0-invalid/3.33.3-index-out-of-range.sarif:
New test.
* sarif-replay.dg/2.1.0-valid/spec-example-4.sarif: Update expected
output to reflect that we now find the function name for the
events in the path.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/libsarifreplay.cc
gcc/testsuite/sarif-replay.dg/2.1.0-invalid/3.33.3-index-out-of-range.sarif [new file with mode: 0644]
gcc/testsuite/sarif-replay.dg/2.1.0-valid/spec-example-4.sarif