If defined, use TMPDIR environment variable as location for temporary files.

llvm-svn: 69609
This commit is contained in:
Daniel Dunbar 2009-04-20 17:32:49 +00:00
parent f9b00eb7dc
commit ab8ce7cddb
1 changed files with 6 additions and 1 deletions

View 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 "";