diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-20 17:32:49 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-20 17:32:49 +0000 |
commit | f60c63af0ed33ab890600ee6146e7685901f46df (patch) | |
tree | 931830e2bbc94769cde9eeabc8ad62d439784da6 /lib/Driver/Driver.cpp | |
parent | df9bcd568c79779d92b2f8d04a24ca822c56523d (diff) |
If defined, use TMPDIR environment variable as location for temporary files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 67e92c21b3..5a2c8f6027 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1110,7 +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("/tmp/cc"); + llvm::sys::Path P; + if (const char *TmpDir = ::getenv("TMPDIR")) + P = TmpDir; + else + P = "/tmp"; + P.appendComponent("cc"); if (P.makeUnique(false, &Error)) { Diag(clang::diag::err_drv_unable_to_make_temp) << Error; return ""; |