[Mlir-commits] [mlir] [mlir] fix copying DialectRegistry and OperationState (PR #140963)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 21 15:23:40 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-mlir
Author: Maksim Levental (makslevental)
<details>
<summary>Changes</summary>
Both of these classes have fields involving `unique_ptr`s and thus can't be copied.
Fixes https://github.com/llvm/llvm-project/issues/118388
---
Full diff: https://github.com/llvm/llvm-project/pull/140963.diff
2 Files Affected:
- (modified) mlir/include/mlir/IR/DialectRegistry.h (+2)
- (modified) mlir/include/mlir/IR/OperationSupport.h (+2-2)
``````````diff
diff --git a/mlir/include/mlir/IR/DialectRegistry.h b/mlir/include/mlir/IR/DialectRegistry.h
index d3d53488fe72d..7bcf1eda7c636 100644
--- a/mlir/include/mlir/IR/DialectRegistry.h
+++ b/mlir/include/mlir/IR/DialectRegistry.h
@@ -143,6 +143,8 @@ class DialectRegistry {
public:
explicit DialectRegistry();
+ DialectRegistry(const DialectRegistry &) = delete;
+ DialectRegistry &operator=(const DialectRegistry &other) = delete;
template <typename ConcreteDialect>
void insert() {
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 2d9fb2bc5859e..0046d977c68f4 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -985,9 +985,9 @@ struct OperationState {
BlockRange successors = {},
MutableArrayRef<std::unique_ptr<Region>> regions = {});
OperationState(OperationState &&other) = default;
- OperationState(const OperationState &other) = default;
OperationState &operator=(OperationState &&other) = default;
- OperationState &operator=(const OperationState &other) = default;
+ OperationState(const OperationState &other) = delete;
+ OperationState &operator=(const OperationState &other) = delete;
~OperationState();
/// Get (or create) a properties of the provided type to be set on the
``````````
</details>
https://github.com/llvm/llvm-project/pull/140963
More information about the Mlir-commits
mailing list