[llvm] r319121 - Add an F_Delete flag.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 16:12:45 PST 2017


Author: rafael
Date: Mon Nov 27 16:12:44 2017
New Revision: 319121

URL: http://llvm.org/viewvc/llvm-project?rev=319121&view=rev
Log:
Add an F_Delete flag.

For now this only changes the handle Access.

Modified:
    llvm/trunk/include/llvm/Support/FileSystem.h
    llvm/trunk/lib/Support/Windows/Path.inc

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=319121&r1=319120&r2=319121&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Mon Nov 27 16:12:44 2017
@@ -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.

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=319121&r1=319120&r2=319121&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Mon Nov 27 16:12:44 2017
@@ -1031,6 +1031,8 @@ std::error_code openFileForWrite(const T
   DWORD Access = GENERIC_WRITE;
   if (Flags & F_RW)
     Access |= GENERIC_READ;
+  if (Flags & F_Delete)
+    Access |= DELETE;
 
   HANDLE H =
       ::CreateFileW(PathUTF16.begin(), Access,




More information about the llvm-commits mailing list