[all-commits] [llvm/llvm-project] 90e9e9: [mlir][NFC] Apply rule of five to *Pass classes (...

Andrei Golubev via All-commits all-commits at lists.llvm.org
Mon Mar 4 23:07:54 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 90e9e962e18fc4304c6aba81de2bb53069bcd358
      https://github.com/llvm/llvm-project/commit/90e9e962e18fc4304c6aba81de2bb53069bcd358
  Author: Andrei Golubev <andrey.golubev at intel.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M mlir/include/mlir/Pass/Pass.h
    M mlir/tools/mlir-tblgen/PassGen.cpp

  Log Message:
  -----------
  [mlir][NFC] Apply rule of five to *Pass classes  (#80998)

Define all special member functions for mlir::Pass, mlir::OperationPass,
mlir::PassWrapper and PassGen types since these classes explicitly
specify copy-ctor. This, subsequently, should silence static analysis
checkers that report rule-of-3 / rule-of-5 violations.

Given the nature of the types, however, mark other special member
functions deleted: the semantics of a Pass type object seems to be that
it is only ever created by being wrapped in a smart pointer, so the
special member functions are never to be used externally (except for the
copy-ctor - it is "special" since it is a "delegating" ctor for derived
pass types to use during cloning - see https://reviews.llvm.org/D104302
for details).

Deleting other member functions means that `Pass x(std::move(y))` - that
used to silently work (via copy-ctor) - would fail to compile now. Yet,
as the copy ctors through the hierarchy are under 'protected' access,
the issue is unlikely to appear in practice.

Co-authored-by: Asya Pronina <anastasiya.pronina at intel.com>
Co-authored-by: Harald Rotuna <harald.razvan.rotuna at intel.com>



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