Use static instead of an anonymous namespace.

llvm-svn: 201983
This commit is contained in:
Rafael Espindola 2014-02-23 15:16:03 +00:00
parent 38c36ea18e
commit 37b012df8f
2 changed files with 31 additions and 35 deletions

View File

@ -85,14 +85,13 @@ namespace {
operator int() const {return FileDescriptor;}
};
}
error_code TempDir(SmallVectorImpl<char> &result) {
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")) ||
(dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) ||
(dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) ||
#ifdef P_tmpdir
(dir = P_tmpdir) ||
#endif
@ -103,7 +102,6 @@ namespace {
result.append(d.begin(), d.end());
return error_code::success();
}
}
static error_code createUniqueEntity(const Twine &Model, int &ResultFD,
SmallVectorImpl<char> &ResultPath,

View File

@ -44,8 +44,7 @@ using namespace llvm;
using llvm::sys::windows::UTF8ToUTF16;
using llvm::sys::windows::UTF16ToUTF8;
namespace {
error_code TempDir(SmallVectorImpl<wchar_t> &result) {
static error_code TempDir(SmallVectorImpl<wchar_t> &result) {
retry_temp_dir:
DWORD len = ::GetTempPathW(result.capacity(), result.begin());
@ -61,7 +60,7 @@ namespace {
return error_code::success();
}
bool is_separator(const wchar_t value) {
static bool is_separator(const wchar_t value) {
switch (value) {
case L'\\':
case L'/':
@ -70,7 +69,6 @@ namespace {
return false;
}
}
}
// FIXME: mode should be used here and default to user r/w only,
// it currently comes in as a UNIX mode.