optional pointer to consumer replaces NullDiagnosticConsumer placeholder

This commit is contained in:
David Ungar
2018-05-09 17:18:13 -07:00
parent dc5827cf22
commit 02fcbf7226
5 changed files with 66 additions and 16 deletions

View File

@@ -1527,6 +1527,19 @@ createDispatchingDiagnosticConsumerIfNeeded(
subConsumers.emplace_back(input.file(), std::move(subConsumer));
return false;
});
// For batch mode, the compiler must swallow diagnostics pertaining to
// non-primary files in order to avoid Xcode showing the same diagnostic
// multiple times. So, create a diagnostic "eater" for those non-primary
// files.
// To avoid introducing bugs into WMO or single-file modes, test for multiple
// primaries.
if (inputsAndOutputs.hasMultiplePrimaryInputs()) {
inputsAndOutputs.forEachInputNotProducingSupplementaryOutput(
[&](const InputFile &input) -> bool {
subConsumers.emplace_back(input.file(), nullptr);
return false;
});
}
if (subConsumers.empty())
return nullptr;