David Malcolm 0d5af6a757 sarif output: add descriptions to fix-it hints (§3.55.2) [PR121986]
SARIF "fix" objects SHOULD have a "description" property (§3.55.2) that
describes the proposed fix, but currently GCC's SARIF output doesn't
support this, and we don't capture this anywhere internally as we build
fix-it hints in the compiler.

Currently we can have zero or more instances of fixit_hint associated
with a diagnostic, each representing an edit of a range of the source
code. Ideally we would have an internal API that allowed for associating
multiple fixes with a diagnostic, each with a description worded in terms
of the source language (e.g. "Fix 'colour' mispelling of field 'color'"),
and each consisting of multiple edited ranges.

For now, this patch extends the sarif output sink so that it
autogenerates descriptions of fix-it hints for simple cases of
insertion, deletion, and replacement of a single range
(e.g. "Replace 'colour' with 'color'").

gcc/ChangeLog:
	PR diagnostics/121986
	* diagnostics/sarif-sink.cc: Include "intl.h".
	(sarif_builder::make_message_describing_fix_it_hint): New.
	(sarif_builder::make_fix_object): Attempt to auto-generate a
	description for fix-it hints.

gcc/testsuite/ChangeLog:
	PR diagnostics/121986
	* gcc.dg/sarif-output/extra-semicolon.c: New test.
	* gcc.dg/sarif-output/extra-semicolon.py: New test.
	* gcc.dg/sarif-output/missing-semicolon.py: Verify the description
	of the insertion fix-it hint.
	* libgdiagnostics.dg/test-fix-it-hint-c.py: Verify the description
	of the replacement fix-it hint.

libcpp/ChangeLog:
	PR diagnostics/121986
	* include/rich-location.h (fixit_hint::deletion_p): New accessor.
	(fixit_hint::replacement_p): New accessor.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-09-23 16:45:12 -04:00
2025-08-29 00:19:55 +00:00
2025-08-17 00:19:17 +00:00
2025-09-20 00:20:23 +00:00
2025-09-06 00:20:34 +00:00
2025-09-03 00:20:18 +00:00
2025-09-20 00:20:23 +00:00
2025-09-19 00:20:17 +00:00
2025-08-17 00:19:17 +00:00
2025-09-08 00:20:50 +00:00
2025-09-02 00:19:26 +00:00
2025-09-23 00:20:06 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.7 GiB
Languages
C++ 30.7%
C 30.1%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.5%