[Mlir-commits] [mlir] [mlir] Apply rule of five for Pass / OperationPass (PR #80998)
Markus Böck
llvmlistbot at llvm.org
Wed Feb 7 07:43:05 PST 2024
================
@@ -161,6 +161,13 @@ class Pass {
explicit Pass(TypeID passID, std::optional<StringRef> opName = std::nullopt)
: passID(passID), opName(opName) {}
Pass(const Pass &other) : Pass(other.passID, other.opName) {}
+ Pass &operator=(const Pass &other) {
+ this->passID = other.passID;
+ this->opName = other.opName;
+ return *this;
+ }
+ Pass(Pass &&) = delete;
----------------
zero9178 wrote:
This creates an odd inconsistency where a pass can now be copy constructed but not move constructed.
Since copying is a valid implementation of moving, should the move constructors just dispatch to the copy constructor? Just writing:
```cpp
Pass(Pass&& rhs) : Pass(rhs)
{}
```
would achieve this. Similar for the assignment operator.
https://github.com/llvm/llvm-project/pull/80998
More information about the Mlir-commits
mailing list