diff options
author | David Malcolm <dmalcolm@redhat.com> | 2024-12-16 11:22:50 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2024-12-16 11:22:50 -0500 |
commit | 2af541920787e333a25b6524e6b94200f128ba13 (patch) | |
tree | 6ed751d6904c93d9628b6d14ff0131ef1fb67bd1 /gcc/tree-inline.h | |
parent | 778336e0e4f25745f76a127801dc3bab5e9c1334 (diff) | |
download | gcc-2af541920787e333a25b6524e6b94200f128ba13.zip gcc-2af541920787e333a25b6524e6b94200f128ba13.tar.gz gcc-2af541920787e333a25b6524e6b94200f128ba13.tar.bz2 |
libgdiagnostics: consolidate logical locations
This patch updates diagnostic_manager_new_logical_location so
that repeated calls with the same input values yield the same
instance of diagnostic_logical_location.
Doing so allows the path-printing logic to properly consolidate runs of
events, whereas previously it could treat each event as having a
distinct logical location, and thus require them to be printed
separately; this greatly improves the output of sarif-replay when
displaying execution paths.
gcc/ChangeLog:
* doc/libgdiagnostics/topics/logical-locations.rst
(diagnostic_manager_new_logical_location): Add note about repeated
calls.
* libgdiagnostics.cc: Define INCLUDE_MAP.
(class owned_nullable_string): Add copy ctor and move ctor.
(owned_nullable_string::operator<): New.
(diagnostic_logical_location::operator<): New.
(diagnostic_manager::new_logical_location): Use m_logical_locs to
"uniquify" instances, converting it to a std::map.
(diagnostic_manager::logical_locs_map_t): New typedef.
(diagnostic_manager::t m_logical_locs): Convert from a std::vector
to a std::map.
(diagnostic_execution_path::same_function_p): Update comment.
gcc/testsuite/ChangeLog:
* libgdiagnostics.dg/test-logical-location.c: Include <assert.h>.
Verify that creating a diagnostic_logical_location with equal
values yields the same instance.
* sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif: New test.
* sarif-replay.dg/2.1.0-valid/signal-1.c.moved.sarif: Update
expected output to show logical location and for consolidation of
events into runs.
* sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: Likewise.
* sarif-replay.dg/2.1.0-valid/spec-example-4.sarif: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/tree-inline.h')
0 files changed, 0 insertions, 0 deletions