diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index 1c2b00e6456..dd0f275d7db 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -26,8 +26,10 @@ using namespace sys; Path Path::GetLLVMConfigDir() { Path result; +#ifdef LLVM_ETCDIR if (result.setDirectory(LLVM_ETCDIR)) return result; +#endif return GetLLVMDefaultConfigDir(); } diff --git a/lib/System/Win32/Path.cpp b/lib/System/Win32/Path.cpp index 149b4a1295d..24cfc465181 100644 --- a/lib/System/Win32/Path.cpp +++ b/lib/System/Win32/Path.cpp @@ -179,11 +179,6 @@ Path::GetLLVMDefaultConfigDir() { return Path("/etc/llvm/"); } -Path -Path::GetLLVMConfigDir() { - return GetLLVMDefaultConfigDir(); -} - Path Path::GetUserHomeDirectory() { const char* home = getenv("HOME"); @@ -600,7 +595,7 @@ Path::makeUnique() { dir.elideFile(); std::string fname = this->getLast(); - char* newName = alloca(MAX_PATH+1); + char newName[MAX_PATH + 1]; if (!GetTempFileName(dir.c_str(), fname.c_str(), 0, newName)) ThrowError("Cannot make unique filename for '" + path + "'"); diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 149b4a1295d..24cfc465181 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -179,11 +179,6 @@ Path::GetLLVMDefaultConfigDir() { return Path("/etc/llvm/"); } -Path -Path::GetLLVMConfigDir() { - return GetLLVMDefaultConfigDir(); -} - Path Path::GetUserHomeDirectory() { const char* home = getenv("HOME"); @@ -600,7 +595,7 @@ Path::makeUnique() { dir.elideFile(); std::string fname = this->getLast(); - char* newName = alloca(MAX_PATH+1); + char newName[MAX_PATH + 1]; if (!GetTempFileName(dir.c_str(), fname.c_str(), 0, newName)) ThrowError("Cannot make unique filename for '" + path + "'");