[Mlir-commits] [mlir] ActionHandler Non-const getter (PR #199652)

Kigyosi Alexandru llvmlistbot at llvm.org
Tue May 26 03:22:31 PDT 2026


https://github.com/akigyosi created https://github.com/llvm/llvm-project/pull/199652

None

>From fd161348c045112ae0a4511264ccb7dc05f1dfee Mon Sep 17 00:00:00 2001
From: Alexandru Kigyosi <alexandru.kigyosi at intel.com>
Date: Tue, 26 May 2026 10:20:53 +0000
Subject: [PATCH] non-const getter

---
 mlir/include/mlir/IR/MLIRContext.h | 3 ++-
 mlir/lib/IR/MLIRContext.cpp        | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h
index ab121777a1296..d2e0c4a9a1b7f 100644
--- a/mlir/include/mlir/IR/MLIRContext.h
+++ b/mlir/include/mlir/IR/MLIRContext.h
@@ -269,7 +269,8 @@ class MLIRContext {
 
   /// Return a reference to the currently registered action handler. Its target
   /// can be used to gain access to the handler's state, if any.
-  const HandlerTy &getActionHandler();
+  const HandlerTy &getActionHandler() const;
+  HandlerTy &getActionHandler();
 
   /// Return true if a valid ActionHandler is set.
   bool hasActionHandler();
diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index 624121c2733ba..da891a7e6e014 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -380,7 +380,11 @@ void MLIRContext::registerActionHandler(HandlerTy handler) {
   getImpl().actionHandler = std::move(handler);
 }
 
-const MLIRContext::HandlerTy &MLIRContext::getActionHandler() {
+const MLIRContext::HandlerTy &MLIRContext::getActionHandler() const {
+  return getImpl().actionHandler;
+}
+
+MLIRContext::HandlerTy &MLIRContext::getActionHandler() {
   return getImpl().actionHandler;
 }
 



More information about the Mlir-commits mailing list