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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue May 26 03:23:27 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Kigyosi Alexandru (akigyosi)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/199652.diff


2 Files Affected:

- (modified) mlir/include/mlir/IR/MLIRContext.h (+2-1) 
- (modified) mlir/lib/IR/MLIRContext.cpp (+5-1) 


``````````diff
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;
 }
 

``````````

</details>


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


More information about the Mlir-commits mailing list