diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-10 17:16:40 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-10 17:16:40 +0000 |
commit | ac2de33d2aaa076dc54ce2cea675bcca5b50261e (patch) | |
tree | e6e772d229275c7201d1c3afa62097f0931a115a /lib/Support/Windows/Path.inc | |
parent | 43ae5e85f829df883dd364c0b9612bbe90f3ad97 (diff) | |
download | external_llvm-ac2de33d2aaa076dc54ce2cea675bcca5b50261e.zip external_llvm-ac2de33d2aaa076dc54ce2cea675bcca5b50261e.tar.gz external_llvm-ac2de33d2aaa076dc54ce2cea675bcca5b50261e.tar.bz2 |
Use status to implement file_size.
The status function is already using a syscall that returns the file size.
Remember it and implement file_size as a simple wrapper.
No functionally change, but clients that already use status now can avoid
calling file_size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r-- | lib/Support/Windows/Path.inc | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 7359994..ed93f3d 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -555,27 +555,6 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) { return error_code::success(); } -error_code file_size(const Twine &path, uint64_t &result) { - SmallString<128> path_storage; - SmallVector<wchar_t, 128> path_utf16; - - if (error_code ec = UTF8ToUTF16(path.toStringRef(path_storage), - path_utf16)) - return ec; - - WIN32_FILE_ATTRIBUTE_DATA FileData; - if (!::GetFileAttributesExW(path_utf16.begin(), - ::GetFileExInfoStandard, - &FileData)) - return windows_error(::GetLastError()); - - result = - (uint64_t(FileData.nFileSizeHigh) << (sizeof(FileData.nFileSizeLow) * 8)) - + FileData.nFileSizeLow; - - return error_code::success(); -} - error_code getUniqueID(const Twine Path, uint64_t &Result) { file_status Status; if (error_code E = status(Path, Status)) |