mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user