Merge pull request #35414 from nkcsgexi/volatile-open-input

Frontend: add an option -bad-file-descriptor-retry-count
This commit is contained in:
Xi Ge
2021-01-15 12:58:55 -08:00
committed by GitHub
9 changed files with 80 additions and 11 deletions

View File

@@ -657,8 +657,13 @@ Optional<ModuleBuffers> CompilerInstance::getInputBuffersIfPresent(
// FIXME: Working with filenames is fragile, maybe use the real path
// or have some kind of FileManager.
using FileOrError = llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>;
FileOrError inputFileOrErr = swift::vfs::getFileOrSTDIN(getFileSystem(),
input.getFileName());
FileOrError inputFileOrErr =
swift::vfs::getFileOrSTDIN(getFileSystem(), input.getFileName(),
/*FileSize*/-1,
/*RequiresNullTerminator*/true,
/*IsVolatile*/false,
/*Bad File Descriptor Retry*/getInvocation().getFrontendOptions()
.BadFileDescriptorRetryCount);
if (!inputFileOrErr) {
Diagnostics.diagnose(SourceLoc(), diag::error_open_input_file,
input.getFileName(),