Add an F_Delete flag.

For now this only changes the handle Access.

llvm-svn: 319121
This commit is contained in:
Rafael Espindola 2017-11-28 00:12:44 +00:00
parent dbd4a7fecc
commit bce112c9e9
2 changed files with 7 additions and 1 deletions

View File

@ -683,7 +683,11 @@ enum OpenFlags : unsigned {
F_Text = 4,
/// Open the file for read and write.
F_RW = 8
F_RW = 8,
/// The returned handle can be used for deleting the file. Only makes a
/// difference on windows.
F_Delete = 16
};
/// @brief Create a uniquely named file.

View File

@ -1031,6 +1031,8 @@ std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
DWORD Access = GENERIC_WRITE;
if (Flags & F_RW)
Access |= GENERIC_READ;
if (Flags & F_Delete)
Access |= DELETE;
HANDLE H =
::CreateFileW(PathUTF16.begin(), Access,