@@ -14,23 +14,23 @@ include "mlir/IR/OpBase.td"
14
14
15
15
// DEF: #ifdef GET_ATTRDEF_LIST
16
16
// DEF: #undef GET_ATTRDEF_LIST
17
+ // DEF: ::test::IndexAttr,
17
18
// DEF: ::test::SimpleAAttr,
18
19
// DEF: ::test::CompoundAAttr,
19
- // DEF: ::test::IndexAttr,
20
20
// DEF: ::test::SingleParameterAttr
21
21
22
22
// DEF-LABEL: ::mlir::OptionalParseResult generatedAttributeParser(
23
23
// DEF-SAME: ::mlir::AsmParser &parser,
24
24
// DEF-SAME: ::llvm::StringRef *mnemonic, ::mlir::Type type,
25
25
// DEF-SAME: ::mlir::Attribute &value) {
26
26
// DEF: return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
27
+ // DEF: .Case(::test::IndexAttr::getMnemonic()
28
+ // DEF-NEXT: value = ::test::IndexAttr::parse(parser, type);
29
+ // DEF-NEXT: return ::mlir::success(!!value);
27
30
// DEF: .Case(::test::CompoundAAttr::getMnemonic()
28
31
// DEF-NEXT: value = ::test::CompoundAAttr::parse(parser, type);
29
32
// DEF-NEXT: return ::mlir::success(!!value);
30
33
// DEF-NEXT: })
31
- // DEF-NEXT: .Case(::test::IndexAttr::getMnemonic()
32
- // DEF-NEXT: value = ::test::IndexAttr::parse(parser, type);
33
- // DEF-NEXT: return ::mlir::success(!!value);
34
34
// DEF: .Default([&](llvm::StringRef keyword,
35
35
// DEF-NEXT: *mnemonic = keyword;
36
36
// DEF-NEXT: return std::nullopt;
@@ -44,6 +44,24 @@ def Test_Dialect: Dialect {
44
44
45
45
class TestAttr<string name> : AttrDef<Test_Dialect, name> { }
46
46
47
+ def C_IndexAttr : TestAttr<"Index"> {
48
+ let mnemonic = "index";
49
+
50
+ let parameters = (
51
+ ins
52
+ StringRefParameter<"Label for index">:$label
53
+ );
54
+ let hasCustomAssemblyFormat = 1;
55
+
56
+ // DECL-LABEL: class IndexAttr : public ::mlir::Attribute
57
+ // DECL: static constexpr ::llvm::StringLiteral getMnemonic() {
58
+ // DECL: return {"index"};
59
+ // DECL: }
60
+ // DECL: static ::mlir::Attribute parse(
61
+ // DECL-SAME: ::mlir::AsmParser &odsParser, ::mlir::Type odsType);
62
+ // DECL: void print(::mlir::AsmPrinter &odsPrinter) const;
63
+ }
64
+
47
65
def A_SimpleAttrA : TestAttr<"SimpleA"> {
48
66
// DECL: class SimpleAAttr : public ::mlir::Attribute
49
67
}
@@ -100,24 +118,6 @@ def B_CompoundAttrA : TestAttr<"CompoundA"> {
100
118
// DEF-NEXT: return getImpl()->inner;
101
119
}
102
120
103
- def C_IndexAttr : TestAttr<"Index"> {
104
- let mnemonic = "index";
105
-
106
- let parameters = (
107
- ins
108
- StringRefParameter<"Label for index">:$label
109
- );
110
- let hasCustomAssemblyFormat = 1;
111
-
112
- // DECL-LABEL: class IndexAttr : public ::mlir::Attribute
113
- // DECL: static constexpr ::llvm::StringLiteral getMnemonic() {
114
- // DECL: return {"index"};
115
- // DECL: }
116
- // DECL: static ::mlir::Attribute parse(
117
- // DECL-SAME: ::mlir::AsmParser &odsParser, ::mlir::Type odsType);
118
- // DECL: void print(::mlir::AsmPrinter &odsPrinter) const;
119
- }
120
-
121
121
def D_SingleParameterAttr : TestAttr<"SingleParameter"> {
122
122
let parameters = (
123
123
ins
0 commit comments