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

Jeremy Day via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 12:45:07 PDT 2024


================
@@ -22,12 +22,22 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-// These two headers must be included last, and make sure shlobj is required
+// These headers must be included last, and make sure shlobj is required
 // after Windows.h to make sure it picks up our definition of _WIN32_WINNT
+#define WIN32_NO_STATUS
 #include "llvm/Support/Windows/WindowsSupport.h"
+#undef WIN32_NO_STATUS
+
+#include <ntstatus.h>
 #include <shellapi.h>
 #include <shlobj.h>
 
+// This is equivalent to NtCurrentTeb()->LastStatusValue, but the public
+// _TEB definition does not expose the LastStatusValue field directly.
+// Avoid offsetting into this structure by calling RtlGetLastNtStatus
+// from ntdll.dll.
+extern "C" NTSYSAPI NTSTATUS NTAPI RtlGetLastNtStatus();
----------------
z2oh wrote:

Good point. I've expanded the comment a bit and added that link, as well as a link to the Github issue which has quite a bit of collated information on this topic.

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


More information about the llvm-commits mailing list