]> granicus.if.org Git - clang/commitdiff
If defined, use TMPDIR environment variable as location for temporary files.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 20 Apr 2009 17:32:49 +0000 (17:32 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 20 Apr 2009 17:32:49 +0000 (17:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69609 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index 67e92c21b3bf54ca3651661e47136f82263c92f3..5a2c8f6027b58e5f50cab9fc50ebc14e7e6a7736 100644 (file)
@@ -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 "";