From: Rafael Espindola Date: Tue, 28 Nov 2017 00:12:44 +0000 (+0000) Subject: Add an F_Delete flag. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=816b1dbae08c1f58243dac9c3741dee0411eca5a;p=llvm Add an F_Delete flag. For now this only changes the handle Access. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319121 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index 4a5be15950c..68d08c211bf 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -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. diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index dceaaa1542c..113f259fe56 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -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,