]> granicus.if.org Git - llvm/commitdiff
Add an F_Delete flag.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 Nov 2017 00:12:44 +0000 (00:12 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 Nov 2017 00:12:44 +0000 (00:12 +0000)
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

include/llvm/Support/FileSystem.h
lib/Support/Windows/Path.inc

index 4a5be15950c2d64d2e3ed9a6bd2f52654144224c..68d08c211bf03e6424cc12e6e0d5b2932aacee5b 100644 (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.
index dceaaa1542cc7593cf585530ef643adb27bf95be..113f259fe5643ade2f6404fd70ecf0e54d31d9ef 100644 (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,