[PATCH] D36337: [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 14:52:54 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310137: [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows (authored by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D36337?vs=109807&id=109824#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36337

Files:
  cfe/trunk/test/Frontend/remove-file-on-signal.c
  llvm/trunk/lib/Support/Windows/Path.inc


Index: llvm/trunk/lib/Support/Windows/Path.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc
+++ llvm/trunk/lib/Support/Windows/Path.inc
@@ -925,9 +925,10 @@
   if (Flags & F_RW)
     Access |= GENERIC_READ;
 
-  HANDLE H = ::CreateFileW(PathUTF16.begin(), Access,
-                           FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                           CreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
+  HANDLE H =
+      ::CreateFileW(PathUTF16.begin(), Access,
+                    FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                    NULL, CreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
 
   if (H == INVALID_HANDLE_VALUE) {
     DWORD LastError = ::GetLastError();
Index: cfe/trunk/test/Frontend/remove-file-on-signal.c
===================================================================
--- cfe/trunk/test/Frontend/remove-file-on-signal.c
+++ cfe/trunk/test/Frontend/remove-file-on-signal.c
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t && mkdir -p %t && cd %t
+// RUN: not --crash %clang_cc1 %s -emit-llvm -o foo.ll
+// RUN: ls . | FileCheck %s --allow-empty
+// CHECK-NOT: foo.ll
+
+#pragma clang __debug crash
+FOO


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36337.109824.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170804/bde48d35/attachment.bin>


More information about the llvm-commits mailing list