Skip to content

Commit bb8ca27

Browse files
committed
sil-opt: introduce -vfsoverlay to support Windows
Add an option to `sil-opt` to pass along VFS overlay files to the clang importer. This is required to make the tests pass with the upcoming work to avoid modifying the Visual Studio installation and instead to prefer to inject the content via VFS overlays.
1 parent fedf86f commit bb8ca27

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ class CompilerInvocation {
188188
return SearchPathOpts.getFrameworkSearchPaths();
189189
}
190190

191+
void setVFSOverlays(const std::vector<std::string> &Overlays) {
192+
SearchPathOpts.VFSOverlayFiles = Overlays;
193+
}
194+
191195
void setCompilerPluginLibraryPaths(const std::vector<std::string> &Paths) {
192196
SearchPathOpts.setCompilerPluginLibraryPaths(Paths);
193197
}

tools/sil-opt/SILOpt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ ImportPaths("I", llvm::cl::desc("add a directory to the import search path"));
8686
static llvm::cl::list<std::string>
8787
FrameworkPaths("F", llvm::cl::desc("add a directory to the framework search path"));
8888

89+
static llvm::cl::list<std::string>
90+
VFSOverlays("vfsoverlay", llvm::cl::desc("add a VFS overlay"));
91+
8992
static llvm::cl::opt<std::string>
9093
ModuleName("module-name", llvm::cl::desc("The name of the module if processing"
9194
" a module. Necessary for processing "
@@ -542,6 +545,9 @@ int main(int argc, char **argv) {
542545
FramePaths.push_back({path, /*isSystem=*/false});
543546
}
544547
Invocation.setFrameworkSearchPaths(FramePaths);
548+
549+
Invocation.setVFSOverlays(VFSOverlays);
550+
545551
// Set the SDK path and target if given.
546552
if (SDKPath.getNumOccurrences() == 0) {
547553
const char *SDKROOT = getenv("SDKROOT");

0 commit comments

Comments
 (0)