[clang] [Clang-Repl] Add Lambda Support, PID Retrieval, and Dynamic liborc_rt Path in Clang-Repl (PR #155140)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 02:39:03 PDT 2025


================
@@ -81,6 +99,40 @@ static llvm::cl::opt<bool> OptHostSupportsJit("host-supports-jit",
 static llvm::cl::list<std::string> OptInputs(llvm::cl::Positional,
                                              llvm::cl::desc("[code to run]"));
 
+static std::string getCompilerRTPath() {
+  clang::DiagnosticOptions DiagOpts;
+  llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagID(
+      new clang::DiagnosticIDs());
+
+  clang::IgnoringDiagConsumer DiagConsumer;
+  clang::DiagnosticsEngine Diags(DiagID, DiagOpts, &DiagConsumer, false);
+  std::vector<const char *> Args = {"clang", "--version"};
+  clang::driver::Driver D("clang", llvm::sys::getProcessTriple(), Diags);
+  D.setCheckInputsExist(false);
+
+  std::unique_ptr<clang::driver::Compilation> C(D.BuildCompilation(Args));
+  if (!C) {
+    return "";
+  }
+
+  const clang::driver::ToolChain &TC = C->getDefaultToolChain();
+  std::optional<std::string> CompilerRTPath = TC.getCompilerRTPath();
+
+  return CompilerRTPath ? *CompilerRTPath : "";
+}
+
+static std::string getOrcRuntimePath() {
----------------
vgvassilev wrote:

Let's sink that logic in `IncrementalCompilerBuilder::create`. That would simplify things.

https://github.com/llvm/llvm-project/pull/155140


More information about the cfe-commits mailing list