summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-20 17:32:49 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-20 17:32:49 +0000
commitab8ce7cddb722b02cb9a1354df18f9ed9714ed8f (patch)
tree98aefe1d2dd282bef81c08f28032a3e4231f1427
parentf9b00eb7dc88cc362ac331552716df50158e60ec (diff)
downloadbcm5719-llvm-ab8ce7cddb722b02cb9a1354df18f9ed9714ed8f.tar.gz
bcm5719-llvm-ab8ce7cddb722b02cb9a1354df18f9ed9714ed8f.zip
If defined, use TMPDIR environment variable as location for temporary files.
llvm-svn: 69609
-rw-r--r--clang/lib/Driver/Driver.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 67e92c21b3b..5a2c8f6027b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/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 "";
OpenPOWER on IntegriCloud