files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69622
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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;