mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Frontend: add an option -bad-file-descriptor-retry-count
This option allows the compiler to retry opening an input file if the previous opening returns an error of bad file descriptor. Swift-driver will set this argument in certain circumstances to walk-around such error. rdar://73157185
This commit is contained in:
@@ -668,8 +668,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(),
|
||||
|
||||
Reference in New Issue
Block a user