[PATCH] D82542: [Support][Windows] Prevent 2s delay when renaming a file that does not exist

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 05:15:19 PDT 2020


bd1976llvm created this revision.
bd1976llvm added reviewers: rnk, probinson, hans, andrewng, pcc, zturner.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

https://reviews.llvm.org/D82542

Files:
  llvm/lib/Support/Windows/Path.inc


Index: llvm/lib/Support/Windows/Path.inc
===================================================================
--- llvm/lib/Support/Windows/Path.inc
+++ llvm/lib/Support/Windows/Path.inc
@@ -555,6 +555,11 @@
                       NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if (FromHandle)
       break;
+
+    // We don't want to loop if the file doesn't exist.
+    auto EC = mapWindowsError(GetLastError());
+    if (EC == errc::no_such_file_or_directory)
+      break;
   }
   if (!FromHandle)
     return mapWindowsError(GetLastError());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82542.273295.patch
Type: text/x-patch
Size: 554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200625/833e73a7/attachment.bin>


More information about the llvm-commits mailing list