Support printing the diagnostic kind for verification. (#4425)

This is to help identify which diagnostics we're actually using.

Note that driver/testdata still has tests which don't pass this flag,
and so continue to test the kind-less (default) behavior.
This commit is contained in:
Jon Ross-Perkins
2024-10-18 22:33:56 +00:00
committed by GitHub
parent e3950298cf
commit 62c36eceda
530 changed files with 1951 additions and 1931 deletions
+11 -1
View File
@@ -141,6 +141,15 @@ of a binary object file instead. Ignored for other `--output` values.
},
[&](auto& arg_b) { arg_b.Set(&force_obj_output); });
b.AddFlag(
{
.name = "include-diagnostic-kind",
.help = R"""(
When printing diagnostics, include the diagnostic kind as part of output. This
applies to each message that forms a diagnostic, not just the primary message.
)""",
},
[&](auto& arg_b) { arg_b.Set(&include_diagnostic_kind); });
b.AddFlag(
{
.name = "stream-errors",
@@ -635,7 +644,8 @@ auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
}
// Prepare CompilationUnits before building scope exit handlers.
StreamDiagnosticConsumer stream_consumer(driver_env.error_stream);
StreamDiagnosticConsumer stream_consumer(driver_env.error_stream,
options_.include_diagnostic_kind);
llvm::SmallVector<std::unique_ptr<CompilationUnit>> units;
units.reserve(prelude.size() + options_.input_filenames.size());