#include "IOStream.h"
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
#include <io.h>
#else
#include <netinet/in.h>
return;
if (m_is_socket)
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
::closesocket(m_socket);
#else
::close(m_socket);
}
if (bytes_read < 0) {
int reason = 0;
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
if (descriptor.m_is_socket)
reason = WSAGetLastError();
else
#ifndef LLDB_TOOLS_LLDB_VSCODE_IOSTREAM_H
#define LLDB_TOOLS_LLDB_VSCODE_IOSTREAM_H
-#if defined(_WIN32)
+#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
+
+#if !LLVM_ON_UNIX
// 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
//
//===----------------------------------------------------------------------===//
-#if !defined(WIN32)
+#include "RunInTerminal.h"
+
+#if LLVM_ON_UNIX
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "lldb/lldb-defines.h"
-#include "RunInTerminal.h"
-
using namespace llvm;
namespace lldb_vscode {
#include "VSCode.h"
#include "llvm/Support/FormatVariadic.h"
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
#define NOMINMAX
#include <fcntl.h>
#include <io.h>
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 defined(_WIN32)
+#if !LLVM_ON_UNIX
// 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.
#ifndef LLDB_TOOLS_LLDB_VSCODE_VSCODE_H
#define LLDB_TOOLS_LLDB_VSCODE_VSCODE_H
+#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
+
#include <condition_variable>
#include <iosfwd>
#include <map>
//
//===----------------------------------------------------------------------===//
+#include "VSCode.h"
+
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
// 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
#include "JSONUtils.h"
#include "LLDBUtils.h"
-#include "VSCode.h"
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#endif
*g_vsc.log << "error: accept (" << strerror(errno) << ")"
<< std::endl;
}
-#if defined(_WIN32)
+#if !LLVM_ON_UNIX
closesocket(sockfd);
#else
close(sockfd);
}
}
-#if !defined(_WIN32)
+#if LLVM_ON_UNIX
if (input_args.hasArg(OPT_wait_for_debugger)) {
printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
pause();