Skip to content

Commit 992c497

Browse files
author
kr-2003
committed
patch updated: lambda usage
1 parent ebce40a commit 992c497

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

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

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ index 000000000..825143f00
6161
+
6262
+llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
6363
+launchExecutor(llvm::StringRef ExecutablePath, bool UseSharedMemory,
64-
+ llvm::StringRef SlabAllocateSizeString, int stdin_fd = STDIN_FILENO, int stdout_fd = STDOUT_FILENO, int stderr_fd = STDERR_FILENO);
64+
+ llvm::StringRef SlabAllocateSizeString, std::function<void()> CustomizeFork = nullptr);
6565
+
6666
+/// Create a JITLinkExecutor that connects to the given network address
6767
+/// through a TCP socket. A valid NetworkAddress provides hostname and port,
@@ -265,7 +265,7 @@ index 000000000..8324aeaaf
265265
+
266266
+Expected<std::unique_ptr<SimpleRemoteEPC>>
267267
+launchExecutor(StringRef ExecutablePath, bool UseSharedMemory,
268-
+ llvm::StringRef SlabAllocateSizeString, int stdin_fd, int stdout_fd, int stderr_fd) {
268+
+ llvm::StringRef SlabAllocateSizeString, std::function<void()> CustomizeFork) {
269269
+#ifndef LLVM_ON_UNIX
270270
+ // FIXME: Add support for Windows.
271271
+ return make_error<StringError>("-" + ExecutablePath +
@@ -307,28 +307,8 @@ index 000000000..8324aeaaf
307307
+ // Close the parent ends of the pipes
308308
+ close(ToExecutor[WriteEnd]);
309309
+ close(FromExecutor[ReadEnd]);
310-
+
311-
+ if (stdin_fd != STDIN_FILENO) {
312-
+ dup2(stdin_fd, STDIN_FILENO);
313-
+
314-
+ close(stdin_fd);
315-
+ }
316-
+
317-
+ if (stdout_fd != STDOUT_FILENO) {
318-
+ dup2(stdout_fd, STDOUT_FILENO);
319-
+
320-
+ close(stdout_fd);
321-
+
322-
+ setvbuf(stdout, NULL, _IONBF, 0);
323-
+ }
324-
+
325-
+ if (stderr_fd != STDERR_FILENO) {
326-
+ dup2(stderr_fd, STDERR_FILENO);
327-
+
328-
+ close(stderr_fd);
329-
+
330-
+ setvbuf(stderr, NULL, _IONBF, 0);
331-
+ }
310+
+ if (CustomizeFork)
311+
+ CustomizeFork();
332312
+
333313
+ // Execute the child process.
334314
+ std::unique_ptr<char[]> ExecutorPath, FDSpecifier;

0 commit comments

Comments
 (0)