aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-20 20:28:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-20 20:28:21 +0000
commitb03417fdc42ae19d2deb2ee1e5d2c3e9896a2a04 (patch)
tree90bcd7dc9c44d22e7c4a58576d86cfc5d07187c6 /lib/Driver/Driver.cpp
parent6c1aac8883ef2732a2d8543d7ac2a5ca9a199f86 (diff)
Also look at the TEMP environment variable as a place to put temporary
files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 5a2c8f6027..f0eadf7962 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1110,11 +1110,12 @@ std::string Driver::GetTemporaryPath(const char *Suffix) const {
// FIXME: This is lame; sys::Path should provide this function (in
// particular, it should know how to find the temporary files dir).
std::string Error;
- llvm::sys::Path P;
- if (const char *TmpDir = ::getenv("TMPDIR"))
- P = TmpDir;
- else
- P = "/tmp";
+ const char *TmpDir = ::getenv("TMPDIR");
+ if (!TmpDir)
+ TmpDir = ::getenv("TEMP");
+ if (!TmpDir)
+ TmpDir = "/tmp";
+ llvm::sys::Path P(TmpDir);
P.appendComponent("cc");
if (P.makeUnique(false, &Error)) {
Diag(clang::diag::err_drv_unable_to_make_temp) << Error;