Reverting r297617 because it broke some bots:
http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/49970
llvm-svn: 297618
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 8ad1edd..d8a14b4 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -527,21 +527,19 @@
goto handle_status_error;
{
- file_type Type = (Info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- ? file_type::directory_file
- : file_type::regular_file;
- perms Permissions = (Info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- ? (all_read | all_exe)
- : all_all;
- Result = file_status(
- Type, Permissions, Info.ftLastAccessTime.dwHighDateTime,
- Info.ftLastAccessTime.dwLowDateTime,
- Info.ftLastWriteTime.dwHighDateTime, Info.ftLastWriteTime.dwLowDateTime,
- Info.dwVolumeSerialNumber, Info.nFileSizeHigh, Info.nFileSizeLow,
- Info.nFileIndexHigh, Info.nFileIndexLow);
- return std::error_code();
- }
-
+ file_type Type = (Info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ ? file_type::directory_file
+ : file_type::regular_file;
+ Result =
+ file_status(Type, Info.ftLastAccessTime.dwHighDateTime,
+ Info.ftLastAccessTime.dwLowDateTime,
+ Info.ftLastWriteTime.dwHighDateTime,
+ Info.ftLastWriteTime.dwLowDateTime,
+ Info.dwVolumeSerialNumber, Info.nFileSizeHigh,
+ Info.nFileSizeLow, Info.nFileIndexHigh, Info.nFileIndexLow);
+ return std::error_code();
+ }
+
handle_status_error:
DWORD LastError = ::GetLastError();
if (LastError == ERROR_FILE_NOT_FOUND ||
@@ -588,43 +586,12 @@
std::error_code status(int FD, file_status &Result) {
HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
- return getStatus(FileHandle, Result);
-}
-
-std::error_code setPermissions(const Twine &Path, perms Permissions) {
- SmallVector<wchar_t, 128> PathUTF16;
- if (std::error_code EC = widenPath(Path, PathUTF16))
- return EC;
-
- DWORD Attributes = ::GetFileAttributesW(PathUTF16.begin());
- if (Attributes == INVALID_FILE_ATTRIBUTES)
- return mapWindowsError(GetLastError());
-
- // There are many Windows file attributes that are not to do with the file
- // permissions (e.g. FILE_ATTRIBUTE_HIDDEN). We need to be careful to preserve
- // them.
- if (Permissions & all_write) {
- Attributes &= ~FILE_ATTRIBUTE_READONLY;
- if (Attributes == 0)
- // FILE_ATTRIBUTE_NORMAL indicates no other attributes are set.
- Attributes |= FILE_ATTRIBUTE_NORMAL;
- }
- else {
- Attributes |= FILE_ATTRIBUTE_READONLY;
- // FILE_ATTRIBUTE_NORMAL is not compatible with any other attributes, so
- // remove it, if it is present.
- Attributes &= ~FILE_ATTRIBUTE_NORMAL;
- }
-
- if (!::SetFileAttributesW(PathUTF16.begin(), Attributes))
- return mapWindowsError(GetLastError());
-
- return std::error_code();
-}
-
-std::error_code setLastModificationAndAccessTime(int FD, TimePoint<> Time) {
- FILETIME FT = toFILETIME(Time);
- HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
+ return getStatus(FileHandle, Result);
+}
+
+std::error_code setLastModificationAndAccessTime(int FD, TimePoint<> Time) {
+ FILETIME FT = toFILETIME(Time);
+ HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
if (!SetFileTime(FileHandle, NULL, &FT, &FT))
return mapWindowsError(::GetLastError());
return std::error_code();