diff options
Diffstat (limited to 'lib/CompilerDriver')
-rw-r--r-- | lib/CompilerDriver/BuiltinOptions.cpp | 2 | ||||
-rw-r--r-- | lib/CompilerDriver/Main.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/CompilerDriver/BuiltinOptions.cpp b/lib/CompilerDriver/BuiltinOptions.cpp index a3364e8..c4660e1 100644 --- a/lib/CompilerDriver/BuiltinOptions.cpp +++ b/lib/CompilerDriver/BuiltinOptions.cpp @@ -25,6 +25,8 @@ cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input file>"), cl::ZeroOrMore); cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"), cl::value_desc("file"), cl::Prefix); +cl::opt<std::string> TempDirname("t", cl::desc("Temp dir name"), + cl::value_desc("dir"), cl::Prefix); cl::list<std::string> Languages("x", cl::desc("Specify the language of the following input files"), cl::ZeroOrMore); diff --git a/lib/CompilerDriver/Main.cpp b/lib/CompilerDriver/Main.cpp index 7d1a3d8..57d2937 100644 --- a/lib/CompilerDriver/Main.cpp +++ b/lib/CompilerDriver/Main.cpp @@ -31,6 +31,15 @@ namespace { sys::Path getTempDir() { sys::Path tempDir; + if (! TempDirname.empty() { + tempDir = TempDirname; + if (!tempDir.exists()) { + std::string ErrMsg; + if (tempDir.createDirectoryOnDisk(true, &ErrMsg)) + throw std::runtime_error(ErrMsg); + } + } + // GCC 4.5-style -save-temps handling. if (SaveTemps == SaveTempsEnum::Unset) { tempDir = sys::Path::GetTemporaryDirectory(); |