[all-commits] [llvm/llvm-project] e40348: [MLIR] Specify namespace for standard dialect usin...

Andi Drebes via All-commits all-commits at lists.llvm.org
Mon May 31 10:13:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4034881c3537d914b3208ddcf8200fb437073c8
      https://github.com/llvm/llvm-project/commit/e4034881c3537d914b3208ddcf8200fb437073c8
  Author: Andi Drebes <andi at drebesium.org>
  Date:   2021-05-31 (Mon, 31 May 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td

  Log Message:
  -----------
  [MLIR] Specify namespace for standard dialect using cppNamespace field

The `::mlir` namespace for operations from standard is currently
defined by enclosing the header file generated from the ODS in
`Ops.td` in a namespace in `Ops.h`. However, when referencing
operations from `Ops.td` in other TableGen files, this causes the
generated C++ code to refer to classes from the global namespace
instead of `::mlir`.

By defining the namespace through the `cppNamespace` field for
`StandardOps_Dialect` directly in `Ops.td` instead, the ODS
becomes reusable in other TableGen files through simple
inclusion.

Reviewed By: mehdi_amini

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




More information about the All-commits mailing list