From a383ffa219a19fa688b925210c0bd745725905ed Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Thu, 9 Jul 2009 08:23:38 +0000 Subject: 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 --- llvm/lib/CompilerDriver/Main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/CompilerDriver/Main.cpp') 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(); -- cgit v1.2.3