diff --git a/lldb/tools/lldb-vscode/FifoFiles.cpp b/lldb/tools/lldb-vscode/FifoFiles.cpp --- a/lldb/tools/lldb-vscode/FifoFiles.cpp +++ b/lldb/tools/lldb-vscode/FifoFiles.cpp @@ -8,7 +8,7 @@ #include "FifoFiles.h" -#if LLVM_ON_UNIX +#if !defined(_WIN32) #include #include #include @@ -30,13 +30,13 @@ FifoFile::FifoFile(StringRef path) : m_path(path) {} FifoFile::~FifoFile() { -#if LLVM_ON_UNIX +#if !defined(_WIN32) unlink(m_path.c_str()); #endif } Expected> CreateFifoFile(StringRef path) { -#if !LLVM_ON_UNIX +#if defined(_WIN32) return createStringError(inconvertibleErrorCode(), "Unimplemented"); #else if (int err = mkfifo(path.data(), 0600)) diff --git a/lldb/tools/lldb-vscode/IOStream.h b/lldb/tools/lldb-vscode/IOStream.h --- a/lldb/tools/lldb-vscode/IOStream.h +++ b/lldb/tools/lldb-vscode/IOStream.h @@ -11,7 +11,7 @@ #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX -#if !LLVM_ON_UNIX +#if defined(_WIN32) // We need to #define NOMINMAX in order to skip `min()` and `max()` macro // definitions that conflict with other system headers. // We also need to #undef GetObject (which is defined to GetObjectW) because diff --git a/lldb/tools/lldb-vscode/IOStream.cpp b/lldb/tools/lldb-vscode/IOStream.cpp --- a/lldb/tools/lldb-vscode/IOStream.cpp +++ b/lldb/tools/lldb-vscode/IOStream.cpp @@ -8,7 +8,7 @@ #include "IOStream.h" -#if !LLVM_ON_UNIX +#if defined(_WIN32) #include #else #include @@ -33,7 +33,7 @@ return; if (m_is_socket) -#if !LLVM_ON_UNIX +#if defined(_WIN32) ::closesocket(m_socket); #else ::close(m_socket); @@ -108,7 +108,7 @@ } if (bytes_read < 0) { int reason = 0; -#if !LLVM_ON_UNIX +#if defined(_WIN32) if (descriptor.m_is_socket) reason = WSAGetLastError(); else diff --git a/lldb/tools/lldb-vscode/RunInTerminal.cpp b/lldb/tools/lldb-vscode/RunInTerminal.cpp --- a/lldb/tools/lldb-vscode/RunInTerminal.cpp +++ b/lldb/tools/lldb-vscode/RunInTerminal.cpp @@ -8,7 +8,7 @@ #include "RunInTerminal.h" -#if LLVM_ON_UNIX +#if !defined(_WIN32) #include #include #include diff --git a/lldb/tools/lldb-vscode/VSCode.cpp b/lldb/tools/lldb-vscode/VSCode.cpp --- a/lldb/tools/lldb-vscode/VSCode.cpp +++ b/lldb/tools/lldb-vscode/VSCode.cpp @@ -14,7 +14,7 @@ #include "VSCode.h" #include "llvm/Support/FormatVariadic.h" -#if !LLVM_ON_UNIX +#if defined(_WIN32) #define NOMINMAX #include #include @@ -41,7 +41,7 @@ stop_at_entry(false), is_attach(false), reverse_request_seq(0), waiting_for_run_in_terminal(false) { const char *log_file_path = getenv("LLDBVSCODE_LOG"); -#if !LLVM_ON_UNIX +#if defined(_WIN32) // Windows opens stdout and stdin in text mode which converts \n to 13,10 // while the value is just 10 on Darwin/Linux. Setting the file mode to binary // fixes this. diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -16,7 +16,7 @@ #include #include #include -#if !LLVM_ON_UNIX +#if defined(_WIN32) // We need to #define NOMINMAX in order to skip `min()` and `max()` macro // definitions that conflict with other system headers. // We also need to #undef GetObject (which is defined to GetObjectW) because @@ -55,7 +55,7 @@ #include "JSONUtils.h" #include "LLDBUtils.h" -#if !LLVM_ON_UNIX +#if defined(_WIN32) #ifndef PATH_MAX #define PATH_MAX MAX_PATH #endif @@ -132,7 +132,7 @@ *g_vsc.log << "error: accept (" << strerror(errno) << ")" << std::endl; } -#if !LLVM_ON_UNIX +#if defined(_WIN32) closesocket(sockfd); #else close(sockfd); @@ -3003,7 +3003,7 @@ // emitted to the debug adaptor. void LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg, llvm::StringRef comm_file, char *argv[]) { -#if !LLVM_ON_UNIX +#if defined(_WIN32) llvm::errs() << "runInTerminal is only supported on POSIX systems\n"; exit(EXIT_FAILURE); #else @@ -3085,7 +3085,7 @@ } } -#if LLVM_ON_UNIX +#if !defined(_WIN32) if (input_args.hasArg(OPT_wait_for_debugger)) { printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid()); pause();