diff --git a/mlir/test/mlir-tblgen/attr-or-type-format.td b/mlir/test/mlir-tblgen/attr-or-type-format.td --- a/mlir/test/mlir-tblgen/attr-or-type-format.td +++ b/mlir/test/mlir-tblgen/attr-or-type-format.td @@ -2,6 +2,7 @@ // RUN: mlir-tblgen -gen-typedef-defs -I %S/../../include %s | FileCheck %s --check-prefix=TYPE include "mlir/IR/AttrTypeBase.td" +include "mlir/IR/EnumAttr.td" include "mlir/IR/OpBase.td" /// Test that attribute and type printers and parsers are correctly generated. @@ -194,6 +195,23 @@ let assemblyFormat = "custom(ref($type))"; } +def TestEnum : I32EnumAttr<"TestEnum", "TestEnumType", [ + I32EnumAttrCase<"first", 0>, + I32EnumAttrCase<"second", 1> +]> { + let genSpecializedAttr = 0; +} + +// ATTR-LABEL: TestEnumAttr::parse +// ATTR: parseFoo(odsParser, +// ATTR-NEXT: _result_value +// ATTR-LABEL: TestEnumAttr::print +// ATTR: printFoo(odsPrinter, +// ATTR-NEXT: getValue() +def EnumAttrA : EnumAttr { + let assemblyFormat = "custom($value)"; +} + /// Test type parser and printer that mix variables and struct are generated /// correctly.