[clang] [llvm] [Clang-Repl] Add support for out-of-process execution. (PR #110418)

Lang Hames via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 02:40:35 PST 2024


================
@@ -697,15 +718,20 @@ llvm::Error Interpreter::Undo(unsigned N) {
   return llvm::Error::success();
 }
 
-llvm::Error Interpreter::LoadDynamicLibrary(const char *name) {
+llvm::Error Interpreter::LoadDynamicLibrary(const char *name, bool UseEPC) {
   auto EE = getExecutionEngine();
   if (!EE)
     return EE.takeError();
 
   auto &DL = EE->getDataLayout();
-
-  if (auto DLSG = llvm::orc::DynamicLibrarySearchGenerator::Load(
-          name, DL.getGlobalPrefix()))
+  if (UseEPC) {
+    if (auto DLSG = llvm::orc::EPCDynamicLibrarySearchGenerator::Load(
+            EE->getExecutionSession(), name))
+      EE->getMainJITDylib().addGenerator(std::move(*DLSG));
+    else
+      return DLSG.takeError();
+  } else if (auto DLSG = llvm::orc::DynamicLibrarySearchGenerator::Load(
+                 name, DL.getGlobalPrefix()))
     EE->getMainJITDylib().addGenerator(std::move(*DLSG));
   else
     return DLSG.takeError();
----------------
lhames wrote:

Have you tried using the EPC generator unconditionally here? That should always work now.

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


More information about the cfe-commits mailing list