1 // RUN: mlir-tblgen -gen-op-decls -I %S/../../include %s | FileCheck %s --check-prefix=DECL
2 // RUN: mlir-tblgen -gen-op-defs -I %S/../../include %s | FileCheck %s --check-prefix=DEF
4 include "mlir/IR/OpBase.td"
6 // Check using the dialect name as the namespace
7 def A_Dialect : Dialect {
11 def A_SomeOp : Op<A_Dialect, "some_op", []>;
13 // Check a single namespace
14 def B_Dialect : Dialect {
16 let cppNamespace = "BNS";
19 // Check nested namespaces
20 def B_SomeOp : Op<B_Dialect, "some_op", []>;
22 def C_Dialect : Dialect {
24 let cppNamespace = "::C::CC";
27 def C_SomeOp : Op<C_Dialect, "some_op", []>;
29 // Check no namespaces
30 def D_Dialect : Dialect {
32 let cppNamespace = "";
35 def D_DSomeOp : Op<D_Dialect, "some_op", []>;
37 // Check op with namespace override.
38 def E_Dialect : Dialect {
40 let cppNamespace = "ENS";
43 def E_SomeOp : Op<E_Dialect, "some_op", []>;
44 def E_SpecialNSOp : Op<E_Dialect, "special_ns_op", []> {
45 let cppNamespace = "::E::SPECIAL_NS";
48 // DEF-LABEL: GET_OP_LIST
50 // DEF-NEXT: BNS::SomeOp
51 // DEF-NEXT: ::C::CC::SomeOp
53 // DEF-NEXT: ENS::SomeOp
54 // DEF-NEXT: ::E::SPECIAL_NS::SpecialNSOp
56 // DEF-LABEL: GET_OP_CLASSES
57 // DEF: a::SomeOp definitions
58 // DEF: BNS::SomeOp definitions
59 // DEF: ::C::CC::SomeOp definitions
60 // DEF: DSomeOp definitions
61 // DEF: ENS::SomeOp definitions
62 // DEF: ::E::SPECIAL_NS::SpecialNSOp definitions
64 // DECL-LABEL: GET_OP_CLASSES
65 // DECL: a::SomeOp declarations
66 // DECL: BNS::SomeOp declarations
67 // DECL: ::C::CC::SomeOp declarations
68 // DECL: DSomeOp declarations
69 // DECL: ENS::SomeOp declarations
70 // DECL: ::E::SPECIAL_NS::SpecialNSOp declarations