Use static instead of an anonymous namespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201983 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-02-23 15:16:03 +00:00
parent 73f1a5fe45
commit da6ffb33d2
2 changed files with 31 additions and 35 deletions

View File

@@ -85,24 +85,22 @@ namespace {
operator int() const {return FileDescriptor;}
};
}
error_code TempDir(SmallVectorImpl<char> &result) {
// FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
const char *dir = 0;
(dir = std::getenv("TMPDIR" )) ||
(dir = std::getenv("TMP" )) ||
(dir = std::getenv("TEMP" )) ||
(dir = std::getenv("TEMPDIR")) ||
static error_code TempDir(SmallVectorImpl<char> &result) {
// FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
const char *dir = 0;
(dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) ||
(dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) ||
#ifdef P_tmpdir
(dir = P_tmpdir) ||
(dir = P_tmpdir) ||
#endif
(dir = "/tmp");
(dir = "/tmp");
result.clear();
StringRef d(dir);
result.append(d.begin(), d.end());
return error_code::success();
}
result.clear();
StringRef d(dir);
result.append(d.begin(), d.end());
return error_code::success();
}
static error_code createUniqueEntity(const Twine &Model, int &ResultFD,