Skip to content

Commit 86e039f

Browse files
committed
Suppress the output of the PrintingDiagnosticConsumer when in Frontend Parseable-Output mode
1 parent 942cb08 commit 86e039f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,8 @@ int swift::performFrontend(ArrayRef<const char *> Args,
19151915

19161916
std::unique_ptr<CompilerInstance> Instance =
19171917
std::make_unique<CompilerInstance>();
1918+
1919+
// In parseable output, avoid printing diagnostics
19181920
Instance->addDiagnosticConsumer(&PDC);
19191921

19201922
struct FinishDiagProcessingCheckRAII {
@@ -2022,6 +2024,11 @@ int swift::performFrontend(ArrayRef<const char *> Args,
20222024
Invocation.getFrontendOptions().InputsAndOutputs,
20232025
FileSpecificDiagnostics);
20242026
Instance->addDiagnosticConsumer(FileSpecificAccumulatingConsumer.get());
2027+
2028+
// If we got this far, we need to suppress the output of the
2029+
// PrintingDiagnosticConsumer to ensure that only the parseable-output
2030+
// is emitted
2031+
PDC.setSuppressOutput(true);
20252032
}
20262033

20272034
// Because the serialized diagnostics consumer is initialized here,

0 commit comments

Comments
 (0)