Bug Summary

File:build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins/tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc
Warning:line 1317, column 5
Value stored to '_firstPrinted' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name TestAttributes.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins -resource-dir /usr/lib/llvm-16/lib/clang/16.0.0 -D MLIR_CUDA_CONVERSIONS_ENABLED=1 -D MLIR_INCLUDE_TESTS -D MLIR_ROCM_CONVERSIONS_ENABLED=1 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I tools/mlir/test/lib/Dialect/Test -I /build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/mlir/test/lib/Dialect/Test -I include -I /build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/llvm/include -I /build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/mlir/include -I tools/mlir/include -D _FORTIFY_SOURCE=2 -D NDEBUG -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/llvm-16/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fmacro-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/= -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/= -O2 -Wno-unused-command-line-argument -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-comment -Wno-misleading-indentation -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/= -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-10-03-140002-15933-1 -x c++ /build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/mlir/test/lib/Dialect/Test/TestAttributes.cpp
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* AttrDef Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_ATTRDEF_LIST
10#undef GET_ATTRDEF_LIST
11
12::test::AttrWithSelfTypeParamAttr,
13::test::AttrWithTraitAttr,
14::test::AttrWithTypeBuilderAttr,
15::test::CompoundAAttr,
16::test::CompoundAttrNestedAttr,
17::test::CompoundNestedInnerAttr,
18::test::CompoundNestedOuterAttr,
19::test::CompoundNestedOuterQualAttr,
20::test::SimpleAAttr,
21::test::ArrayOfEnumsAttr,
22::test::ArrayOfIntsAttr,
23::test::ArrayOfUglyAttrsAttr,
24::test::TestAttrParamsAttr,
25::test::TestAttrSelfTypeParameterFormatAttr,
26::test::TestAttrUglyAttr,
27::test::TestAttrWithFormatAttr,
28::test::TestAttrWithTypeParamAttr,
29::test::TestBitEnumAttr,
30::test::TestBitEnumVerticalBarAttr,
31::test::TestEnumAttr,
32::test::TestExtern1DI64ElementsAttr,
33::test::TestI64ElementsAttr,
34::test::TestOverrideBuilderAttr,
35::test::SimpleEnumAttr,
36::test::TestSubElementsAccessAttr
37
38#endif // GET_ATTRDEF_LIST
39
40#ifdef GET_ATTRDEF_CLASSES
41#undef GET_ATTRDEF_CLASSES
42
43static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
44 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
45 .Case(::test::AttrWithSelfTypeParamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
46 value = ::test::AttrWithSelfTypeParamAttr::parse(parser, type);
47 return ::mlir::success(!!value);
48 })
49 .Case(::test::AttrWithTraitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
50 value = ::test::AttrWithTraitAttr::get(parser.getContext());
51 return ::mlir::success(!!value);
52 })
53 .Case(::test::AttrWithTypeBuilderAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
54 value = ::test::AttrWithTypeBuilderAttr::parse(parser, type);
55 return ::mlir::success(!!value);
56 })
57 .Case(::test::CompoundAAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
58 value = ::test::CompoundAAttr::parse(parser, type);
59 return ::mlir::success(!!value);
60 })
61 .Case(::test::CompoundAttrNestedAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
62 value = ::test::CompoundAttrNestedAttr::parse(parser, type);
63 return ::mlir::success(!!value);
64 })
65 .Case(::test::CompoundNestedInnerAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
66 value = ::test::CompoundNestedInnerAttr::parse(parser, type);
67 return ::mlir::success(!!value);
68 })
69 .Case(::test::CompoundNestedOuterAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
70 value = ::test::CompoundNestedOuterAttr::parse(parser, type);
71 return ::mlir::success(!!value);
72 })
73 .Case(::test::CompoundNestedOuterQualAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
74 value = ::test::CompoundNestedOuterQualAttr::parse(parser, type);
75 return ::mlir::success(!!value);
76 })
77 .Case(::test::SimpleAAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
78 value = ::test::SimpleAAttr::get(parser.getContext());
79 return ::mlir::success(!!value);
80 })
81 .Case(::test::ArrayOfEnumsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
82 value = ::test::ArrayOfEnumsAttr::parse(parser, type);
83 return ::mlir::success(!!value);
84 })
85 .Case(::test::ArrayOfIntsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
86 value = ::test::ArrayOfIntsAttr::parse(parser, type);
87 return ::mlir::success(!!value);
88 })
89 .Case(::test::ArrayOfUglyAttrsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
90 value = ::test::ArrayOfUglyAttrsAttr::parse(parser, type);
91 return ::mlir::success(!!value);
92 })
93 .Case(::test::TestAttrParamsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
94 value = ::test::TestAttrParamsAttr::parse(parser, type);
95 return ::mlir::success(!!value);
96 })
97 .Case(::test::TestAttrSelfTypeParameterFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
98 value = ::test::TestAttrSelfTypeParameterFormatAttr::parse(parser, type);
99 return ::mlir::success(!!value);
100 })
101 .Case(::test::TestAttrUglyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
102 value = ::test::TestAttrUglyAttr::parse(parser, type);
103 return ::mlir::success(!!value);
104 })
105 .Case(::test::TestAttrWithFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
106 value = ::test::TestAttrWithFormatAttr::parse(parser, type);
107 return ::mlir::success(!!value);
108 })
109 .Case(::test::TestAttrWithTypeParamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
110 value = ::test::TestAttrWithTypeParamAttr::parse(parser, type);
111 return ::mlir::success(!!value);
112 })
113 .Case(::test::TestBitEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
114 value = ::test::TestBitEnumAttr::parse(parser, type);
115 return ::mlir::success(!!value);
116 })
117 .Case(::test::TestBitEnumVerticalBarAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
118 value = ::test::TestBitEnumVerticalBarAttr::parse(parser, type);
119 return ::mlir::success(!!value);
120 })
121 .Case(::test::TestEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
122 value = ::test::TestEnumAttr::parse(parser, type);
123 return ::mlir::success(!!value);
124 })
125 .Case(::test::TestExtern1DI64ElementsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
126 value = ::test::TestExtern1DI64ElementsAttr::parse(parser, type);
127 return ::mlir::success(!!value);
128 })
129 .Case(::test::TestI64ElementsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
130 value = ::test::TestI64ElementsAttr::parse(parser, type);
131 return ::mlir::success(!!value);
132 })
133 .Case(::test::TestOverrideBuilderAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
134 value = ::test::TestOverrideBuilderAttr::parse(parser, type);
135 return ::mlir::success(!!value);
136 })
137 .Case(::test::SimpleEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
138 value = ::test::SimpleEnumAttr::parse(parser, type);
139 return ::mlir::success(!!value);
140 })
141 .Case(::test::TestSubElementsAccessAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
142 value = ::test::TestSubElementsAccessAttr::parse(parser, type);
143 return ::mlir::success(!!value);
144 })
145 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
146 *mnemonic = keyword;
147 return llvm::None;
148 });
149}
150
151static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
152 return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::test::AttrWithSelfTypeParamAttr>([&](auto t) {
153 printer << ::test::AttrWithSelfTypeParamAttr::getMnemonic();
154t.print(printer);
155 return ::mlir::success();
156 })
157 .Case<::test::AttrWithTraitAttr>([&](auto t) {
158 printer << ::test::AttrWithTraitAttr::getMnemonic();
159 return ::mlir::success();
160 })
161 .Case<::test::AttrWithTypeBuilderAttr>([&](auto t) {
162 printer << ::test::AttrWithTypeBuilderAttr::getMnemonic();
163t.print(printer);
164 return ::mlir::success();
165 })
166 .Case<::test::CompoundAAttr>([&](auto t) {
167 printer << ::test::CompoundAAttr::getMnemonic();
168t.print(printer);
169 return ::mlir::success();
170 })
171 .Case<::test::CompoundAttrNestedAttr>([&](auto t) {
172 printer << ::test::CompoundAttrNestedAttr::getMnemonic();
173t.print(printer);
174 return ::mlir::success();
175 })
176 .Case<::test::CompoundNestedInnerAttr>([&](auto t) {
177 printer << ::test::CompoundNestedInnerAttr::getMnemonic();
178t.print(printer);
179 return ::mlir::success();
180 })
181 .Case<::test::CompoundNestedOuterAttr>([&](auto t) {
182 printer << ::test::CompoundNestedOuterAttr::getMnemonic();
183t.print(printer);
184 return ::mlir::success();
185 })
186 .Case<::test::CompoundNestedOuterQualAttr>([&](auto t) {
187 printer << ::test::CompoundNestedOuterQualAttr::getMnemonic();
188t.print(printer);
189 return ::mlir::success();
190 })
191 .Case<::test::SimpleAAttr>([&](auto t) {
192 printer << ::test::SimpleAAttr::getMnemonic();
193 return ::mlir::success();
194 })
195 .Case<::test::ArrayOfEnumsAttr>([&](auto t) {
196 printer << ::test::ArrayOfEnumsAttr::getMnemonic();
197t.print(printer);
198 return ::mlir::success();
199 })
200 .Case<::test::ArrayOfIntsAttr>([&](auto t) {
201 printer << ::test::ArrayOfIntsAttr::getMnemonic();
202t.print(printer);
203 return ::mlir::success();
204 })
205 .Case<::test::ArrayOfUglyAttrsAttr>([&](auto t) {
206 printer << ::test::ArrayOfUglyAttrsAttr::getMnemonic();
207t.print(printer);
208 return ::mlir::success();
209 })
210 .Case<::test::TestAttrParamsAttr>([&](auto t) {
211 printer << ::test::TestAttrParamsAttr::getMnemonic();
212t.print(printer);
213 return ::mlir::success();
214 })
215 .Case<::test::TestAttrSelfTypeParameterFormatAttr>([&](auto t) {
216 printer << ::test::TestAttrSelfTypeParameterFormatAttr::getMnemonic();
217t.print(printer);
218 return ::mlir::success();
219 })
220 .Case<::test::TestAttrUglyAttr>([&](auto t) {
221 printer << ::test::TestAttrUglyAttr::getMnemonic();
222t.print(printer);
223 return ::mlir::success();
224 })
225 .Case<::test::TestAttrWithFormatAttr>([&](auto t) {
226 printer << ::test::TestAttrWithFormatAttr::getMnemonic();
227t.print(printer);
228 return ::mlir::success();
229 })
230 .Case<::test::TestAttrWithTypeParamAttr>([&](auto t) {
231 printer << ::test::TestAttrWithTypeParamAttr::getMnemonic();
232t.print(printer);
233 return ::mlir::success();
234 })
235 .Case<::test::TestBitEnumAttr>([&](auto t) {
236 printer << ::test::TestBitEnumAttr::getMnemonic();
237t.print(printer);
238 return ::mlir::success();
239 })
240 .Case<::test::TestBitEnumVerticalBarAttr>([&](auto t) {
241 printer << ::test::TestBitEnumVerticalBarAttr::getMnemonic();
242t.print(printer);
243 return ::mlir::success();
244 })
245 .Case<::test::TestEnumAttr>([&](auto t) {
246 printer << ::test::TestEnumAttr::getMnemonic();
247t.print(printer);
248 return ::mlir::success();
249 })
250 .Case<::test::TestExtern1DI64ElementsAttr>([&](auto t) {
251 printer << ::test::TestExtern1DI64ElementsAttr::getMnemonic();
252t.print(printer);
253 return ::mlir::success();
254 })
255 .Case<::test::TestI64ElementsAttr>([&](auto t) {
256 printer << ::test::TestI64ElementsAttr::getMnemonic();
257t.print(printer);
258 return ::mlir::success();
259 })
260 .Case<::test::TestOverrideBuilderAttr>([&](auto t) {
261 printer << ::test::TestOverrideBuilderAttr::getMnemonic();
262t.print(printer);
263 return ::mlir::success();
264 })
265 .Case<::test::SimpleEnumAttr>([&](auto t) {
266 printer << ::test::SimpleEnumAttr::getMnemonic();
267t.print(printer);
268 return ::mlir::success();
269 })
270 .Case<::test::TestSubElementsAccessAttr>([&](auto t) {
271 printer << ::test::TestSubElementsAccessAttr::getMnemonic();
272t.print(printer);
273 return ::mlir::success();
274 })
275 .Default([](auto) { return ::mlir::failure(); });
276}
277
278namespace test {
279namespace detail {
280struct AttrWithSelfTypeParamAttrStorage : public ::mlir::AttributeStorage {
281 using KeyTy = std::tuple<::mlir::Type>;
282 AttrWithSelfTypeParamAttrStorage(::mlir::Type type) : type(type) {}
283
284 bool operator==(const KeyTy &tblgenKey) const {
285 return (type == std::get<0>(tblgenKey));
286 }
287
288 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
289 return ::llvm::hash_combine(std::get<0>(tblgenKey));
290 }
291
292 static AttrWithSelfTypeParamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
293 auto type = std::get<0>(tblgenKey);
294 return new (allocator.allocate<AttrWithSelfTypeParamAttrStorage>()) AttrWithSelfTypeParamAttrStorage(type);
295 }
296
297 ::mlir::Type type;
298};
299} // namespace detail
300AttrWithSelfTypeParamAttr AttrWithSelfTypeParamAttr::get(::mlir::MLIRContext *context, ::mlir::Type type) {
301 return Base::get(context, type);
302}
303
304::mlir::Attribute AttrWithSelfTypeParamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
305 ::mlir::Builder odsBuilder(odsParser.getContext());
306 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
307 (void) odsLoc;
308 ::mlir::FailureOr<::mlir::Type> _result_type;
309
310 if (odsType) {
311 if (auto reqType = odsType.dyn_cast<::mlir::Type>()) {
312 _result_type = reqType;
313 } else {
314 odsParser.emitError(odsLoc, "invalid kind of type specified");
315 return {};
316 }
317 }
318 return AttrWithSelfTypeParamAttr::get(odsParser.getContext(),
319 ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext())))));
320}
321
322void AttrWithSelfTypeParamAttr::print(::mlir::AsmPrinter &odsPrinter) const {
323 ::mlir::Builder odsBuilder(getContext());
324}
325
326::mlir::Type AttrWithSelfTypeParamAttr::getType() const {
327 return getImpl()->type;
328}
329
330} // namespace test
331MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithSelfTypeParamAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::AttrWithSelfTypeParamAttr>::id = {}; } }
332namespace test {
333} // namespace test
334MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithTraitAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::AttrWithTraitAttr>::id = {}; } }
335namespace test {
336namespace detail {
337struct AttrWithTypeBuilderAttrStorage : public ::mlir::AttributeStorage {
338 using KeyTy = std::tuple<::mlir::IntegerAttr, mlir::Type>;
339 AttrWithTypeBuilderAttrStorage(::mlir::IntegerAttr attr, mlir::Type type) : attr(attr), type(type) {}
340
341 bool operator==(const KeyTy &tblgenKey) const {
342 return (attr == std::get<0>(tblgenKey)) && (type == std::get<1>(tblgenKey));
343 }
344
345 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
346 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
347 }
348
349 static AttrWithTypeBuilderAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
350 auto attr = std::get<0>(tblgenKey);
351 auto type = std::get<1>(tblgenKey);
352 return new (allocator.allocate<AttrWithTypeBuilderAttrStorage>()) AttrWithTypeBuilderAttrStorage(attr, type);
353 }
354
355 ::mlir::IntegerAttr attr;
356 mlir::Type type;
357};
358} // namespace detail
359AttrWithTypeBuilderAttr AttrWithTypeBuilderAttr::get(::mlir::MLIRContext *context, ::mlir::IntegerAttr attr, mlir::Type type) {
360 return Base::get(context, attr, type);
361}
362
363::mlir::Attribute AttrWithTypeBuilderAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
364 ::mlir::Builder odsBuilder(odsParser.getContext());
365 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
366 (void) odsLoc;
367 ::mlir::FailureOr<::mlir::IntegerAttr> _result_attr;
368 ::mlir::FailureOr<mlir::Type> _result_type;
369
370 if (odsType) {
371 if (auto reqType = odsType.dyn_cast<mlir::Type>()) {
372 _result_type = reqType;
373 } else {
374 odsParser.emitError(odsLoc, "invalid kind of type specified");
375 return {};
376 }
377 }
378
379 // Parse variable 'attr'
380 _result_attr = ::mlir::FieldParser<::mlir::IntegerAttr>::parse(odsParser);
381 if (::mlir::failed(_result_attr)) {
382 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse AttrWithTypeBuilder parameter 'attr' which is to be a `::mlir::IntegerAttr`");
383 return {};
384 }
385 assert(::mlir::succeeded(_result_attr))(static_cast <bool> (::mlir::succeeded(_result_attr)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_attr)",
"tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 385
, __extension__ __PRETTY_FUNCTION__))
;
386 return AttrWithTypeBuilderAttr::get(odsParser.getContext(),
387 ::mlir::IntegerAttr((*_result_attr)),
388 mlir::Type((_result_type.value_or((*_result_attr).getType()))));
389}
390
391void AttrWithTypeBuilderAttr::print(::mlir::AsmPrinter &odsPrinter) const {
392 ::mlir::Builder odsBuilder(getContext());
393 odsPrinter << ' ';
394 odsPrinter.printStrippedAttrOrType(getAttr());
395}
396
397::mlir::IntegerAttr AttrWithTypeBuilderAttr::getAttr() const {
398 return getImpl()->attr;
399}
400
401mlir::Type AttrWithTypeBuilderAttr::getType() const {
402 return getImpl()->type;
403}
404
405} // namespace test
406MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithTypeBuilderAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::AttrWithTypeBuilderAttr>::id = {}; } }
407namespace test {
408namespace detail {
409struct CompoundAAttrStorage : public ::mlir::AttributeStorage {
410 using KeyTy = std::tuple<int, ::mlir::Type, ::llvm::ArrayRef<int>>;
411 CompoundAAttrStorage(int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) : widthOfSomething(widthOfSomething), oneType(oneType), arrayOfInts(arrayOfInts) {}
412
413 bool operator==(const KeyTy &tblgenKey) const {
414 return (widthOfSomething == std::get<0>(tblgenKey)) && (oneType == std::get<1>(tblgenKey)) && (arrayOfInts == std::get<2>(tblgenKey));
415 }
416
417 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
418 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
419 }
420
421 static CompoundAAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
422 auto widthOfSomething = std::get<0>(tblgenKey);
423 auto oneType = std::get<1>(tblgenKey);
424 auto arrayOfInts = std::get<2>(tblgenKey);
425 arrayOfInts = allocator.copyInto(arrayOfInts);
426 return new (allocator.allocate<CompoundAAttrStorage>()) CompoundAAttrStorage(widthOfSomething, oneType, arrayOfInts);
427 }
428
429 int widthOfSomething;
430 ::mlir::Type oneType;
431 ::llvm::ArrayRef<int> arrayOfInts;
432};
433} // namespace detail
434CompoundAAttr CompoundAAttr::get(::mlir::MLIRContext *context, int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) {
435 return Base::get(context, widthOfSomething, oneType, arrayOfInts);
436}
437
438int CompoundAAttr::getWidthOfSomething() const {
439 return getImpl()->widthOfSomething;
440}
441
442::mlir::Type CompoundAAttr::getOneType() const {
443 return getImpl()->oneType;
444}
445
446::llvm::ArrayRef<int> CompoundAAttr::getArrayOfInts() const {
447 return getImpl()->arrayOfInts;
448}
449
450} // namespace test
451MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundAAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundAAttr>::id = {}; } }
452namespace test {
453namespace detail {
454struct CompoundAttrNestedAttrStorage : public ::mlir::AttributeStorage {
455 using KeyTy = std::tuple<::test::CompoundAAttr>;
456 CompoundAttrNestedAttrStorage(::test::CompoundAAttr nested) : nested(nested) {}
457
458 bool operator==(const KeyTy &tblgenKey) const {
459 return (nested == std::get<0>(tblgenKey));
460 }
461
462 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
463 return ::llvm::hash_combine(std::get<0>(tblgenKey));
464 }
465
466 static CompoundAttrNestedAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
467 auto nested = std::get<0>(tblgenKey);
468 return new (allocator.allocate<CompoundAttrNestedAttrStorage>()) CompoundAttrNestedAttrStorage(nested);
469 }
470
471 ::test::CompoundAAttr nested;
472};
473} // namespace detail
474CompoundAttrNestedAttr CompoundAttrNestedAttr::get(::mlir::MLIRContext *context, ::test::CompoundAAttr nested) {
475 return Base::get(context, nested);
476}
477
478::mlir::Attribute CompoundAttrNestedAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
479 ::mlir::Builder odsBuilder(odsParser.getContext());
480 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
481 (void) odsLoc;
482 ::mlir::FailureOr<::test::CompoundAAttr> _result_nested;
483 // Parse literal '<'
484 if (odsParser.parseLess()) return {};
485 // Parse literal 'nested'
486 if (odsParser.parseKeyword("nested")) return {};
487 // Parse literal '='
488 if (odsParser.parseEqual()) return {};
489
490 // Parse variable 'nested'
491 _result_nested = ::mlir::FieldParser<::test::CompoundAAttr>::parse(odsParser);
492 if (::mlir::failed(_result_nested)) {
493 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundAttrNested parameter 'nested' which is to be a `::test::CompoundAAttr`");
494 return {};
495 }
496 // Parse literal '>'
497 if (odsParser.parseGreater()) return {};
498 assert(::mlir::succeeded(_result_nested))(static_cast <bool> (::mlir::succeeded(_result_nested))
? void (0) : __assert_fail ("::mlir::succeeded(_result_nested)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 498
, __extension__ __PRETTY_FUNCTION__))
;
499 return CompoundAttrNestedAttr::get(odsParser.getContext(),
500 ::test::CompoundAAttr((*_result_nested).cast<::test::CompoundAAttr>()));
501}
502
503void CompoundAttrNestedAttr::print(::mlir::AsmPrinter &odsPrinter) const {
504 ::mlir::Builder odsBuilder(getContext());
505 odsPrinter << "<";
506 odsPrinter << "nested";
507 odsPrinter << ' ' << "=";
508 odsPrinter << ' ';
509 odsPrinter.printStrippedAttrOrType(getNested());
510 odsPrinter << ">";
511}
512
513::test::CompoundAAttr CompoundAttrNestedAttr::getNested() const {
514 return getImpl()->nested;
515}
516
517} // namespace test
518MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundAttrNestedAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundAttrNestedAttr>::id = {}; } }
519namespace test {
520namespace detail {
521struct CompoundNestedInnerAttrStorage : public ::mlir::AttributeStorage {
522 using KeyTy = std::tuple<int, ::test::CompoundAAttr>;
523 CompoundNestedInnerAttrStorage(int some_int, ::test::CompoundAAttr cmpdA) : some_int(some_int), cmpdA(cmpdA) {}
524
525 bool operator==(const KeyTy &tblgenKey) const {
526 return (some_int == std::get<0>(tblgenKey)) && (cmpdA == std::get<1>(tblgenKey));
527 }
528
529 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
530 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
531 }
532
533 static CompoundNestedInnerAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
534 auto some_int = std::get<0>(tblgenKey);
535 auto cmpdA = std::get<1>(tblgenKey);
536 return new (allocator.allocate<CompoundNestedInnerAttrStorage>()) CompoundNestedInnerAttrStorage(some_int, cmpdA);
537 }
538
539 int some_int;
540 ::test::CompoundAAttr cmpdA;
541};
542} // namespace detail
543CompoundNestedInnerAttr CompoundNestedInnerAttr::get(::mlir::MLIRContext *context, int some_int, ::test::CompoundAAttr cmpdA) {
544 return Base::get(context, some_int, cmpdA);
545}
546
547::mlir::Attribute CompoundNestedInnerAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
548 ::mlir::Builder odsBuilder(odsParser.getContext());
549 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
550 (void) odsLoc;
551 ::mlir::FailureOr<int> _result_some_int;
552 ::mlir::FailureOr<::test::CompoundAAttr> _result_cmpdA;
553 // Parse literal '<'
554 if (odsParser.parseLess()) return {};
555
556 // Parse variable 'some_int'
557 _result_some_int = ::mlir::FieldParser<int>::parse(odsParser);
558 if (::mlir::failed(_result_some_int)) {
559 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInner parameter 'some_int' which is to be a `int`");
560 return {};
561 }
562
563 // Parse variable 'cmpdA'
564 _result_cmpdA = ::mlir::FieldParser<::test::CompoundAAttr>::parse(odsParser);
565 if (::mlir::failed(_result_cmpdA)) {
566 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInner parameter 'cmpdA' which is to be a `::test::CompoundAAttr`");
567 return {};
568 }
569 // Parse literal '>'
570 if (odsParser.parseGreater()) return {};
571 assert(::mlir::succeeded(_result_some_int))(static_cast <bool> (::mlir::succeeded(_result_some_int
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_some_int)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 571
, __extension__ __PRETTY_FUNCTION__))
;
572 assert(::mlir::succeeded(_result_cmpdA))(static_cast <bool> (::mlir::succeeded(_result_cmpdA)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_cmpdA)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 572
, __extension__ __PRETTY_FUNCTION__))
;
573 return CompoundNestedInnerAttr::get(odsParser.getContext(),
574 int((*_result_some_int)),
575 ::test::CompoundAAttr((*_result_cmpdA).cast<::test::CompoundAAttr>()));
576}
577
578void CompoundNestedInnerAttr::print(::mlir::AsmPrinter &odsPrinter) const {
579 ::mlir::Builder odsBuilder(getContext());
580 odsPrinter << "<";
581 odsPrinter.printStrippedAttrOrType(getSomeInt());
582 odsPrinter << ' ';
583 odsPrinter.printStrippedAttrOrType(getCmpdA());
584 odsPrinter << ">";
585}
586
587int CompoundNestedInnerAttr::getSomeInt() const {
588 return getImpl()->some_int;
589}
590
591::test::CompoundAAttr CompoundNestedInnerAttr::getCmpdA() const {
592 return getImpl()->cmpdA;
593}
594
595} // namespace test
596MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedInnerAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedInnerAttr>::id = {}; } }
597namespace test {
598namespace detail {
599struct CompoundNestedOuterAttrStorage : public ::mlir::AttributeStorage {
600 using KeyTy = std::tuple<::test::CompoundNestedInnerAttr>;
601 CompoundNestedOuterAttrStorage(::test::CompoundNestedInnerAttr inner) : inner(inner) {}
602
603 bool operator==(const KeyTy &tblgenKey) const {
604 return (inner == std::get<0>(tblgenKey));
605 }
606
607 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
608 return ::llvm::hash_combine(std::get<0>(tblgenKey));
609 }
610
611 static CompoundNestedOuterAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
612 auto inner = std::get<0>(tblgenKey);
613 return new (allocator.allocate<CompoundNestedOuterAttrStorage>()) CompoundNestedOuterAttrStorage(inner);
614 }
615
616 ::test::CompoundNestedInnerAttr inner;
617};
618} // namespace detail
619CompoundNestedOuterAttr CompoundNestedOuterAttr::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerAttr inner) {
620 return Base::get(context, inner);
621}
622
623::mlir::Attribute CompoundNestedOuterAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
624 ::mlir::Builder odsBuilder(odsParser.getContext());
625 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
626 (void) odsLoc;
627 ::mlir::FailureOr<::test::CompoundNestedInnerAttr> _result_inner;
628 // Parse literal '<'
629 if (odsParser.parseLess()) return {};
630 // Parse literal 'i'
631 if (odsParser.parseKeyword("i")) return {};
632
633 // Parse variable 'inner'
634 _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerAttr>::parse(odsParser);
635 if (::mlir::failed(_result_inner)) {
636 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuter parameter 'inner' which is to be a `::test::CompoundNestedInnerAttr`");
637 return {};
638 }
639 // Parse literal '>'
640 if (odsParser.parseGreater()) return {};
641 assert(::mlir::succeeded(_result_inner))(static_cast <bool> (::mlir::succeeded(_result_inner)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_inner)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 641
, __extension__ __PRETTY_FUNCTION__))
;
642 return CompoundNestedOuterAttr::get(odsParser.getContext(),
643 ::test::CompoundNestedInnerAttr((*_result_inner).cast<::test::CompoundNestedInnerAttr>()));
644}
645
646void CompoundNestedOuterAttr::print(::mlir::AsmPrinter &odsPrinter) const {
647 ::mlir::Builder odsBuilder(getContext());
648 odsPrinter << "<";
649 odsPrinter << "i";
650 odsPrinter << ' ';
651 odsPrinter.printStrippedAttrOrType(getInner());
652 odsPrinter << ">";
653}
654
655::test::CompoundNestedInnerAttr CompoundNestedOuterAttr::getInner() const {
656 return getImpl()->inner;
657}
658
659} // namespace test
660MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedOuterAttr>::id = {}; } }
661namespace test {
662namespace detail {
663struct CompoundNestedOuterQualAttrStorage : public ::mlir::AttributeStorage {
664 using KeyTy = std::tuple<::test::CompoundNestedInnerAttr>;
665 CompoundNestedOuterQualAttrStorage(::test::CompoundNestedInnerAttr inner) : inner(inner) {}
666
667 bool operator==(const KeyTy &tblgenKey) const {
668 return (inner == std::get<0>(tblgenKey));
669 }
670
671 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
672 return ::llvm::hash_combine(std::get<0>(tblgenKey));
673 }
674
675 static CompoundNestedOuterQualAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
676 auto inner = std::get<0>(tblgenKey);
677 return new (allocator.allocate<CompoundNestedOuterQualAttrStorage>()) CompoundNestedOuterQualAttrStorage(inner);
678 }
679
680 ::test::CompoundNestedInnerAttr inner;
681};
682} // namespace detail
683CompoundNestedOuterQualAttr CompoundNestedOuterQualAttr::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerAttr inner) {
684 return Base::get(context, inner);
685}
686
687::mlir::Attribute CompoundNestedOuterQualAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
688 ::mlir::Builder odsBuilder(odsParser.getContext());
689 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
690 (void) odsLoc;
691 ::mlir::FailureOr<::test::CompoundNestedInnerAttr> _result_inner;
692 // Parse literal '<'
693 if (odsParser.parseLess()) return {};
694 // Parse literal 'i'
695 if (odsParser.parseKeyword("i")) return {};
696
697 // Parse variable 'inner'
698 _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerAttr>::parse(odsParser);
699 if (::mlir::failed(_result_inner)) {
700 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuterQual parameter 'inner' which is to be a `::test::CompoundNestedInnerAttr`");
701 return {};
702 }
703 // Parse literal '>'
704 if (odsParser.parseGreater()) return {};
705 assert(::mlir::succeeded(_result_inner))(static_cast <bool> (::mlir::succeeded(_result_inner)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_inner)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 705
, __extension__ __PRETTY_FUNCTION__))
;
706 return CompoundNestedOuterQualAttr::get(odsParser.getContext(),
707 ::test::CompoundNestedInnerAttr((*_result_inner).cast<::test::CompoundNestedInnerAttr>()));
708}
709
710void CompoundNestedOuterQualAttr::print(::mlir::AsmPrinter &odsPrinter) const {
711 ::mlir::Builder odsBuilder(getContext());
712 odsPrinter << "<";
713 odsPrinter << "i";
714 odsPrinter << ' ';
715 odsPrinter << getInner();
716 odsPrinter << ">";
717}
718
719::test::CompoundNestedInnerAttr CompoundNestedOuterQualAttr::getInner() const {
720 return getImpl()->inner;
721}
722
723} // namespace test
724MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterQualAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedOuterQualAttr>::id = {}; } }
725namespace test {
726} // namespace test
727MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::SimpleAAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::SimpleAAttr>::id = {}; } }
728namespace test {
729namespace detail {
730struct ArrayOfEnumsAttrStorage : public ::mlir::AttributeStorage {
731 using KeyTy = std::tuple<::llvm::ArrayRef<SimpleEnumAttr>>;
732 ArrayOfEnumsAttrStorage(::llvm::ArrayRef<SimpleEnumAttr> value) : value(value) {}
733
734 bool operator==(const KeyTy &tblgenKey) const {
735 return (::llvm::makeArrayRef(value) == ::llvm::makeArrayRef(std::get<0>(tblgenKey)));
736 }
737
738 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
739 return ::llvm::hash_combine(std::get<0>(tblgenKey));
740 }
741
742 static ArrayOfEnumsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
743 auto value = std::get<0>(tblgenKey);
744 value = allocator.copyInto(value);
745 return new (allocator.allocate<ArrayOfEnumsAttrStorage>()) ArrayOfEnumsAttrStorage(value);
746 }
747
748 ::llvm::ArrayRef<SimpleEnumAttr> value;
749};
750} // namespace detail
751ArrayOfEnumsAttr ArrayOfEnumsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<SimpleEnumAttr> value) {
752 return Base::get(context, value);
753}
754
755::mlir::Attribute ArrayOfEnumsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
756 ::mlir::Builder odsBuilder(odsParser.getContext());
757 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
758 (void) odsLoc;
759 ::mlir::FailureOr<::llvm::SmallVector<SimpleEnumAttr>> _result_value;
760 // Parse literal '['
761 if (odsParser.parseLSquare()) return {};
762 // Parse literal ']'
763 if (odsParser.parseOptionalRSquare()) {
764
765 // Parse variable 'value'
766 _result_value = ::mlir::FieldParser<::llvm::SmallVector<SimpleEnumAttr>>::parse(odsParser);
767 if (::mlir::failed(_result_value)) {
768 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfEnums parameter 'value' which is to be a `::llvm::ArrayRef<SimpleEnumAttr>`");
769 return {};
770 }
771 // Parse literal ']'
772 if (odsParser.parseRSquare()) return {};
773 } else {
774 }
775 return ArrayOfEnumsAttr::get(odsParser.getContext(),
776 ::llvm::ArrayRef<SimpleEnumAttr>((_result_value.value_or(::llvm::SmallVector<SimpleEnumAttr>()))));
777}
778
779void ArrayOfEnumsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
780 ::mlir::Builder odsBuilder(getContext());
781 odsPrinter << "[";
782 if (!(!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<SimpleEnumAttr>())))) {
783 odsPrinter << "]";
784 } else {
785 if (!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<SimpleEnumAttr>()))) {
786 odsPrinter.printStrippedAttrOrType(getValue());
787 }
788 odsPrinter << "]";
789 }
790}
791
792::llvm::ArrayRef<SimpleEnumAttr> ArrayOfEnumsAttr::getValue() const {
793 return getImpl()->value;
794}
795
796} // namespace test
797MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfEnumsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::ArrayOfEnumsAttr>::id = {}; } }
798namespace test {
799namespace detail {
800struct ArrayOfIntsAttrStorage : public ::mlir::AttributeStorage {
801 using KeyTy = std::tuple<::llvm::ArrayRef<int32_t>>;
802 ArrayOfIntsAttrStorage(::llvm::ArrayRef<int32_t> value) : value(value) {}
803
804 bool operator==(const KeyTy &tblgenKey) const {
805 return (::llvm::makeArrayRef(value) == ::llvm::makeArrayRef(std::get<0>(tblgenKey)));
806 }
807
808 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
809 return ::llvm::hash_combine(std::get<0>(tblgenKey));
810 }
811
812 static ArrayOfIntsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
813 auto value = std::get<0>(tblgenKey);
814 value = allocator.copyInto(value);
815 return new (allocator.allocate<ArrayOfIntsAttrStorage>()) ArrayOfIntsAttrStorage(value);
816 }
817
818 ::llvm::ArrayRef<int32_t> value;
819};
820} // namespace detail
821ArrayOfIntsAttr ArrayOfIntsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<int32_t> value) {
822 return Base::get(context, value);
823}
824
825::mlir::Attribute ArrayOfIntsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
826 ::mlir::Builder odsBuilder(odsParser.getContext());
827 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
828 (void) odsLoc;
829 ::mlir::FailureOr<::llvm::SmallVector<int32_t>> _result_value;
830 // Parse literal '['
831 if (odsParser.parseLSquare()) return {};
832 // Parse literal ']'
833 if (odsParser.parseOptionalRSquare()) {
834
835 // Parse variable 'value'
836 _result_value = ::mlir::FieldParser<::llvm::SmallVector<int32_t>>::parse(odsParser);
837 if (::mlir::failed(_result_value)) {
838 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfInts parameter 'value' which is to be a `::llvm::ArrayRef<int32_t>`");
839 return {};
840 }
841 // Parse literal ']'
842 if (odsParser.parseRSquare()) return {};
843 } else {
844 }
845 return ArrayOfIntsAttr::get(odsParser.getContext(),
846 ::llvm::ArrayRef<int32_t>((_result_value.value_or(::llvm::SmallVector<int32_t>()))));
847}
848
849void ArrayOfIntsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
850 ::mlir::Builder odsBuilder(getContext());
851 odsPrinter << "[";
852 if (!(!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<int32_t>())))) {
853 odsPrinter << "]";
854 } else {
855 if (!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<int32_t>()))) {
856 odsPrinter.printStrippedAttrOrType(getValue());
857 }
858 odsPrinter << "]";
859 }
860}
861
862::llvm::ArrayRef<int32_t> ArrayOfIntsAttr::getValue() const {
863 return getImpl()->value;
864}
865
866} // namespace test
867MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfIntsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::ArrayOfIntsAttr>::id = {}; } }
868namespace test {
869namespace detail {
870struct ArrayOfUglyAttrsAttrStorage : public ::mlir::AttributeStorage {
871 using KeyTy = std::tuple<::llvm::ArrayRef<TestAttrUglyAttr>>;
872 ArrayOfUglyAttrsAttrStorage(::llvm::ArrayRef<TestAttrUglyAttr> value) : value(value) {}
873
874 bool operator==(const KeyTy &tblgenKey) const {
875 return (::llvm::makeArrayRef(value) == ::llvm::makeArrayRef(std::get<0>(tblgenKey)));
876 }
877
878 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
879 return ::llvm::hash_combine(std::get<0>(tblgenKey));
880 }
881
882 static ArrayOfUglyAttrsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
883 auto value = std::get<0>(tblgenKey);
884 value = allocator.copyInto(value);
885 return new (allocator.allocate<ArrayOfUglyAttrsAttrStorage>()) ArrayOfUglyAttrsAttrStorage(value);
886 }
887
888 ::llvm::ArrayRef<TestAttrUglyAttr> value;
889};
890} // namespace detail
891ArrayOfUglyAttrsAttr ArrayOfUglyAttrsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<TestAttrUglyAttr> value) {
892 return Base::get(context, value);
893}
894
895::mlir::Attribute ArrayOfUglyAttrsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
896 ::mlir::Builder odsBuilder(odsParser.getContext());
897 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
898 (void) odsLoc;
899 ::mlir::FailureOr<::llvm::SmallVector<TestAttrUglyAttr>> _result_value;
900 // Parse literal '['
901 if (odsParser.parseLSquare()) return {};
902 // Parse literal ']'
903 if (odsParser.parseOptionalRSquare()) {
904
905 // Parse variable 'value'
906 _result_value = ::mlir::FieldParser<::llvm::SmallVector<TestAttrUglyAttr>>::parse(odsParser);
907 if (::mlir::failed(_result_value)) {
908 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfUglyAttrs parameter 'value' which is to be a `::llvm::ArrayRef<TestAttrUglyAttr>`");
909 return {};
910 }
911 // Parse literal ']'
912 if (odsParser.parseRSquare()) return {};
913 } else {
914 }
915 return ArrayOfUglyAttrsAttr::get(odsParser.getContext(),
916 ::llvm::ArrayRef<TestAttrUglyAttr>((_result_value.value_or(::llvm::SmallVector<TestAttrUglyAttr>()))));
917}
918
919void ArrayOfUglyAttrsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
920 ::mlir::Builder odsBuilder(getContext());
921 odsPrinter << "[";
922 if (!(!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<TestAttrUglyAttr>())))) {
923 odsPrinter << "]";
924 } else {
925 if (!(::llvm::makeArrayRef(getValue()) == ::llvm::makeArrayRef(::llvm::SmallVector<TestAttrUglyAttr>()))) {
926 odsPrinter.printStrippedAttrOrType(getValue());
927 }
928 odsPrinter << " ";
929 odsPrinter << "]";
930 }
931}
932
933::llvm::ArrayRef<TestAttrUglyAttr> ArrayOfUglyAttrsAttr::getValue() const {
934 return getImpl()->value;
935}
936
937} // namespace test
938MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfUglyAttrsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::ArrayOfUglyAttrsAttr>::id = {}; } }
939namespace test {
940namespace detail {
941struct TestAttrParamsAttrStorage : public ::mlir::AttributeStorage {
942 using KeyTy = std::tuple<int, int>;
943 TestAttrParamsAttrStorage(int v0, int v1) : v0(v0), v1(v1) {}
944
945 bool operator==(const KeyTy &tblgenKey) const {
946 return (v0 == std::get<0>(tblgenKey)) && (v1 == std::get<1>(tblgenKey));
947 }
948
949 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
950 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
951 }
952
953 static TestAttrParamsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
954 auto v0 = std::get<0>(tblgenKey);
955 auto v1 = std::get<1>(tblgenKey);
956 return new (allocator.allocate<TestAttrParamsAttrStorage>()) TestAttrParamsAttrStorage(v0, v1);
957 }
958
959 int v0;
960 int v1;
961};
962} // namespace detail
963TestAttrParamsAttr TestAttrParamsAttr::get(::mlir::MLIRContext *context, int v0, int v1) {
964 return Base::get(context, v0, v1);
965}
966
967::mlir::Attribute TestAttrParamsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
968 ::mlir::Builder odsBuilder(odsParser.getContext());
969 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
970 (void) odsLoc;
971 ::mlir::FailureOr<int> _result_v0;
972 ::mlir::FailureOr<int> _result_v1;
973 // Parse literal '<'
974 if (odsParser.parseLess()) return {};
975 // Parse parameter list
976
977 // Parse variable 'v0'
978 _result_v0 = ::mlir::FieldParser<int>::parse(odsParser);
979 if (::mlir::failed(_result_v0)) {
980 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrParams parameter 'v0' which is to be a `int`");
981 return {};
982 }
983 // Parse literal ','
984 if (odsParser.parseComma()) return {};
985
986 // Parse variable 'v1'
987 _result_v1 = ::mlir::FieldParser<int>::parse(odsParser);
988 if (::mlir::failed(_result_v1)) {
989 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrParams parameter 'v1' which is to be a `int`");
990 return {};
991 }
992 // Parse literal '>'
993 if (odsParser.parseGreater()) return {};
994 assert(::mlir::succeeded(_result_v0))(static_cast <bool> (::mlir::succeeded(_result_v0)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_v0)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 994, __extension__ __PRETTY_FUNCTION__))
;
995 assert(::mlir::succeeded(_result_v1))(static_cast <bool> (::mlir::succeeded(_result_v1)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_v1)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 995, __extension__ __PRETTY_FUNCTION__))
;
996 return TestAttrParamsAttr::get(odsParser.getContext(),
997 int((*_result_v0)),
998 int((*_result_v1)));
999}
1000
1001void TestAttrParamsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1002 ::mlir::Builder odsBuilder(getContext());
1003 odsPrinter << "<";
1004 {
1005 bool _firstPrinted = true;
1006 if (!_firstPrinted) odsPrinter << ", ";
1007 _firstPrinted = false;
1008 odsPrinter.printStrippedAttrOrType(getV0());
1009 if (!_firstPrinted) odsPrinter << ", ";
1010 _firstPrinted = false;
1011 odsPrinter.printStrippedAttrOrType(getV1());
1012 }
1013 odsPrinter << ">";
1014}
1015
1016int TestAttrParamsAttr::getV0() const {
1017 return getImpl()->v0;
1018}
1019
1020int TestAttrParamsAttr::getV1() const {
1021 return getImpl()->v1;
1022}
1023
1024} // namespace test
1025MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrParamsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestAttrParamsAttr>::id = {}; } }
1026namespace test {
1027namespace detail {
1028struct TestAttrSelfTypeParameterFormatAttrStorage : public ::mlir::AttributeStorage {
1029 using KeyTy = std::tuple<int, ::mlir::Type>;
1030 TestAttrSelfTypeParameterFormatAttrStorage(int a, ::mlir::Type type) : a(a), type(type) {}
1031
1032 bool operator==(const KeyTy &tblgenKey) const {
1033 return (a == std::get<0>(tblgenKey)) && (type == std::get<1>(tblgenKey));
1034 }
1035
1036 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1037 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1038 }
1039
1040 static TestAttrSelfTypeParameterFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1041 auto a = std::get<0>(tblgenKey);
1042 auto type = std::get<1>(tblgenKey);
1043 return new (allocator.allocate<TestAttrSelfTypeParameterFormatAttrStorage>()) TestAttrSelfTypeParameterFormatAttrStorage(a, type);
1044 }
1045
1046 int a;
1047 ::mlir::Type type;
1048};
1049} // namespace detail
1050TestAttrSelfTypeParameterFormatAttr TestAttrSelfTypeParameterFormatAttr::get(::mlir::MLIRContext *context, int a, ::mlir::Type type) {
1051 return Base::get(context, a, type);
1052}
1053
1054::mlir::Attribute TestAttrSelfTypeParameterFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1055 ::mlir::Builder odsBuilder(odsParser.getContext());
1056 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1057 (void) odsLoc;
1058 ::mlir::FailureOr<int> _result_a;
1059 ::mlir::FailureOr<::mlir::Type> _result_type;
1060
1061 if (odsType) {
1062 if (auto reqType = odsType.dyn_cast<::mlir::Type>()) {
1063 _result_type = reqType;
1064 } else {
1065 odsParser.emitError(odsLoc, "invalid kind of type specified");
1066 return {};
1067 }
1068 }
1069 // Parse literal '<'
1070 if (odsParser.parseLess()) return {};
1071
1072 // Parse variable 'a'
1073 _result_a = ::mlir::FieldParser<int>::parse(odsParser);
1074 if (::mlir::failed(_result_a)) {
1075 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrSelfTypeParameterFormat parameter 'a' which is to be a `int`");
1076 return {};
1077 }
1078 // Parse literal '>'
1079 if (odsParser.parseGreater()) return {};
1080 assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 1080, __extension__ __PRETTY_FUNCTION__))
;
1081 return TestAttrSelfTypeParameterFormatAttr::get(odsParser.getContext(),
1082 int((*_result_a)),
1083 ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext())))));
1084}
1085
1086void TestAttrSelfTypeParameterFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1087 ::mlir::Builder odsBuilder(getContext());
1088 odsPrinter << "<";
1089 odsPrinter.printStrippedAttrOrType(getA());
1090 odsPrinter << ">";
1091}
1092
1093int TestAttrSelfTypeParameterFormatAttr::getA() const {
1094 return getImpl()->a;
1095}
1096
1097::mlir::Type TestAttrSelfTypeParameterFormatAttr::getType() const {
1098 return getImpl()->type;
1099}
1100
1101} // namespace test
1102MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrSelfTypeParameterFormatAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestAttrSelfTypeParameterFormatAttr>::id = {}
; } }
1103namespace test {
1104namespace detail {
1105struct TestAttrUglyAttrStorage : public ::mlir::AttributeStorage {
1106 using KeyTy = std::tuple<::mlir::Attribute>;
1107 TestAttrUglyAttrStorage(::mlir::Attribute attr) : attr(attr) {}
1108
1109 bool operator==(const KeyTy &tblgenKey) const {
1110 return (attr == std::get<0>(tblgenKey));
1111 }
1112
1113 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1114 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1115 }
1116
1117 static TestAttrUglyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1118 auto attr = std::get<0>(tblgenKey);
1119 return new (allocator.allocate<TestAttrUglyAttrStorage>()) TestAttrUglyAttrStorage(attr);
1120 }
1121
1122 ::mlir::Attribute attr;
1123};
1124} // namespace detail
1125TestAttrUglyAttr TestAttrUglyAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute attr) {
1126 return Base::get(context, attr);
1127}
1128
1129::mlir::Attribute TestAttrUglyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1130 ::mlir::Builder odsBuilder(odsParser.getContext());
1131 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1132 (void) odsLoc;
1133 ::mlir::FailureOr<::mlir::Attribute> _result_attr;
1134 // Parse literal 'begin'
1135 if (odsParser.parseKeyword("begin")) return {};
1136
1137 // Parse variable 'attr'
1138 _result_attr = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser);
1139 if (::mlir::failed(_result_attr)) {
1140 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrUgly parameter 'attr' which is to be a `::mlir::Attribute`");
1141 return {};
1142 }
1143 // Parse literal 'end'
1144 if (odsParser.parseKeyword("end")) return {};
1145 assert(::mlir::succeeded(_result_attr))(static_cast <bool> (::mlir::succeeded(_result_attr)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_attr)",
"tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1145
, __extension__ __PRETTY_FUNCTION__))
;
1146 return TestAttrUglyAttr::get(odsParser.getContext(),
1147 ::mlir::Attribute((*_result_attr)));
1148}
1149
1150void TestAttrUglyAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1151 ::mlir::Builder odsBuilder(getContext());
1152 odsPrinter << ' ' << "begin";
1153 odsPrinter << ' ';
1154 odsPrinter.printStrippedAttrOrType(getAttr());
1155 odsPrinter << ' ' << "end";
1156}
1157
1158::mlir::Attribute TestAttrUglyAttr::getAttr() const {
1159 return getImpl()->attr;
1160}
1161
1162} // namespace test
1163MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrUglyAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestAttrUglyAttr>::id = {}; } }
1164namespace test {
1165namespace detail {
1166struct TestAttrWithFormatAttrStorage : public ::mlir::AttributeStorage {
1167 using KeyTy = std::tuple<int64_t, std::string, ::mlir::IntegerAttr, ::llvm::ArrayRef<int>, ::llvm::ArrayRef<AttrWithTypeBuilderAttr>>;
1168 TestAttrWithFormatAttrStorage(int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) : one(one), two(two), three(three), four(four), arrayOfAttrWithTypeBuilderAttr(arrayOfAttrWithTypeBuilderAttr) {}
1169
1170 bool operator==(const KeyTy &tblgenKey) const {
1171 return (one == std::get<0>(tblgenKey)) && (two == std::get<1>(tblgenKey)) && (three == std::get<2>(tblgenKey)) && (four == std::get<3>(tblgenKey)) && (arrayOfAttrWithTypeBuilderAttr == std::get<4>(tblgenKey));
1172 }
1173
1174 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1175 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey));
1176 }
1177
1178 static TestAttrWithFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1179 auto one = std::get<0>(tblgenKey);
1180 auto two = std::get<1>(tblgenKey);
1181 auto three = std::get<2>(tblgenKey);
1182 auto four = std::get<3>(tblgenKey);
1183 auto arrayOfAttrWithTypeBuilderAttr = std::get<4>(tblgenKey);
1184 four = allocator.copyInto(four);
1185 arrayOfAttrWithTypeBuilderAttr = allocator.copyInto(arrayOfAttrWithTypeBuilderAttr);
1186 return new (allocator.allocate<TestAttrWithFormatAttrStorage>()) TestAttrWithFormatAttrStorage(one, two, three, four, arrayOfAttrWithTypeBuilderAttr);
1187 }
1188
1189 int64_t one;
1190 std::string two;
1191 ::mlir::IntegerAttr three;
1192 ::llvm::ArrayRef<int> four;
1193 ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr;
1194};
1195} // namespace detail
1196TestAttrWithFormatAttr TestAttrWithFormatAttr::get(::mlir::MLIRContext *context, int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) {
1197 return Base::get(context, one, two, three, four, arrayOfAttrWithTypeBuilderAttr);
1198}
1199
1200TestAttrWithFormatAttr TestAttrWithFormatAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) {
1201 return Base::getChecked(emitError, context, one, two, three, four, arrayOfAttrWithTypeBuilderAttr);
1202}
1203
1204::mlir::Attribute TestAttrWithFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1205 ::mlir::Builder odsBuilder(odsParser.getContext());
1206 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1207 (void) odsLoc;
1208 ::mlir::FailureOr<int64_t> _result_one;
1209 ::mlir::FailureOr<std::string> _result_two;
1210 ::mlir::FailureOr<::mlir::IntegerAttr> _result_three;
1211 ::mlir::FailureOr<llvm::SmallVector<int>> _result_four;
1212 ::mlir::FailureOr<::llvm::SmallVector<AttrWithTypeBuilderAttr>> _result_arrayOfAttrWithTypeBuilderAttr;
1213 // Parse literal '<'
1214 if (odsParser.parseLess()) return {};
1215
1216 // Parse variable 'one'
1217 _result_one = ::mlir::FieldParser<int64_t>::parse(odsParser);
1218 if (::mlir::failed(_result_one)) {
1219 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'one' which is to be a `int64_t`");
1220 return {};
1221 }
1222 // Parse literal ':'
1223 if (odsParser.parseColon()) return {};
1224 // Parse parameter struct
1225 bool _seen_two = false;
1226 bool _seen_four = false;
1227 {
1228 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1229 // Parse literal '='
1230 if (odsParser.parseEqual()) return {};
1231 if (!_seen_two && _paramKey == "two") {
1232 _seen_two = true;
1233
1234 // Parse variable 'two'
1235 _result_two = ::mlir::FieldParser<std::string>::parse(odsParser);
1236 if (::mlir::failed(_result_two)) {
1237 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'two' which is to be a `std::string`");
1238 return {};
1239 }
1240 } else if (!_seen_four && _paramKey == "four") {
1241 _seen_four = true;
1242
1243 // Parse variable 'four'
1244 _result_four = ::parseIntArray(odsParser);
1245 if (::mlir::failed(_result_four)) {
1246 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'four' which is to be a `::llvm::ArrayRef<int>`");
1247 return {};
1248 }
1249 } else {
1250 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1251 return {};
1252 }
1253 return true;
1254 };
1255 for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) {
1256 ::llvm::StringRef _paramKey;
1257 if (odsParser.parseKeyword(&_paramKey)) {
1258 odsParser.emitError(odsParser.getCurrentLocation(),
1259 "expected a parameter name in struct");
1260 return {};
1261 }
1262 if (!_loop_body(_paramKey)) return {};
1263 if ((odsStructIndex != 2 - 1) && odsParser.parseComma())
1264 return {};
1265 }
1266 }
1267 // Parse literal ':'
1268 if (odsParser.parseColon()) return {};
1269
1270 // Parse variable 'three'
1271 _result_three = ::mlir::FieldParser<::mlir::IntegerAttr>::parse(odsParser);
1272 if (::mlir::failed(_result_three)) {
1273 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'three' which is to be a `::mlir::IntegerAttr`");
1274 return {};
1275 }
1276 // Parse literal ','
1277 if (odsParser.parseComma()) return {};
1278 // Parse literal '['
1279 if (odsParser.parseLSquare()) return {};
1280
1281 // Parse variable 'arrayOfAttrWithTypeBuilderAttr'
1282 _result_arrayOfAttrWithTypeBuilderAttr = ::mlir::FieldParser<::llvm::SmallVector<AttrWithTypeBuilderAttr>>::parse(odsParser);
1283 if (::mlir::failed(_result_arrayOfAttrWithTypeBuilderAttr)) {
1284 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'arrayOfAttrWithTypeBuilderAttr' which is to be a `::llvm::ArrayRef<AttrWithTypeBuilderAttr>`");
1285 return {};
1286 }
1287 // Parse literal ']'
1288 if (odsParser.parseRSquare()) return {};
1289 // Parse literal '>'
1290 if (odsParser.parseGreater()) return {};
1291 assert(::mlir::succeeded(_result_one))(static_cast <bool> (::mlir::succeeded(_result_one)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_one)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 1291, __extension__ __PRETTY_FUNCTION__))
;
1292 assert(::mlir::succeeded(_result_two))(static_cast <bool> (::mlir::succeeded(_result_two)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_two)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 1292, __extension__ __PRETTY_FUNCTION__))
;
1293 assert(::mlir::succeeded(_result_three))(static_cast <bool> (::mlir::succeeded(_result_three)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_three)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1293
, __extension__ __PRETTY_FUNCTION__))
;
1294 assert(::mlir::succeeded(_result_four))(static_cast <bool> (::mlir::succeeded(_result_four)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_four)",
"tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1294
, __extension__ __PRETTY_FUNCTION__))
;
1295 assert(::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr))(static_cast <bool> (::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1295
, __extension__ __PRETTY_FUNCTION__))
;
1296 return odsParser.getChecked<TestAttrWithFormatAttr>(odsLoc, odsParser.getContext(),
1297 int64_t((*_result_one)),
1298 std::string((*_result_two)),
1299 ::mlir::IntegerAttr((*_result_three)),
1300 ::llvm::ArrayRef<int>((*_result_four)),
1301 ::llvm::ArrayRef<AttrWithTypeBuilderAttr>((*_result_arrayOfAttrWithTypeBuilderAttr)));
1302}
1303
1304void TestAttrWithFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1305 ::mlir::Builder odsBuilder(getContext());
1306 odsPrinter << "<";
1307 odsPrinter.printStrippedAttrOrType(getOne());
1308 odsPrinter << ' ' << ":";
1309 odsPrinter << ' ';
1310 {
1311 bool _firstPrinted = true;
1312 if (!_firstPrinted) odsPrinter << ", ";
1313 _firstPrinted = false;
1314 odsPrinter << "two = ";
1315 odsPrinter << '"' << getTwo() << '"';
1316 if (!_firstPrinted) odsPrinter << ", ";
1317 _firstPrinted = false;
Value stored to '_firstPrinted' is never read
1318 odsPrinter << "four = ";
1319 ::printIntArray(odsPrinter, getFour());
1320 }
1321 odsPrinter << ' ' << ":";
1322 odsPrinter << ' ';
1323 odsPrinter.printStrippedAttrOrType(getThree());
1324 odsPrinter << ",";
1325 odsPrinter << ' ' << "[";
1326 odsPrinter.printStrippedAttrOrType(getArrayOfAttrWithTypeBuilderAttr());
1327 odsPrinter << "]";
1328 odsPrinter << ">";
1329}
1330
1331int64_t TestAttrWithFormatAttr::getOne() const {
1332 return getImpl()->one;
1333}
1334
1335llvm::StringRef TestAttrWithFormatAttr::getTwo() const {
1336 return getImpl()->two;
1337}
1338
1339::mlir::IntegerAttr TestAttrWithFormatAttr::getThree() const {
1340 return getImpl()->three;
1341}
1342
1343::llvm::ArrayRef<int> TestAttrWithFormatAttr::getFour() const {
1344 return getImpl()->four;
1345}
1346
1347::llvm::ArrayRef<AttrWithTypeBuilderAttr> TestAttrWithFormatAttr::getArrayOfAttrWithTypeBuilderAttr() const {
1348 return getImpl()->arrayOfAttrWithTypeBuilderAttr;
1349}
1350
1351} // namespace test
1352MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithFormatAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestAttrWithFormatAttr>::id = {}; } }
1353namespace test {
1354namespace detail {
1355struct TestAttrWithTypeParamAttrStorage : public ::mlir::AttributeStorage {
1356 using KeyTy = std::tuple<::mlir::IntegerType, ::mlir::Type>;
1357 TestAttrWithTypeParamAttrStorage(::mlir::IntegerType int_type, ::mlir::Type any_type) : int_type(int_type), any_type(any_type) {}
1358
1359 bool operator==(const KeyTy &tblgenKey) const {
1360 return (int_type == std::get<0>(tblgenKey)) && (any_type == std::get<1>(tblgenKey));
1361 }
1362
1363 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1364 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1365 }
1366
1367 static TestAttrWithTypeParamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1368 auto int_type = std::get<0>(tblgenKey);
1369 auto any_type = std::get<1>(tblgenKey);
1370 return new (allocator.allocate<TestAttrWithTypeParamAttrStorage>()) TestAttrWithTypeParamAttrStorage(int_type, any_type);
1371 }
1372
1373 ::mlir::IntegerType int_type;
1374 ::mlir::Type any_type;
1375};
1376} // namespace detail
1377TestAttrWithTypeParamAttr TestAttrWithTypeParamAttr::get(::mlir::MLIRContext *context, ::mlir::IntegerType int_type, ::mlir::Type any_type) {
1378 return Base::get(context, int_type, any_type);
1379}
1380
1381::mlir::Attribute TestAttrWithTypeParamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1382 ::mlir::Builder odsBuilder(odsParser.getContext());
1383 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1384 (void) odsLoc;
1385 ::mlir::FailureOr<::mlir::IntegerType> _result_int_type;
1386 ::mlir::FailureOr<::mlir::Type> _result_any_type;
1387 // Parse literal '<'
1388 if (odsParser.parseLess()) return {};
1389
1390 // Parse variable 'int_type'
1391 _result_int_type = ::mlir::FieldParser<::mlir::IntegerType>::parse(odsParser);
1392 if (::mlir::failed(_result_int_type)) {
1393 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithTypeParam parameter 'int_type' which is to be a `::mlir::IntegerType`");
1394 return {};
1395 }
1396 // Parse literal ','
1397 if (odsParser.parseComma()) return {};
1398
1399 // Parse variable 'any_type'
1400 _result_any_type = ::mlir::FieldParser<::mlir::Type>::parse(odsParser);
1401 if (::mlir::failed(_result_any_type)) {
1402 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithTypeParam parameter 'any_type' which is to be a `::mlir::Type`");
1403 return {};
1404 }
1405 // Parse literal '>'
1406 if (odsParser.parseGreater()) return {};
1407 assert(::mlir::succeeded(_result_int_type))(static_cast <bool> (::mlir::succeeded(_result_int_type
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_int_type)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1407
, __extension__ __PRETTY_FUNCTION__))
;
1408 assert(::mlir::succeeded(_result_any_type))(static_cast <bool> (::mlir::succeeded(_result_any_type
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_any_type)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1408
, __extension__ __PRETTY_FUNCTION__))
;
1409 return TestAttrWithTypeParamAttr::get(odsParser.getContext(),
1410 ::mlir::IntegerType((*_result_int_type)),
1411 ::mlir::Type((*_result_any_type)));
1412}
1413
1414void TestAttrWithTypeParamAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1415 ::mlir::Builder odsBuilder(getContext());
1416 odsPrinter << "<";
1417 odsPrinter.printStrippedAttrOrType(getIntType());
1418 odsPrinter << ",";
1419 odsPrinter << ' ';
1420 odsPrinter.printStrippedAttrOrType(getAnyType());
1421 odsPrinter << ">";
1422}
1423
1424::mlir::IntegerType TestAttrWithTypeParamAttr::getIntType() const {
1425 return getImpl()->int_type;
1426}
1427
1428::mlir::Type TestAttrWithTypeParamAttr::getAnyType() const {
1429 return getImpl()->any_type;
1430}
1431
1432} // namespace test
1433MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithTypeParamAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestAttrWithTypeParamAttr>::id = {}; } }
1434namespace test {
1435namespace detail {
1436struct TestBitEnumAttrStorage : public ::mlir::AttributeStorage {
1437 using KeyTy = std::tuple<test::TestBitEnum>;
1438 TestBitEnumAttrStorage(test::TestBitEnum value) : value(value) {}
1439
1440 bool operator==(const KeyTy &tblgenKey) const {
1441 return (value == std::get<0>(tblgenKey));
1442 }
1443
1444 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1445 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1446 }
1447
1448 static TestBitEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1449 auto value = std::get<0>(tblgenKey);
1450 return new (allocator.allocate<TestBitEnumAttrStorage>()) TestBitEnumAttrStorage(value);
1451 }
1452
1453 test::TestBitEnum value;
1454};
1455} // namespace detail
1456TestBitEnumAttr TestBitEnumAttr::get(::mlir::MLIRContext *context, test::TestBitEnum value) {
1457 return Base::get(context, value);
1458}
1459
1460::mlir::Attribute TestBitEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1461 ::mlir::Builder odsBuilder(odsParser.getContext());
1462 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1463 (void) odsLoc;
1464 ::mlir::FailureOr<test::TestBitEnum> _result_value;
1465 // Parse literal '<'
1466 if (odsParser.parseLess()) return {};
1467
1468 // Parse variable 'value'
1469 _result_value = [&]() -> ::mlir::FailureOr<test::TestBitEnum> {
1470 test::TestBitEnum flags = {};
1471 auto loc = odsParser.getCurrentLocation();
1472 ::llvm::StringRef enumKeyword;
1473 do {
1474 if (::mlir::failed(odsParser.parseKeyword(&enumKeyword)))
1475 return ::mlir::failure();
1476 auto maybeEnum = test::symbolizeTestBitEnum(enumKeyword);
1477 if (!maybeEnum) {
1478 return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestBitEnum" << " to be one of: " << "read" << ", " << "write" << ", " << "execute")};
1479 }
1480 flags = flags | *maybeEnum;
1481 } while(::mlir::succeeded(odsParser.parseOptionalComma()));
1482 return flags;
1483 }();
1484 if (::mlir::failed(_result_value)) {
1485 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestBitEnumAttr parameter 'value' which is to be a `test::TestBitEnum`");
1486 return {};
1487 }
1488 // Parse literal '>'
1489 if (odsParser.parseGreater()) return {};
1490 assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_value)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1490
, __extension__ __PRETTY_FUNCTION__))
;
1491 return TestBitEnumAttr::get(odsParser.getContext(),
1492 test::TestBitEnum((*_result_value)));
1493}
1494
1495void TestBitEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1496 ::mlir::Builder odsBuilder(getContext());
1497 odsPrinter << "<";
1498 odsPrinter << stringifyTestBitEnum(getValue());
1499 odsPrinter << ">";
1500}
1501
1502test::TestBitEnum TestBitEnumAttr::getValue() const {
1503 return getImpl()->value;
1504}
1505
1506} // namespace test
1507MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestBitEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestBitEnumAttr>::id = {}; } }
1508namespace test {
1509namespace detail {
1510struct TestBitEnumVerticalBarAttrStorage : public ::mlir::AttributeStorage {
1511 using KeyTy = std::tuple<test::TestBitEnumVerticalBar>;
1512 TestBitEnumVerticalBarAttrStorage(test::TestBitEnumVerticalBar value) : value(value) {}
1513
1514 bool operator==(const KeyTy &tblgenKey) const {
1515 return (value == std::get<0>(tblgenKey));
1516 }
1517
1518 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1519 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1520 }
1521
1522 static TestBitEnumVerticalBarAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1523 auto value = std::get<0>(tblgenKey);
1524 return new (allocator.allocate<TestBitEnumVerticalBarAttrStorage>()) TestBitEnumVerticalBarAttrStorage(value);
1525 }
1526
1527 test::TestBitEnumVerticalBar value;
1528};
1529} // namespace detail
1530TestBitEnumVerticalBarAttr TestBitEnumVerticalBarAttr::get(::mlir::MLIRContext *context, test::TestBitEnumVerticalBar value) {
1531 return Base::get(context, value);
1532}
1533
1534::mlir::Attribute TestBitEnumVerticalBarAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1535 ::mlir::Builder odsBuilder(odsParser.getContext());
1536 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1537 (void) odsLoc;
1538 ::mlir::FailureOr<test::TestBitEnumVerticalBar> _result_value;
1539 // Parse literal '<'
1540 if (odsParser.parseLess()) return {};
1541
1542 // Parse variable 'value'
1543 _result_value = [&]() -> ::mlir::FailureOr<test::TestBitEnumVerticalBar> {
1544 test::TestBitEnumVerticalBar flags = {};
1545 auto loc = odsParser.getCurrentLocation();
1546 ::llvm::StringRef enumKeyword;
1547 do {
1548 if (::mlir::failed(odsParser.parseKeyword(&enumKeyword)))
1549 return ::mlir::failure();
1550 auto maybeEnum = test::symbolizeTestBitEnumVerticalBar(enumKeyword);
1551 if (!maybeEnum) {
1552 return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestBitEnumVerticalBar" << " to be one of: " << "user" << ", " << "group" << ", " << "other")};
1553 }
1554 flags = flags | *maybeEnum;
1555 } while(::mlir::succeeded(odsParser.parseOptionalVerticalBar()));
1556 return flags;
1557 }();
1558 if (::mlir::failed(_result_value)) {
1559 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestBitEnumVerticalBarAttr parameter 'value' which is to be a `test::TestBitEnumVerticalBar`");
1560 return {};
1561 }
1562 // Parse literal '>'
1563 if (odsParser.parseGreater()) return {};
1564 assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_value)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1564
, __extension__ __PRETTY_FUNCTION__))
;
1565 return TestBitEnumVerticalBarAttr::get(odsParser.getContext(),
1566 test::TestBitEnumVerticalBar((*_result_value)));
1567}
1568
1569void TestBitEnumVerticalBarAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1570 ::mlir::Builder odsBuilder(getContext());
1571 odsPrinter << "<";
1572 odsPrinter << stringifyTestBitEnumVerticalBar(getValue());
1573 odsPrinter << ">";
1574}
1575
1576test::TestBitEnumVerticalBar TestBitEnumVerticalBarAttr::getValue() const {
1577 return getImpl()->value;
1578}
1579
1580} // namespace test
1581MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestBitEnumVerticalBarAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestBitEnumVerticalBarAttr>::id = {}; } }
1582namespace test {
1583namespace detail {
1584struct TestEnumAttrStorage : public ::mlir::AttributeStorage {
1585 using KeyTy = std::tuple<test::TestEnum>;
1586 TestEnumAttrStorage(test::TestEnum value) : value(value) {}
1587
1588 bool operator==(const KeyTy &tblgenKey) const {
1589 return (value == std::get<0>(tblgenKey));
1590 }
1591
1592 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1593 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1594 }
1595
1596 static TestEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1597 auto value = std::get<0>(tblgenKey);
1598 return new (allocator.allocate<TestEnumAttrStorage>()) TestEnumAttrStorage(value);
1599 }
1600
1601 test::TestEnum value;
1602};
1603} // namespace detail
1604TestEnumAttr TestEnumAttr::get(::mlir::MLIRContext *context, test::TestEnum value) {
1605 return Base::get(context, value);
1606}
1607
1608::mlir::Attribute TestEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1609 ::mlir::Builder odsBuilder(odsParser.getContext());
1610 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1611 (void) odsLoc;
1612 ::mlir::FailureOr<test::TestEnum> _result_value;
1613
1614 // Parse variable 'value'
1615 _result_value = [&]() -> ::mlir::FailureOr<test::TestEnum> {
1616 auto loc = odsParser.getCurrentLocation();
1617 ::llvm::StringRef enumKeyword;
1618 if (::mlir::failed(odsParser.parseKeyword(&enumKeyword)))
1619 return ::mlir::failure();
1620 auto maybeEnum = test::symbolizeTestEnum(enumKeyword);
1621 if (maybeEnum)
1622 return *maybeEnum;
1623 return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestEnum" << " to be one of: " << "first" << ", " << "second" << ", " << "third")};
1624 }();
1625 if (::mlir::failed(_result_value)) {
1626 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestEnumAttr parameter 'value' which is to be a `test::TestEnum`");
1627 return {};
1628 }
1629 assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_value)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1629
, __extension__ __PRETTY_FUNCTION__))
;
1630 return TestEnumAttr::get(odsParser.getContext(),
1631 test::TestEnum((*_result_value)));
1632}
1633
1634void TestEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1635 ::mlir::Builder odsBuilder(getContext());
1636 odsPrinter << ' ';
1637 odsPrinter << stringifyTestEnum(getValue());
1638}
1639
1640test::TestEnum TestEnumAttr::getValue() const {
1641 return getImpl()->value;
1642}
1643
1644} // namespace test
1645MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestEnumAttr>::id = {}; } }
1646namespace test {
1647namespace detail {
1648struct TestExtern1DI64ElementsAttrStorage : public ::mlir::AttributeStorage {
1649 using KeyTy = std::tuple<::mlir::ShapedType, TestDialectResourceBlobHandle>;
1650 TestExtern1DI64ElementsAttrStorage(::mlir::ShapedType type, TestDialectResourceBlobHandle handle) : type(type), handle(handle) {}
1651
1652 bool operator==(const KeyTy &tblgenKey) const {
1653 return (type == std::get<0>(tblgenKey)) && (handle == std::get<1>(tblgenKey));
1654 }
1655
1656 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1657 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1658 }
1659
1660 static TestExtern1DI64ElementsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1661 auto type = std::get<0>(tblgenKey);
1662 auto handle = std::get<1>(tblgenKey);
1663 return new (allocator.allocate<TestExtern1DI64ElementsAttrStorage>()) TestExtern1DI64ElementsAttrStorage(type, handle);
1664 }
1665
1666 ::mlir::ShapedType type;
1667 TestDialectResourceBlobHandle handle;
1668};
1669} // namespace detail
1670TestExtern1DI64ElementsAttr TestExtern1DI64ElementsAttr::get(::mlir::MLIRContext *context, ::mlir::ShapedType type, TestDialectResourceBlobHandle handle) {
1671 return Base::get(context, type, handle);
1672}
1673
1674::mlir::Attribute TestExtern1DI64ElementsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1675 ::mlir::Builder odsBuilder(odsParser.getContext());
1676 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1677 (void) odsLoc;
1678 ::mlir::FailureOr<::mlir::ShapedType> _result_type;
1679
1680 if (odsType) {
1681 if (auto reqType = odsType.dyn_cast<::mlir::ShapedType>()) {
1682 _result_type = reqType;
1683 } else {
1684 odsParser.emitError(odsLoc, "invalid kind of type specified");
1685 return {};
1686 }
1687 } else {
1688 odsParser.emitError(odsLoc, "expected a trailing type");
1689 return {};
1690 }
1691 ::mlir::FailureOr<TestDialectResourceBlobHandle> _result_handle;
1692 // Parse literal '<'
1693 if (odsParser.parseLess()) return {};
1694
1695 // Parse variable 'handle'
1696 _result_handle = odsParser.parseResourceHandle<TestDialectResourceBlobHandle>();
1697 if (::mlir::failed(_result_handle)) {
1698 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestExtern1DI64ElementsAttr parameter 'handle' which is to be a `TestDialectResourceBlobHandle`");
1699 return {};
1700 }
1701 // Parse literal '>'
1702 if (odsParser.parseGreater()) return {};
1703 assert(::mlir::succeeded(_result_type))(static_cast <bool> (::mlir::succeeded(_result_type)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_type)",
"tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1703
, __extension__ __PRETTY_FUNCTION__))
;
1704 assert(::mlir::succeeded(_result_handle))(static_cast <bool> (::mlir::succeeded(_result_handle))
? void (0) : __assert_fail ("::mlir::succeeded(_result_handle)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1704
, __extension__ __PRETTY_FUNCTION__))
;
1705 return TestExtern1DI64ElementsAttr::get(odsParser.getContext(),
1706 ::mlir::ShapedType((*_result_type)),
1707 TestDialectResourceBlobHandle((*_result_handle)));
1708}
1709
1710void TestExtern1DI64ElementsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1711 ::mlir::Builder odsBuilder(getContext());
1712 odsPrinter << "<";
1713 odsPrinter.printResourceHandle(getHandle());
1714 odsPrinter << ">";
1715}
1716
1717::mlir::ShapedType TestExtern1DI64ElementsAttr::getType() const {
1718 return getImpl()->type;
1719}
1720
1721TestDialectResourceBlobHandle TestExtern1DI64ElementsAttr::getHandle() const {
1722 return getImpl()->handle;
1723}
1724
1725} // namespace test
1726MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestExtern1DI64ElementsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestExtern1DI64ElementsAttr>::id = {}; } }
1727namespace test {
1728namespace detail {
1729struct TestI64ElementsAttrStorage : public ::mlir::AttributeStorage {
1730 using KeyTy = std::tuple<::mlir::ShapedType, ::llvm::ArrayRef<uint64_t>>;
1731 TestI64ElementsAttrStorage(::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) : type(type), elements(elements) {}
1732
1733 bool operator==(const KeyTy &tblgenKey) const {
1734 return (type == std::get<0>(tblgenKey)) && (elements == std::get<1>(tblgenKey));
1735 }
1736
1737 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1738 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1739 }
1740
1741 static TestI64ElementsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1742 auto type = std::get<0>(tblgenKey);
1743 auto elements = std::get<1>(tblgenKey);
1744 elements = allocator.copyInto(elements);
1745 return new (allocator.allocate<TestI64ElementsAttrStorage>()) TestI64ElementsAttrStorage(type, elements);
1746 }
1747
1748 ::mlir::ShapedType type;
1749 ::llvm::ArrayRef<uint64_t> elements;
1750};
1751} // namespace detail
1752TestI64ElementsAttr TestI64ElementsAttr::get(::mlir::MLIRContext *context, ::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) {
1753 return Base::get(context, type, elements);
1754}
1755
1756TestI64ElementsAttr TestI64ElementsAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) {
1757 return Base::getChecked(emitError, context, type, elements);
1758}
1759
1760::mlir::ShapedType TestI64ElementsAttr::getType() const {
1761 return getImpl()->type;
1762}
1763
1764::llvm::ArrayRef<uint64_t> TestI64ElementsAttr::getElements() const {
1765 return getImpl()->elements;
1766}
1767
1768} // namespace test
1769MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestI64ElementsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestI64ElementsAttr>::id = {}; } }
1770namespace test {
1771namespace detail {
1772struct TestOverrideBuilderAttrStorage : public ::mlir::AttributeStorage {
1773 using KeyTy = std::tuple<int>;
1774 TestOverrideBuilderAttrStorage(int a) : a(a) {}
1775
1776 bool operator==(const KeyTy &tblgenKey) const {
1777 return (a == std::get<0>(tblgenKey));
1778 }
1779
1780 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1781 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1782 }
1783
1784 static TestOverrideBuilderAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1785 auto a = std::get<0>(tblgenKey);
1786 return new (allocator.allocate<TestOverrideBuilderAttrStorage>()) TestOverrideBuilderAttrStorage(a);
1787 }
1788
1789 int a;
1790};
1791} // namespace detail
1792::mlir::Attribute TestOverrideBuilderAttr::get(::mlir::MLIRContext *context, int a) {
1793 return ::mlir::IntegerAttr::get(::mlir::IndexType::get(context), a);
1794}
1795
1796::mlir::Attribute TestOverrideBuilderAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int a) {
1797 return ::mlir::IntegerAttr::get(::mlir::IndexType::get(context), a);
1798}
1799
1800::mlir::Attribute TestOverrideBuilderAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1801 ::mlir::Builder odsBuilder(odsParser.getContext());
1802 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1803 (void) odsLoc;
1804 ::mlir::FailureOr<int> _result_a;
1805 // Parse literal '<'
1806 if (odsParser.parseLess()) return {};
1807
1808 // Parse variable 'a'
1809 _result_a = ::mlir::FieldParser<int>::parse(odsParser);
1810 if (::mlir::failed(_result_a)) {
1811 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestOverrideBuilderAttr parameter 'a' which is to be a `int`");
1812 return {};
1813 }
1814 // Parse literal '>'
1815 if (odsParser.parseGreater()) return {};
1816 assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc"
, 1816, __extension__ __PRETTY_FUNCTION__))
;
1817 return odsParser.getChecked<TestOverrideBuilderAttr>(odsLoc, odsParser.getContext(),
1818 int((*_result_a)));
1819}
1820
1821void TestOverrideBuilderAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1822 ::mlir::Builder odsBuilder(getContext());
1823 odsPrinter << "<";
1824 odsPrinter.printStrippedAttrOrType(getA());
1825 odsPrinter << ">";
1826}
1827
1828int TestOverrideBuilderAttr::getA() const {
1829 return getImpl()->a;
1830}
1831
1832} // namespace test
1833MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestOverrideBuilderAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestOverrideBuilderAttr>::id = {}; } }
1834namespace test {
1835namespace detail {
1836struct SimpleEnumAttrStorage : public ::mlir::AttributeStorage {
1837 using KeyTy = std::tuple<::test::SimpleEnum>;
1838 SimpleEnumAttrStorage(::test::SimpleEnum value) : value(value) {}
1839
1840 bool operator==(const KeyTy &tblgenKey) const {
1841 return (value == std::get<0>(tblgenKey));
1842 }
1843
1844 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1845 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1846 }
1847
1848 static SimpleEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1849 auto value = std::get<0>(tblgenKey);
1850 return new (allocator.allocate<SimpleEnumAttrStorage>()) SimpleEnumAttrStorage(value);
1851 }
1852
1853 ::test::SimpleEnum value;
1854};
1855} // namespace detail
1856SimpleEnumAttr SimpleEnumAttr::get(::mlir::MLIRContext *context, ::test::SimpleEnum value) {
1857 return Base::get(context, value);
1858}
1859
1860::mlir::Attribute SimpleEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1861 ::mlir::Builder odsBuilder(odsParser.getContext());
1862 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1863 (void) odsLoc;
1864 ::mlir::FailureOr<::test::SimpleEnum> _result_value;
1865
1866 // Parse variable 'value'
1867 _result_value = [&]() -> ::mlir::FailureOr<::test::SimpleEnum> {
1868 auto loc = odsParser.getCurrentLocation();
1869 ::llvm::StringRef enumKeyword;
1870 if (::mlir::failed(odsParser.parseKeyword(&enumKeyword)))
1871 return ::mlir::failure();
1872 auto maybeEnum = ::test::symbolizeSimpleEnum(enumKeyword);
1873 if (maybeEnum)
1874 return *maybeEnum;
1875 return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::test::SimpleEnum" << " to be one of: " << "a" << ", " << "b")};
1876 }();
1877 if (::mlir::failed(_result_value)) {
1878 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestSimpleEnumAttr parameter 'value' which is to be a `::test::SimpleEnum`");
1879 return {};
1880 }
1881 assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_value)"
, "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1881
, __extension__ __PRETTY_FUNCTION__))
;
1882 return SimpleEnumAttr::get(odsParser.getContext(),
1883 ::test::SimpleEnum((*_result_value)));
1884}
1885
1886void SimpleEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1887 ::mlir::Builder odsBuilder(getContext());
1888 odsPrinter << stringifySimpleEnum(getValue());
1889}
1890
1891::test::SimpleEnum SimpleEnumAttr::getValue() const {
1892 return getImpl()->value;
1893}
1894
1895} // namespace test
1896MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::SimpleEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::SimpleEnumAttr>::id = {}; } }
1897namespace test {
1898namespace detail {
1899struct TestSubElementsAccessAttrStorage : public ::mlir::AttributeStorage {
1900 using KeyTy = std::tuple<::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute>;
1901 TestSubElementsAccessAttrStorage(::mlir::Attribute first, ::mlir::Attribute second, ::mlir::Attribute third) : first(first), second(second), third(third) {}
1902
1903 bool operator==(const KeyTy &tblgenKey) const {
1904 return (first == std::get<0>(tblgenKey)) && (second == std::get<1>(tblgenKey)) && (third == std::get<2>(tblgenKey));
1905 }
1906
1907 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1908 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
1909 }
1910
1911 static TestSubElementsAccessAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1912 auto first = std::get<0>(tblgenKey);
1913 auto second = std::get<1>(tblgenKey);
1914 auto third = std::get<2>(tblgenKey);
1915 return new (allocator.allocate<TestSubElementsAccessAttrStorage>()) TestSubElementsAccessAttrStorage(first, second, third);
1916 }
1917
1918 ::mlir::Attribute first;
1919 ::mlir::Attribute second;
1920 ::mlir::Attribute third;
1921};
1922} // namespace detail
1923TestSubElementsAccessAttr TestSubElementsAccessAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute first, ::mlir::Attribute second, ::mlir::Attribute third) {
1924 return Base::get(context, first, second, third);
1925}
1926
1927::mlir::Attribute TestSubElementsAccessAttr::getFirst() const {
1928 return getImpl()->first;
1929}
1930
1931::mlir::Attribute TestSubElementsAccessAttr::getSecond() const {
1932 return getImpl()->second;
1933}
1934
1935::mlir::Attribute TestSubElementsAccessAttr::getThird() const {
1936 return getImpl()->third;
1937}
1938
1939} // namespace test
1940MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestSubElementsAccessAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestSubElementsAccessAttr>::id = {}; } }
1941namespace test {
1942
1943/// Parse an attribute registered to this dialect.
1944::mlir::Attribute TestDialect::parseAttribute(::mlir::DialectAsmParser &parser,
1945 ::mlir::Type type) const {
1946 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
1947 ::llvm::StringRef attrTag;
1948 {
1949 ::mlir::Attribute attr;
1950 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
1951 if (parseResult.has_value())
1952 return attr;
1953 }
1954
1955 {
1956 ::mlir::Attribute genAttr;
1957 auto parseResult = parseOptionalDynamicAttr(attrTag, parser, genAttr);
1958 if (parseResult.has_value()) {
1959 if (::mlir::succeeded(parseResult.value()))
1960 return genAttr;
1961 return Attribute();
1962 }
1963 }
1964
1965 parser.emitError(typeLoc) << "unknown attribute `"
1966 << attrTag << "` in dialect `" << getNamespace() << "`";
1967 return {};
1968}
1969/// Print an attribute registered to this dialect.
1970void TestDialect::printAttribute(::mlir::Attribute attr,
1971 ::mlir::DialectAsmPrinter &printer) const {
1972 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
1973 return;
1974
1975 if (::mlir::succeeded(printIfDynamicAttr(attr, printer)))
1976 return;
1977
1978}
1979} // namespace test
1980
1981#endif // GET_ATTRDEF_CLASSES
1982