[llvm] [Support] Handle delete_pending case for Windows fs::status (PR #90655)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 12:59:12 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6 4cbb1d8b3b46274887a1e82bbff236188e5b13c6 -- llvm/include/llvm/Support/Errc.h llvm/lib/Support/Windows/Path.inc
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 2a14b2f28c..96940adb3c 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -797,19 +797,22 @@ std::error_code status(const Twine &path, file_status &result, bool Follow) {
   if (!Follow) {
     DWORD attr = ::GetFileAttributesW(path_utf16.begin());
     if (attr == INVALID_FILE_ATTRIBUTES) {
-      // If the file is just pending deletion, try querying file attributes again in a loop to
-      // avoid returning a misleading permission denied error.
+      // If the file is just pending deletion, try querying file attributes
+      // again in a loop to avoid returning a misleading permission denied
+      // error.
       if (RtlGetLastNtStatus() == STATUS_DELETE_PENDING) {
         for (unsigned Retry = 0; Retry != 200; ++Retry) {
           ::Sleep(10);
           attr = ::GetFileAttributesW(path_utf16.begin());
-          if (attr != INVALID_FILE_ATTRIBUTES || RtlGetLastNtStatus() != STATUS_DELETE_PENDING)
+          if (attr != INVALID_FILE_ATTRIBUTES ||
+              RtlGetLastNtStatus() != STATUS_DELETE_PENDING)
             break;
         }
 
         if (attr == INVALID_FILE_ATTRIBUTES) {
-          return RtlGetLastNtStatus() == STATUS_DELETE_PENDING ?
-            llvm::errc::delete_pending : getStatus(INVALID_HANDLE_VALUE, result);
+          return RtlGetLastNtStatus() == STATUS_DELETE_PENDING
+                     ? llvm::errc::delete_pending
+                     : getStatus(INVALID_HANDLE_VALUE, result);
         }
       } else {
         return getStatus(INVALID_HANDLE_VALUE, result);

``````````

</details>


https://github.com/llvm/llvm-project/pull/90655


More information about the llvm-commits mailing list