[all-commits] [llvm/llvm-project] 0f827e: [mlir][ods] add mechanism for deprecating an `OpBu...

zero9178 via All-commits all-commits at lists.llvm.org
Tue Feb 7 07:49:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f827ee0366922c16fe987c75dad459e717b4f6e
      https://github.com/llvm/llvm-project/commit/0f827ee0366922c16fe987c75dad459e717b4f6e
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-07 (Tue, 07 Feb 2023)

  Changed paths:
    M mlir/docs/DefiningDialects/Operations.md
    M mlir/include/mlir/IR/DialectBase.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/TableGen/Builder.h
    M mlir/include/mlir/TableGen/Class.h
    M mlir/lib/TableGen/Builder.cpp
    M mlir/lib/TableGen/Class.cpp
    M mlir/test/mlir-tblgen/op-decl-and-defs.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir][ods] add mechanism for deprecating an `OpBuilder` in ODS

This allows discouraging the use of specific build methods of an op by having TableGen generate C++ code, instructing the C++ compiler to warn on use of the `build` method.
The implementation uses the C++14 `[[deprecated(...)]]`` for this purpose. I considered using `LLVM_DEPRECATED`, but thought requiring a fix-it was not necassery, nor would the syntax in ODS have been very nice.

My motivation for this change is that in the future I'd like to deprecate the use `build` methods in the LLVM Dialect, not using explicit pointer types for ops such as `llvm.load` or `llvm.alloca`, which makes the code not future proof for opaque pointers. In-tree has to be clean first before I could commit such a change of course, but I thought the initial infrastructure change could already be submitted.

Differential Revision: https://reviews.llvm.org/D143190




More information about the All-commits mailing list