[clang] [clang-repl] Set up native platform support if ORC Runtime available (PR #217988)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 10:34:12 PDT 2026


https://github.com/khanxmetu created https://github.com/llvm/llvm-project/pull/217988

Previously, only out-of-process execution used the native platform/`ORCPlatformSupport` while in-process used `GenericLLVMIRPlatformSupport`. This change also attempts to use native platform support for in-process execution when the ORC Runtime is available or displays a warning otherwise.

Fixes #213425 

>From 25e82c1be918584f0fb796b257ccbb037007d1e5 Mon Sep 17 00:00:00 2001
From: khanxmetu <khanxbahria at gmail.com>
Date: Fri, 21 Aug 2026 20:41:59 +0500
Subject: [PATCH] [clang-repl] Set up native platform support if orc runtime
 available, warn otherwise

---
 clang/lib/Interpreter/IncrementalExecutor.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 6d337e7848699..1a63e8a0e1817 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -413,6 +413,16 @@ IncrementalExecutorBuilder::create(llvm::orc::ThreadSafeContext &TSC,
     if (!JB)
       return JB.takeError();
     JITBuilder = std::move(*JB);
+    if (!OrcRuntimePath.empty()) {
+      JITBuilder->setPlatformSetUp(
+          llvm::orc::ExecutorNativePlatform(OrcRuntimePath));
+    } else {
+      auto Err = llvm::make_error<llvm::StringError>(
+          "OrcRuntime not found, running JIT without native platform support "
+          "and some features may not work.",
+          std::error_code());
+      llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "warning: ");
+    }
     // TODO: Switch to native TLS once clang-repl can adopt the ORC runtime
     // (which provides __emutls_get_address and supports the full TLS
     // lifecycle). That will also remove the in-process-only constraint below.



More information about the cfe-commits mailing list