On Tue, 2024-11-12 at 09:02 -0500, David Malcolm wrote:
> Previously the diagnostic subsystem supported a one-deep
> hierarchy via auto_diagnostic_group, for associating
> notes with the warning/error they annotate; this only
> affects SARIF output, not text output.
> 
> This patch adds support to the diagnostics subsystem for
> capturing arbitrarily deep nesting structure within
> diagnostic messages.
> 
> This patch:
> * adds the ability to express nesting internally when
>   building diagnostics
> * captures the nesting in SARIF output in the form documented
>   in SG15's P3358R0 ("SARIF for Structured Diagnostics") via
>   a "nestingLevel" property
> * adds a new experimental mode to text output to see the
>   hierarchy, via:
>   -fdiagnostics-set-output=text:experimental-nesting=yes
> * adds test coverage via a plugin, which with the above
>   option emits:
>   • note: child 0
>     • note: grandchild 0 0
>     • note: grandchild 0 1
>     • note: grandchild 0 2
>   • note: child 1
>     • note: grandchild 1 0
>     • note: grandchild 1 1
>     • note: grandchild 1 2
>   • note: child 2
>     • note: grandchild 2 0
>     • note: grandchild 2 1
>     • note: grandchild 2 2
>   using '*' rather than '•' if the text_art::theme is ascii-only.
> 
> My hope is to eventually:
> (a) use this to improve C++'s template diagnostics
> (b) remove the "experimental" caveat from the the text output mode
> 
> but this patch doesn't touch the C++ frontend, leaving both of these
> to followup work.

I've pushed this one as r15-5417-ga5af2ec16fa759, but ideally the other
two (and the followups) would get review from a C++ maintainer.

Dave

Reply via email to