Index: include/llvm/Support/FileSystem.h =================================================================== --- include/llvm/Support/FileSystem.h +++ include/llvm/Support/FileSystem.h @@ -683,7 +683,11 @@ 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. Index: lib/Support/Windows/Path.inc =================================================================== --- lib/Support/Windows/Path.inc +++ lib/Support/Windows/Path.inc @@ -1031,6 +1031,8 @@ DWORD Access = GENERIC_WRITE; if (Flags & F_RW) Access |= GENERIC_READ; + if (Flags & F_Delete) + Access |= DELETE; HANDLE H = ::CreateFileW(PathUTF16.begin(), Access,