[all-commits] [llvm/llvm-project] 617913: [mlir] explicitly delete copy ctor for DialectRegi...

Maksim Levental via All-commits all-commits at lists.llvm.org
Fri May 23 04:24:15 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 617913150a0965ac2d549a569c0ce6ed14a05aed
      https://github.com/llvm/llvm-project/commit/617913150a0965ac2d549a569c0ce6ed14a05aed
  Author: Maksim Levental <maksim.levental at gmail.com>
  Date:   2025-05-23 (Fri, 23 May 2025)

  Changed paths:
    M mlir/include/mlir/IR/DialectRegistry.h
    M mlir/include/mlir/IR/OperationSupport.h

  Log Message:
  -----------
  [mlir] explicitly delete copy ctor for DialectRegistry and OperationState (#140963)

Both of these classes have fields involving `unique_ptr`s and thus can't
be copied.
Holding a unique_ptr should trigger implicit deletion of the
copy/assignment constructors, however
not when held through a container:

```
struct Foo {  
  explicit Foo();
  std::vector<std::unique_ptr<Bar>> ptr; // Does not implicitly delete its cpy/assign ctors
};
```

This results in a complicated diagnostics when attempting to copy such a
class (it'll point to the
inner implementation of the container), instead of a nicer error message
about `Foo` not being able
to be copied/assigned. Explicitly deleting the ctors provides an
immediate diagnostic about the issue.

Fixes https://github.com/llvm/llvm-project/issues/118388



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list