diff options
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Path.inc | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index b00d3905f65..60c03645a57 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -959,42 +959,6 @@ std::error_code openFileForWrite(const Twine &Name, int &ResultFD, return std::error_code(); } -std::error_code getPathFromOpenFD(int FD, SmallVectorImpl<char> &ResultPath) { - HANDLE FileHandle = reinterpret_cast<HANDLE>(::_get_osfhandle(FD)); - if (FileHandle == INVALID_HANDLE_VALUE) - return make_error_code(errc::bad_file_descriptor); - - DWORD CharCount; - SmallVector<wchar_t, 1024> TempPath; - do { - CharCount = ::GetFinalPathNameByHandleW(FileHandle, TempPath.begin(), - TempPath.capacity(), - FILE_NAME_NORMALIZED); - if (CharCount < TempPath.capacity()) - break; - - // Reserve sufficient space for the path as well as the null character. Even - // though the API does not document that it is required, if we reserve just - // CharCount space, the function call will not store the resulting path and - // still report success. - TempPath.reserve(CharCount + 1); - } while (true); - - if (CharCount == 0) - return mapWindowsError(::GetLastError()); - - TempPath.set_size(CharCount); - - // On earlier Windows releases, the character count includes the terminating - // null. - if (TempPath.back() == L'\0') { - --CharCount; - TempPath.pop_back(); - } - - return windows::UTF16ToUTF8(TempPath.data(), CharCount, ResultPath); -} - std::error_code remove_directories(const Twine &path, bool IgnoreErrors) { // Convert to utf-16. SmallVector<wchar_t, 128> Path16; |