diff options
| author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-07-09 08:23:38 +0000 |
|---|---|---|
| committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-07-09 08:23:38 +0000 |
| commit | a383ffa219a19fa688b925210c0bd745725905ed (patch) | |
| tree | dbbf48987441be562a286c14788cf3af0066600f /llvm/lib/CompilerDriver | |
| parent | c378299f790dfe972a9495dd3b8ce2c3d178686f (diff) | |
| download | bcm5719-llvm-a383ffa219a19fa688b925210c0bd745725905ed.tar.gz bcm5719-llvm-a383ffa219a19fa688b925210c0bd745725905ed.zip | |
Add a -t="dir" option to the driver. This can be used to specify the directory to be used as TempDir if somebody doesn't want to use the standard /tmp.
llvm-svn: 75121
Diffstat (limited to 'llvm/lib/CompilerDriver')
| -rw-r--r-- | llvm/lib/CompilerDriver/BuiltinOptions.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CompilerDriver/Main.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CompilerDriver/BuiltinOptions.cpp b/llvm/lib/CompilerDriver/BuiltinOptions.cpp index a3364e8a72f..c4660e17a53 100644 --- a/llvm/lib/CompilerDriver/BuiltinOptions.cpp +++ b/llvm/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/llvm/lib/CompilerDriver/Main.cpp b/llvm/lib/CompilerDriver/Main.cpp index 7d1a3d8fbc4..57d2937b339 100644 --- a/llvm/lib/CompilerDriver/Main.cpp +++ b/llvm/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(); |

