Skip to content

Commit 449424f

Browse files
author
Nathan Hawes
authored
Merge pull request swiftlang#35779 from nathawes/driver-vfs-source-files
[Driver] Don't check input file existence if a -vfsoverlay arg is present.
2 parents e8b36ab + 3859ae6 commit 449424f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Driver/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,7 @@ void Driver::buildInputs(const ToolChain &TC,
12841284
const DerivedArgList &Args,
12851285
InputFileList &Inputs) const {
12861286
llvm::DenseMap<StringRef, StringRef> SourceFileNames;
1287+
bool HasVFS = Args.hasArg(options::OPT_vfsoverlay);
12871288

12881289
for (Arg *A : Args) {
12891290
if (A->getOption().getKind() == Option::InputClass) {
@@ -1305,7 +1306,7 @@ void Driver::buildInputs(const ToolChain &TC,
13051306
}
13061307
}
13071308

1308-
if (checkInputExistence(*this, Args, Diags, Value))
1309+
if (HasVFS || checkInputExistence(*this, Args, Diags, Value))
13091310
Inputs.push_back(std::make_pair(Ty, A));
13101311

13111312
if (Ty == file_types::TY_Swift) {

test/Driver/vfs.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
// RUN: %swiftc_driver -driver-print-jobs -c -vfsoverlay overlay1.yaml -vfsoverlay overlay2.yaml -vfsoverlay overlay3.yaml %s | %FileCheck --check-prefix=CHECK-MULTIPLE %s
88

99
// CHECK-MULTIPLE: bin{{/|\\\\}}swift{{(-frontend|c)?(\.exe)?"?}} -frontend{{.*}}-c{{.*}}-vfsoverlay overlay1.yaml -vfsoverlay overlay2.yaml -vfsoverlay overlay3.yaml
10+
11+
// Verifies that input paths are not rejected prematurely when -vfsoverlay is present as they may exist on the vfs (which the frontend accounts for) even if they don't exist on the real file system.
12+
// RUN: not %swiftc_driver -driver-print-jobs -c %t/file-not-on-the-real-filesystem.swift
13+
// RUN: %swiftc_driver -driver-print-jobs -c -vfsoverlay overlay1.yaml %t/file-not-on-the-real-filesystem.swift

0 commit comments

Comments
 (0)