[llvm] [orc-rt] Make more Session callbacks noexcept. (PR #226385)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 00:17:11 PDT 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/226385

Session's OnDisconnectFn, OnDetachFn, and OnShutdownFn callbacks should not throw exceptions.

>From 93528cb35e893cec7237f0b3821821785ed2ad06 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Fri, 25 Sep 2026 17:13:59 +1000
Subject: [PATCH] [orc-rt] Make more Session callbacks noexcept.

Session's OnDisconnectFn, OnDetachFn, and OnShutdownFn callbacks should
not throw exceptions.
---
 orc-rt/include/orc-rt/bedrock/Session.h   | 6 +++---
 orc-rt/lib/bedrock/NativeDylibManager.cpp | 2 +-
 orc-rt/tools/ogre/ogre.cpp                | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/orc-rt/include/orc-rt/bedrock/Session.h b/orc-rt/include/orc-rt/bedrock/Session.h
index 66128643d3f0ca..d9bc61359ccc6d 100644
--- a/orc-rt/include/orc-rt/bedrock/Session.h
+++ b/orc-rt/include/orc-rt/bedrock/Session.h
@@ -72,9 +72,9 @@ class Session {
 
 public:
   using ErrorReporterFn = move_only_function<void(Error) noexcept>;
-  using OnDisconnectFn = move_only_function<void(Error)>;
-  using OnDetachFn = move_only_function<void()>;
-  using OnShutdownFn = move_only_function<void()>;
+  using OnDisconnectFn = move_only_function<void(Error) noexcept>;
+  using OnDetachFn = move_only_function<void() noexcept>;
+  using OnShutdownFn = move_only_function<void() noexcept>;
 
   /// Return value callback used to return results from callController.
   using OnControllerCallReturnFn =
diff --git a/orc-rt/lib/bedrock/NativeDylibManager.cpp b/orc-rt/lib/bedrock/NativeDylibManager.cpp
index d26f92e24851ec..72201d3866dafe 100644
--- a/orc-rt/lib/bedrock/NativeDylibManager.cpp
+++ b/orc-rt/lib/bedrock/NativeDylibManager.cpp
@@ -50,7 +50,7 @@ void NativeDylibManager::load(OnLoadCompleteFn &&OnComplete, std::string Path) {
 
   // Capture S by reference, rather than this, so that the callback remains
   // valid even if the NativeDylibManager is destroyed prior to shutdown.
-  S.addOnShutdown([&S = this->S, Handle = *H]() {
+  S.addOnShutdown([&S = this->S, Handle = *H]() noexcept {
     if (auto Err = sys::unloadLibrary(Handle))
       S.reportError(std::move(Err));
   });
diff --git a/orc-rt/tools/ogre/ogre.cpp b/orc-rt/tools/ogre/ogre.cpp
index 1fbef3087e79c9..c98da66fba3194 100644
--- a/orc-rt/tools/ogre/ogre.cpp
+++ b/orc-rt/tools/ogre/ogre.cpp
@@ -140,7 +140,7 @@ Expected<int> runOgre(const Options &Opts) noexcept {
 
   std::promise<void> StopP;
   auto StopF = StopP.get_future();
-  S.setOnDisconnect([StopP = std::move(StopP)](Error Err) mutable {
+  S.setOnDisconnect([StopP = std::move(StopP)](Error Err) mutable noexcept {
     if (Err)
       reportError(std::move(Err));
     StopP.set_value();



More information about the llvm-commits mailing list