From 558aee9e6576ccbd672c828cd274d997ba1a4807 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Thu, 2 Sep 2021 13:51:52 -0700 Subject: [PATCH] [swift-refactor] Add the option -resource-dir. This lets one customize in the compiler invocation where the compiler looks for the stdlib. This is necessary if the toolchain is not using a stdlib installed with it. --- tools/swift-refactor/swift-refactor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/swift-refactor/swift-refactor.cpp b/tools/swift-refactor/swift-refactor.cpp index d7d13453e12..3b7950dcea2 100644 --- a/tools/swift-refactor/swift-refactor.cpp +++ b/tools/swift-refactor/swift-refactor.cpp @@ -138,6 +138,10 @@ static llvm::cl::list static llvm::cl::opt Triple("target", llvm::cl::desc("target triple")); +static llvm::cl::opt ResourceDir( + "resource-dir", + llvm::cl::desc("The directory that holds the compiler resource files")); + enum class DumpType { REWRITTEN, JSON, @@ -294,6 +298,9 @@ int main(int argc, char *argv[]) { if (!options::Triple.empty()) Invocation.setTargetTriple(options::Triple); + if (!options::ResourceDir.empty()) + Invocation.setRuntimeResourcePath(options::ResourceDir); + Invocation.getFrontendOptions().InputsAndOutputs.addInputFile( options::SourceFilename); Invocation.getLangOptions().AttachCommentsToDecls = true;