[Lldb-commits] [lldb] [lldb] [Windows] Add a missing include. NFC. (PR #223727)

via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 15 07:51:14 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

_open_osfhandle is defined in io.h, which wasn't explicitly included before.

This built fine in practice with both WinSDK and recent mingw-w64 headers, but failed with older versions of mingw-w64 (older than August 2026).

Also change an accidental #if into #ifdef.

This fixes regressions from 1ca6698be7708121f987d0acf896c7dc4cf63a51 and ba1687b72476eb368641b9a9f565a38cf41b7393.

---
Full diff: https://github.com/llvm/llvm-project/pull/223727.diff


1 Files Affected:

- (modified) lldb/source/API/SBFile.cpp (+5-1) 


``````````diff
diff --git a/lldb/source/API/SBFile.cpp b/lldb/source/API/SBFile.cpp
index ab8e6e152d39e8..1ec3e1e6df451c 100644
--- a/lldb/source/API/SBFile.cpp
+++ b/lldb/source/API/SBFile.cpp
@@ -11,6 +11,10 @@
 #include "lldb/Host/File.h"
 #include "lldb/Utility/Instrumentation.h"
 
+#ifdef _WIN32
+#include <io.h>
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -70,7 +74,7 @@ SBFile::SBFile(int fd, const char *mode, bool transfer_ownership) {
 }
 
 int SBFile::OpenFdFromHandle(intptr_t handle, int flags) {
-#if _WIN32
+#ifdef _WIN32
   return _open_osfhandle(handle, flags);
 #else
   (void)handle;

``````````

</details>


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


More information about the lldb-commits mailing list