[llvm-branch-commits] [mlir] release/18.x: [mlir][NFC] Apply rule of five to *Pass classes (#80998) (PR #83971)

Andrei Golubev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 14 01:44:53 PDT 2024


andrey-golubev wrote:

> I think it's an ABI change (but I could be wrong), because some of the implicit constructors are being deleted. What happens if a user of the library was using these deleted constructors?

I see your point. In this specific case, the special member functions were implicitly deleted anyway: the class used to have an explicit user-specified (non-default) copy ctor and that's about it. There is at least 1 member field in `Pass` that is non-movable and non-copyable. No copy-assignment operator -> implicitly deleted. No move semantics: move ctor would've dispatched to copy ctor, move assignment - implicitly deleted also. So the only case we've sacrificed with this patch is `X x(X())` (and other cases that call move ctor) - they are now rejected by the compiler instead of silently succeeding.

Also, the users, I believe, are only within the inheritance chain, because all of this special member functions (except dtor) are under `protected` access specifier (unless there's some user lib that changes this at some lower level?).

In any case, if there's already a released 18.0 then this change would only get into some other version and, as you mentioned, this is something you prefer to avoid for API/ABI incompatible changes.

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


More information about the llvm-branch-commits mailing list