[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.
This commit is contained in:
Michael Gottesman
2021-09-02 13:51:52 -07:00
parent b62c1dc97e
commit 558aee9e65

View File

@@ -138,6 +138,10 @@ static llvm::cl::list<std::string>
static llvm::cl::opt<std::string>
Triple("target", llvm::cl::desc("target triple"));
static llvm::cl::opt<std::string> 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;