aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.cc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-02-15 08:15:58 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2025-02-15 08:15:58 -0500
commit79c311d42f846f3e65e012d66e5d8fde4c3b1958 (patch)
tree931b48218bd09e554f772a0d452bc0b6a3875b60 /gcc/fortran/trans-expr.cc
parenta1f63ea36e9c9f2f66980dccc76d18cf781716a7 (diff)
downloadgcc-79c311d42f846f3e65e012d66e5d8fde4c3b1958.zip
gcc-79c311d42f846f3e65e012d66e5d8fde4c3b1958.tar.gz
gcc-79c311d42f846f3e65e012d66e5d8fde4c3b1958.tar.bz2
sarif-replay: handle relatedLocations without messages (§3.27.22)
Given the .sarif output from e.g.: too-many-arguments.c: In function 'test_known_fn': too-many-arguments.c:14:3: error: too many arguments to function 'fn_a'; expected 0, have 1 14 | fn_a (42); | ^~~~ ~~ too-many-arguments.c:8:13: note: declared here 8 | extern void fn_a (); | ^~~~ the underlining of the stray argument (the "42") is captured in 'relatedLocations' (§3.27.22) but previously sarif-replay would not display this: In function 'test_known_fn': too-many-arguments.c:14:3: error: too many arguments to function 'fn_a'; expected 0, have 1 [error] 14 | fn_a (42); | ^~~~ too-many-arguments.c:8:13: note: declared here 8 | extern void fn_a (); | ^~~~ With this patch sarif-replay handles the relatedLocations element as a secondary location in libgdiagnostics, and correctly underlines the "42": In function 'test_known_fn': too-many-arguments.c:14:3: error: too many arguments to function 'fn_a'; expected 0, have 1 [error] 14 | fn_a (42); | ^~~~ ~~ too-many-arguments.c:8:13: note: declared here 8 | extern void fn_a (); | ^~~~ gcc/ChangeLog: * libsarifreplay.cc (sarif_replayer::handle_result_obj): Treat any relatedLocations without messages as secondary ranges within the diagnostic. Doing so requires stashing the notes until after the diagnostic has been finished, so that relatedLocations can be walked in one pass. gcc/testsuite/ChangeLog: * sarif-replay.dg/2.1.0-valid/unlabelled-secondary-locations.sarif: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
0 files changed, 0 insertions, 0 deletions