[lldb] Allow building using Mingw-w64 on Windows. (#150398)

I wasn't able to build lldb using Mingw-w64 on Windows without changing
these 3 lines. It seems like `std::atomic<bool>` wasn't being found
without `#include <atomic>` and `ceil` was defaulting to `std::ceil`
instead of `std::chrono::ceil`, but I'm not smart enough to know the
root cause. I'm sure I'm not the first people to try and compile lldb
(and clang and lld) with Mingw-w64 and I don't know if something is
wrong with my Mingw-w64, but my changes shouldn't have any affect if
they aren't needed.

(cherry picked from commit 1a32bcb4379fb90d2b764ac33b917de1431c6b16)
This commit is contained in:
cvspvr 2025-07-24 20:35:42 +10:00 committed by Tobias Hieta
parent c198dc74d0
commit 9ebb0abb02
2 changed files with 5 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/WindowsError.h"
#include <algorithm>
#include <atomic>
#include <cassert>
#include <ctime>
#include <io.h>

View File

@ -279,7 +279,8 @@ llvm::Expected<size_t> PipeWindows::Read(void *buf, size_t size,
return Status(failure_error, eErrorTypeWin32).takeError();
DWORD timeout_msec =
timeout ? ceil<std::chrono::milliseconds>(*timeout).count() : INFINITE;
timeout ? std::chrono::ceil<std::chrono::milliseconds>(*timeout).count()
: INFINITE;
DWORD wait_result =
::WaitForSingleObject(m_read_overlapped.hEvent, timeout_msec);
if (wait_result != WAIT_OBJECT_0) {
@ -324,7 +325,8 @@ llvm::Expected<size_t> PipeWindows::Write(const void *buf, size_t size,
return Status(failure_error, eErrorTypeWin32).takeError();
DWORD timeout_msec =
timeout ? ceil<std::chrono::milliseconds>(*timeout).count() : INFINITE;
timeout ? std::chrono::ceil<std::chrono::milliseconds>(*timeout).count()
: INFINITE;
DWORD wait_result =
::WaitForSingleObject(m_write_overlapped.hEvent, timeout_msec);
if (wait_result != WAIT_OBJECT_0) {