Skip to content
Snippets Groups Projects
Commit 5a30a3ab authored by David Malcolm's avatar David Malcolm
Browse files

sarif-replay: improve error for unescaped braces in messages (§3.11.5)

Spotted via https://github.com/llvm/llvm-project/issues/128024



gcc/ChangeLog:
	* libsarifreplay.cc
	(sarif_replayer::make_plain_text_within_result_message): Capture
	which json::string was used.  When reporting on unescaped "{" or
	"}" in SARIF message strings, use that string rather than the
	message object, and refer the user to §3.11.5 ("Messages with
	placeholders") rather than §3.11.11 ("arguments").  Ideally we'd
	place the error at the precise character, but that can't be done
	without reworking json-parsing.cc's lexer::lex_string, which is
	too invasive for stage 4.
	(sarif_replayer::get_plain_text_from_mfms): Capture which
	json::string was used.
	(sarif_replayer::lookup_plain_text_within_result_message):
	Likewise.

gcc/testsuite/ChangeLog:
	* sarif-replay.dg/2.1.0-invalid/3.11.11-malformed-placeholder.sarif:
	Rename to...
	* sarif-replay.dg/2.1.0-invalid/3.11.5-unescaped-braces.sarif:
	...this.  Update expected subsection in error message, and
	expected underline in quoted JSON.

Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
parent 25fa8d6d
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment