Skip to content

Commit c172f40

Browse files
author
kr-2003
committed
patch change
1 parent 05a5260 commit c172f40

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,14 @@ jobs:
317317
with:
318318
cache-hit: ${{ steps.cache.outputs.cache-hit }}
319319

320-
- name: Cache LLVM-${{ matrix.clang-runtime }} and ${{ matrix.cling == 'On' && 'Cling' || 'Clang-REPL' }} build
321-
uses: actions/cache/save@v4
322-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
323-
with:
324-
path: |
325-
llvm-project
326-
${{ matrix.cling=='On' && 'cling' || '' }}
327-
key: ${{ steps.cache.outputs.cache-primary-key }}
320+
# - name: Cache LLVM-${{ matrix.clang-runtime }} and ${{ matrix.cling == 'On' && 'Cling' || 'Clang-REPL' }} build
321+
# uses: actions/cache/save@v4
322+
# if: ${{ steps.cache.outputs.cache-hit != 'true' }}
323+
# with:
324+
# path: |
325+
# llvm-project
326+
# ${{ matrix.cling=='On' && 'cling' || '' }}
327+
# key: ${{ steps.cache.outputs.cache-primary-key }}
328328

329329
- name: Setup code coverage
330330
if: ${{ success() && (matrix.coverage == true) }}

lib/CppInterOp/CppInterOpInterpreter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#ifndef _WIN32
4444
#include <unistd.h>
4545
#endif
46+
#include <algorithm>
4647
#include <cstdio>
4748
#include <utility>
4849
#include <vector>

patches/llvm/clang20-1-out-of-process.patch

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ index 000000000..825143f00
7272
+
7373
+/// Get the PID of the last launched executor.
7474
+/// This is useful for debugging or for cleanup purposes.
75+
+/// Returns PID of last launched executor.
7576
+pid_t getLastLaunchedExecutorPID();
77+
+
78+
+/// Returns PID of nth launched executor.
79+
+/// 1-based indexing.
80+
+pid_t getNthLaunchedExecutorPID(int n);
7681
+#endif // LLVM_CLANG_INTERPRETER_REMOTEJITUTILS_H
7782
diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt
7883
index bf70cdfbe..38cf139fa 100644
@@ -199,7 +204,7 @@ index 000000000..8324aeaaf
199204
+using namespace llvm;
200205
+using namespace llvm::orc;
201206
+
202-
+static std::atomic<pid_t> LaunchedExecutorPID{-1};
207+
+static std::vector<pid_t> LaunchedExecutorPID;
203208
+
204209
+Expected<uint64_t> getSlabAllocSize(StringRef SizeString) {
205210
+ SizeString = SizeString.trim();
@@ -346,7 +351,7 @@ index 000000000..8324aeaaf
346351
+ exit(1);
347352
+ }
348353
+ } else {
349-
+ LaunchedExecutorPID = ChildPID;
354+
+ LaunchedExecutorPID.push_back(ChildPID);
350355
+ }
351356
+ // else we're the parent...
352357
+
@@ -459,7 +464,15 @@ index 000000000..8324aeaaf
459464
+}
460465
+
461466
+pid_t getLastLaunchedExecutorPID() {
462-
+ return LaunchedExecutorPID;
467+
+ if (!LaunchedExecutorPID.size())
468+
+ return -1;
469+
+ return LaunchedExecutorPID.back();
470+
+}
471+
+
472+
+pid_t getNthLaunchedExecutorPID(int n) {
473+
+ if (n - 1 < 0 || n - 1 >= static_cast<int>(LaunchedExecutorPID.size()))
474+
+ return -1;
475+
+ return LaunchedExecutorPID.at(n - 1);
463476
+}
464477
diff --git a/clang/test/Interpreter/out-of-process.cpp b/clang/test/Interpreter/out-of-process.cpp
465478
new file mode 100644

0 commit comments

Comments
 (0)