[NFC] Fix issues with -verify mode

This commit fixes two weird bugs in -verify mode:

1. SourceLocs from the wrong SourceManager could be passed through a ForwardingDiagnosticConsumer into the DiagnosticVerifier.

2. -verify-additional-file did not error out correctly when the file couldn’t be opened.

No tests, as we only have basic tests for the diagnostic verifier.
This commit is contained in:
Becca Royal-Gordon
2021-03-25 00:16:55 -07:00
parent b676f29f25
commit 1f713074ac
4 changed files with 46 additions and 0 deletions

View File

@@ -307,6 +307,7 @@ bool CompilerInstance::setupDiagnosticVerifierIfNeeded() {
Diagnostics.diagnose(SourceLoc(), diag::error_open_input_file,
filename, result.getError().message());
hadError |= true;
continue;
}
auto bufferID = SourceMgr.addNewSourceBuffer(std::move(result.get()));