Skip to content

Commit 6d52e8e

Browse files
author
kr-2003
committed
windows support fix
1 parent e9665c9 commit 6d52e8e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/include/clang/Interpreter/RemoteJITUtils.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323
#include <cstdint>
2424
#include <memory>
2525
#include <string>
26+
#ifdef LLVM_ON_UNIX
2627
#include <unistd.h>
28+
#else
29+
// Windows/MSVC fallback
30+
#define STDIN_FILENO 0
31+
#define STDOUT_FILENO 1
32+
#define STDERR_FILENO 2
33+
#endif
2734

2835
llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
2936
launchExecutor(llvm::StringRef ExecutablePath, bool UseSharedMemory,
@@ -38,11 +45,13 @@ llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
3845
connectTCPSocket(llvm::StringRef NetworkAddress, bool UseSharedMemory,
3946
llvm::StringRef SlabAllocateSizeString);
4047

48+
#ifdef LLVM_ON_UNIX
4149
/// Returns PID of last launched executor.
4250
pid_t getLastLaunchedExecutorPID();
4351

4452
/// Returns PID of nth launched executor.
4553
/// 1-based indexing.
4654
pid_t getNthLaunchedExecutorPID(int n);
55+
#endif
4756

4857
#endif // LLVM_CLANG_INTERPRETER_REMOTEJITUTILS_H

clang/lib/Interpreter/RemoteJITUtils.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ connectTCPSocket(StringRef NetworkAddress, bool UseSharedMemory,
288288
#endif
289289
}
290290

291+
#if LLVM_ON_UNIX
292+
291293
pid_t getLastLaunchedExecutorPID() {
292294
if (!LaunchedExecutorPID.size())
293295
return -1;
@@ -299,3 +301,4 @@ pid_t getNthLaunchedExecutorPID(int n) {
299301
return -1;
300302
return LaunchedExecutorPID.at(n - 1);
301303
}
304+
#endif

0 commit comments

Comments
 (0)