Bug Summary

File:build/llvm-toolchain-snapshot-16~++20221003111214+1fa2019828ca/build-llvm/tools/clang/stage2-bins/tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc
Warning:line 2231, 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 TestTypes.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/TestTypes.cpp
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* TypeDef Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_TYPEDEF_LIST
10#undef GET_TYPEDEF_LIST
11
12::test::CompoundNestedInnerType,
13::test::CompoundNestedOuterType,
14::test::CompoundNestedOuterQualType,
15::test::CompoundAType,
16::test::TestIntegerType,
17::test::SimpleAType,
18::test::StructType,
19::test::TestMemRefElementTypeType,
20::test::TestType,
21::test::TestTypeAPFloatType,
22::test::TestTypeAllOptionalParamsType,
23::test::TestTypeAllOptionalStructType,
24::test::TestTypeCustomType,
25::test::TestTypeCustomStringType,
26::test::TestTypeDefaultValuedTypeType,
27::test::TestTypeElseAnchorType,
28::test::TestTypeElseAnchorStructType,
29::test::TestTypeNoParserType,
30::test::TestTypeOptionalGroupType,
31::test::TestTypeOptionalGroupParamsType,
32::test::TestTypeOptionalGroupStructType,
33::test::TestTypeOptionalParamType,
34::test::TestTypeOptionalParamsType,
35::test::TestTypeOptionalParamsAfterRequiredType,
36::test::TestTypeOptionalStructType,
37::test::TestTypeSpaceSType,
38::test::TestStructTypeCaptureAllType,
39::test::TestTypeWithFormatType,
40::test::TestTypeWithLayoutType,
41::test::TestTypeWithTraitType
42
43#endif // GET_TYPEDEF_LIST
44
45#ifdef GET_TYPEDEF_CLASSES
46#undef GET_TYPEDEF_CLASSES
47
48static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) {
49 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
50 .Case(::test::CompoundNestedInnerType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
51 value = ::test::CompoundNestedInnerType::parse(parser);
52 return ::mlir::success(!!value);
53 })
54 .Case(::test::CompoundNestedOuterType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
55 value = ::test::CompoundNestedOuterType::parse(parser);
56 return ::mlir::success(!!value);
57 })
58 .Case(::test::CompoundNestedOuterQualType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
59 value = ::test::CompoundNestedOuterQualType::parse(parser);
60 return ::mlir::success(!!value);
61 })
62 .Case(::test::CompoundAType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
63 value = ::test::CompoundAType::parse(parser);
64 return ::mlir::success(!!value);
65 })
66 .Case(::test::TestIntegerType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
67 value = ::test::TestIntegerType::parse(parser);
68 return ::mlir::success(!!value);
69 })
70 .Case(::test::SimpleAType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
71 value = ::test::SimpleAType::get(parser.getContext());
72 return ::mlir::success(!!value);
73 })
74 .Case(::test::StructType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
75 value = ::test::StructType::parse(parser);
76 return ::mlir::success(!!value);
77 })
78 .Case(::test::TestMemRefElementTypeType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
79 value = ::test::TestMemRefElementTypeType::get(parser.getContext());
80 return ::mlir::success(!!value);
81 })
82 .Case(::test::TestType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
83 value = ::test::TestType::get(parser.getContext());
84 return ::mlir::success(!!value);
85 })
86 .Case(::test::TestTypeAPFloatType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
87 value = ::test::TestTypeAPFloatType::parse(parser);
88 return ::mlir::success(!!value);
89 })
90 .Case(::test::TestTypeAllOptionalParamsType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
91 value = ::test::TestTypeAllOptionalParamsType::parse(parser);
92 return ::mlir::success(!!value);
93 })
94 .Case(::test::TestTypeAllOptionalStructType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
95 value = ::test::TestTypeAllOptionalStructType::parse(parser);
96 return ::mlir::success(!!value);
97 })
98 .Case(::test::TestTypeCustomType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
99 value = ::test::TestTypeCustomType::parse(parser);
100 return ::mlir::success(!!value);
101 })
102 .Case(::test::TestTypeCustomStringType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
103 value = ::test::TestTypeCustomStringType::parse(parser);
104 return ::mlir::success(!!value);
105 })
106 .Case(::test::TestTypeDefaultValuedTypeType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
107 value = ::test::TestTypeDefaultValuedTypeType::parse(parser);
108 return ::mlir::success(!!value);
109 })
110 .Case(::test::TestTypeElseAnchorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
111 value = ::test::TestTypeElseAnchorType::parse(parser);
112 return ::mlir::success(!!value);
113 })
114 .Case(::test::TestTypeElseAnchorStructType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
115 value = ::test::TestTypeElseAnchorStructType::parse(parser);
116 return ::mlir::success(!!value);
117 })
118 .Case(::test::TestTypeNoParserType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
119 value = ::test::TestTypeNoParserType::parse(parser);
120 return ::mlir::success(!!value);
121 })
122 .Case(::test::TestTypeOptionalGroupType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
123 value = ::test::TestTypeOptionalGroupType::parse(parser);
124 return ::mlir::success(!!value);
125 })
126 .Case(::test::TestTypeOptionalGroupParamsType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
127 value = ::test::TestTypeOptionalGroupParamsType::parse(parser);
128 return ::mlir::success(!!value);
129 })
130 .Case(::test::TestTypeOptionalGroupStructType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
131 value = ::test::TestTypeOptionalGroupStructType::parse(parser);
132 return ::mlir::success(!!value);
133 })
134 .Case(::test::TestTypeOptionalParamType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
135 value = ::test::TestTypeOptionalParamType::parse(parser);
136 return ::mlir::success(!!value);
137 })
138 .Case(::test::TestTypeOptionalParamsType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
139 value = ::test::TestTypeOptionalParamsType::parse(parser);
140 return ::mlir::success(!!value);
141 })
142 .Case(::test::TestTypeOptionalParamsAfterRequiredType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
143 value = ::test::TestTypeOptionalParamsAfterRequiredType::parse(parser);
144 return ::mlir::success(!!value);
145 })
146 .Case(::test::TestTypeOptionalStructType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
147 value = ::test::TestTypeOptionalStructType::parse(parser);
148 return ::mlir::success(!!value);
149 })
150 .Case(::test::TestTypeSpaceSType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
151 value = ::test::TestTypeSpaceSType::parse(parser);
152 return ::mlir::success(!!value);
153 })
154 .Case(::test::TestStructTypeCaptureAllType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
155 value = ::test::TestStructTypeCaptureAllType::parse(parser);
156 return ::mlir::success(!!value);
157 })
158 .Case(::test::TestTypeWithFormatType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
159 value = ::test::TestTypeWithFormatType::parse(parser);
160 return ::mlir::success(!!value);
161 })
162 .Case(::test::TestTypeWithLayoutType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
163 value = ::test::TestTypeWithLayoutType::parse(parser);
164 return ::mlir::success(!!value);
165 })
166 .Case(::test::TestTypeWithTraitType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
167 value = ::test::TestTypeWithTraitType::get(parser.getContext());
168 return ::mlir::success(!!value);
169 })
170 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
171 *mnemonic = keyword;
172 return llvm::None;
173 });
174}
175
176static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) {
177 return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::test::CompoundNestedInnerType>([&](auto t) {
178 printer << ::test::CompoundNestedInnerType::getMnemonic();
179t.print(printer);
180 return ::mlir::success();
181 })
182 .Case<::test::CompoundNestedOuterType>([&](auto t) {
183 printer << ::test::CompoundNestedOuterType::getMnemonic();
184t.print(printer);
185 return ::mlir::success();
186 })
187 .Case<::test::CompoundNestedOuterQualType>([&](auto t) {
188 printer << ::test::CompoundNestedOuterQualType::getMnemonic();
189t.print(printer);
190 return ::mlir::success();
191 })
192 .Case<::test::CompoundAType>([&](auto t) {
193 printer << ::test::CompoundAType::getMnemonic();
194t.print(printer);
195 return ::mlir::success();
196 })
197 .Case<::test::TestIntegerType>([&](auto t) {
198 printer << ::test::TestIntegerType::getMnemonic();
199t.print(printer);
200 return ::mlir::success();
201 })
202 .Case<::test::SimpleAType>([&](auto t) {
203 printer << ::test::SimpleAType::getMnemonic();
204 return ::mlir::success();
205 })
206 .Case<::test::StructType>([&](auto t) {
207 printer << ::test::StructType::getMnemonic();
208t.print(printer);
209 return ::mlir::success();
210 })
211 .Case<::test::TestMemRefElementTypeType>([&](auto t) {
212 printer << ::test::TestMemRefElementTypeType::getMnemonic();
213 return ::mlir::success();
214 })
215 .Case<::test::TestType>([&](auto t) {
216 printer << ::test::TestType::getMnemonic();
217 return ::mlir::success();
218 })
219 .Case<::test::TestTypeAPFloatType>([&](auto t) {
220 printer << ::test::TestTypeAPFloatType::getMnemonic();
221t.print(printer);
222 return ::mlir::success();
223 })
224 .Case<::test::TestTypeAllOptionalParamsType>([&](auto t) {
225 printer << ::test::TestTypeAllOptionalParamsType::getMnemonic();
226t.print(printer);
227 return ::mlir::success();
228 })
229 .Case<::test::TestTypeAllOptionalStructType>([&](auto t) {
230 printer << ::test::TestTypeAllOptionalStructType::getMnemonic();
231t.print(printer);
232 return ::mlir::success();
233 })
234 .Case<::test::TestTypeCustomType>([&](auto t) {
235 printer << ::test::TestTypeCustomType::getMnemonic();
236t.print(printer);
237 return ::mlir::success();
238 })
239 .Case<::test::TestTypeCustomStringType>([&](auto t) {
240 printer << ::test::TestTypeCustomStringType::getMnemonic();
241t.print(printer);
242 return ::mlir::success();
243 })
244 .Case<::test::TestTypeDefaultValuedTypeType>([&](auto t) {
245 printer << ::test::TestTypeDefaultValuedTypeType::getMnemonic();
246t.print(printer);
247 return ::mlir::success();
248 })
249 .Case<::test::TestTypeElseAnchorType>([&](auto t) {
250 printer << ::test::TestTypeElseAnchorType::getMnemonic();
251t.print(printer);
252 return ::mlir::success();
253 })
254 .Case<::test::TestTypeElseAnchorStructType>([&](auto t) {
255 printer << ::test::TestTypeElseAnchorStructType::getMnemonic();
256t.print(printer);
257 return ::mlir::success();
258 })
259 .Case<::test::TestTypeNoParserType>([&](auto t) {
260 printer << ::test::TestTypeNoParserType::getMnemonic();
261t.print(printer);
262 return ::mlir::success();
263 })
264 .Case<::test::TestTypeOptionalGroupType>([&](auto t) {
265 printer << ::test::TestTypeOptionalGroupType::getMnemonic();
266t.print(printer);
267 return ::mlir::success();
268 })
269 .Case<::test::TestTypeOptionalGroupParamsType>([&](auto t) {
270 printer << ::test::TestTypeOptionalGroupParamsType::getMnemonic();
271t.print(printer);
272 return ::mlir::success();
273 })
274 .Case<::test::TestTypeOptionalGroupStructType>([&](auto t) {
275 printer << ::test::TestTypeOptionalGroupStructType::getMnemonic();
276t.print(printer);
277 return ::mlir::success();
278 })
279 .Case<::test::TestTypeOptionalParamType>([&](auto t) {
280 printer << ::test::TestTypeOptionalParamType::getMnemonic();
281t.print(printer);
282 return ::mlir::success();
283 })
284 .Case<::test::TestTypeOptionalParamsType>([&](auto t) {
285 printer << ::test::TestTypeOptionalParamsType::getMnemonic();
286t.print(printer);
287 return ::mlir::success();
288 })
289 .Case<::test::TestTypeOptionalParamsAfterRequiredType>([&](auto t) {
290 printer << ::test::TestTypeOptionalParamsAfterRequiredType::getMnemonic();
291t.print(printer);
292 return ::mlir::success();
293 })
294 .Case<::test::TestTypeOptionalStructType>([&](auto t) {
295 printer << ::test::TestTypeOptionalStructType::getMnemonic();
296t.print(printer);
297 return ::mlir::success();
298 })
299 .Case<::test::TestTypeSpaceSType>([&](auto t) {
300 printer << ::test::TestTypeSpaceSType::getMnemonic();
301t.print(printer);
302 return ::mlir::success();
303 })
304 .Case<::test::TestStructTypeCaptureAllType>([&](auto t) {
305 printer << ::test::TestStructTypeCaptureAllType::getMnemonic();
306t.print(printer);
307 return ::mlir::success();
308 })
309 .Case<::test::TestTypeWithFormatType>([&](auto t) {
310 printer << ::test::TestTypeWithFormatType::getMnemonic();
311t.print(printer);
312 return ::mlir::success();
313 })
314 .Case<::test::TestTypeWithLayoutType>([&](auto t) {
315 printer << ::test::TestTypeWithLayoutType::getMnemonic();
316t.print(printer);
317 return ::mlir::success();
318 })
319 .Case<::test::TestTypeWithTraitType>([&](auto t) {
320 printer << ::test::TestTypeWithTraitType::getMnemonic();
321 return ::mlir::success();
322 })
323 .Default([](auto) { return ::mlir::failure(); });
324}
325
326namespace test {
327namespace detail {
328struct CompoundNestedInnerTypeStorage : public ::mlir::TypeStorage {
329 using KeyTy = std::tuple<int, ::test::CompoundAType>;
330 CompoundNestedInnerTypeStorage(int some_int, ::test::CompoundAType cmpdA) : some_int(some_int), cmpdA(cmpdA) {}
331
332 bool operator==(const KeyTy &tblgenKey) const {
333 return (some_int == std::get<0>(tblgenKey)) && (cmpdA == std::get<1>(tblgenKey));
334 }
335
336 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
337 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
338 }
339
340 static CompoundNestedInnerTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
341 auto some_int = std::get<0>(tblgenKey);
342 auto cmpdA = std::get<1>(tblgenKey);
343 return new (allocator.allocate<CompoundNestedInnerTypeStorage>()) CompoundNestedInnerTypeStorage(some_int, cmpdA);
344 }
345
346 int some_int;
347 ::test::CompoundAType cmpdA;
348};
349} // namespace detail
350CompoundNestedInnerType CompoundNestedInnerType::get(::mlir::MLIRContext *context, int some_int, ::test::CompoundAType cmpdA) {
351 return Base::get(context, some_int, cmpdA);
352}
353
354::mlir::Type CompoundNestedInnerType::parse(::mlir::AsmParser &odsParser) {
355 ::mlir::Builder odsBuilder(odsParser.getContext());
356 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
357 (void) odsLoc;
358 ::mlir::FailureOr<int> _result_some_int;
359 ::mlir::FailureOr<::test::CompoundAType> _result_cmpdA;
360 // Parse literal '<'
361 if (odsParser.parseLess()) return {};
362
363 // Parse variable 'some_int'
364 _result_some_int = ::mlir::FieldParser<int>::parse(odsParser);
365 if (::mlir::failed(_result_some_int)) {
366 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInnerType parameter 'some_int' which is to be a `int`");
367 return {};
368 }
369
370 // Parse variable 'cmpdA'
371 _result_cmpdA = ::mlir::FieldParser<::test::CompoundAType>::parse(odsParser);
372 if (::mlir::failed(_result_cmpdA)) {
373 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInnerType parameter 'cmpdA' which is to be a `::test::CompoundAType`");
374 return {};
375 }
376 // Parse literal '>'
377 if (odsParser.parseGreater()) return {};
378 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/TestTypeDefs.cpp.inc", 378
, __extension__ __PRETTY_FUNCTION__))
;
379 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/TestTypeDefs.cpp.inc", 379
, __extension__ __PRETTY_FUNCTION__))
;
380 return CompoundNestedInnerType::get(odsParser.getContext(),
381 int((*_result_some_int)),
382 ::test::CompoundAType((*_result_cmpdA)));
383}
384
385void CompoundNestedInnerType::print(::mlir::AsmPrinter &odsPrinter) const {
386 ::mlir::Builder odsBuilder(getContext());
387 odsPrinter << "<";
388 odsPrinter.printStrippedAttrOrType(getSomeInt());
389 odsPrinter << ' ';
390 odsPrinter.printStrippedAttrOrType(getCmpdA());
391 odsPrinter << ">";
392}
393
394int CompoundNestedInnerType::getSomeInt() const {
395 return getImpl()->some_int;
396}
397
398::test::CompoundAType CompoundNestedInnerType::getCmpdA() const {
399 return getImpl()->cmpdA;
400}
401
402} // namespace test
403MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedInnerType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedInnerType>::id = {}; } }
404namespace test {
405namespace detail {
406struct CompoundNestedOuterTypeStorage : public ::mlir::TypeStorage {
407 using KeyTy = std::tuple<::test::CompoundNestedInnerType>;
408 CompoundNestedOuterTypeStorage(::test::CompoundNestedInnerType inner) : inner(inner) {}
409
410 bool operator==(const KeyTy &tblgenKey) const {
411 return (inner == std::get<0>(tblgenKey));
412 }
413
414 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
415 return ::llvm::hash_combine(std::get<0>(tblgenKey));
416 }
417
418 static CompoundNestedOuterTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
419 auto inner = std::get<0>(tblgenKey);
420 return new (allocator.allocate<CompoundNestedOuterTypeStorage>()) CompoundNestedOuterTypeStorage(inner);
421 }
422
423 ::test::CompoundNestedInnerType inner;
424};
425} // namespace detail
426CompoundNestedOuterType CompoundNestedOuterType::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerType inner) {
427 return Base::get(context, inner);
428}
429
430::mlir::Type CompoundNestedOuterType::parse(::mlir::AsmParser &odsParser) {
431 ::mlir::Builder odsBuilder(odsParser.getContext());
432 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
433 (void) odsLoc;
434 ::mlir::FailureOr<::test::CompoundNestedInnerType> _result_inner;
435 // Parse literal '<'
436 if (odsParser.parseLess()) return {};
437 // Parse literal 'i'
438 if (odsParser.parseKeyword("i")) return {};
439
440 // Parse variable 'inner'
441 _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerType>::parse(odsParser);
442 if (::mlir::failed(_result_inner)) {
443 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuterType parameter 'inner' which is to be a `::test::CompoundNestedInnerType`");
444 return {};
445 }
446 // Parse literal '>'
447 if (odsParser.parseGreater()) return {};
448 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/TestTypeDefs.cpp.inc", 448
, __extension__ __PRETTY_FUNCTION__))
;
449 return CompoundNestedOuterType::get(odsParser.getContext(),
450 ::test::CompoundNestedInnerType((*_result_inner)));
451}
452
453void CompoundNestedOuterType::print(::mlir::AsmPrinter &odsPrinter) const {
454 ::mlir::Builder odsBuilder(getContext());
455 odsPrinter << "<";
456 odsPrinter << "i";
457 odsPrinter << ' ';
458 odsPrinter.printStrippedAttrOrType(getInner());
459 odsPrinter << ">";
460}
461
462::test::CompoundNestedInnerType CompoundNestedOuterType::getInner() const {
463 return getImpl()->inner;
464}
465
466} // namespace test
467MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedOuterType>::id = {}; } }
468namespace test {
469namespace detail {
470struct CompoundNestedOuterQualTypeStorage : public ::mlir::TypeStorage {
471 using KeyTy = std::tuple<::test::CompoundNestedInnerType>;
472 CompoundNestedOuterQualTypeStorage(::test::CompoundNestedInnerType inner) : inner(inner) {}
473
474 bool operator==(const KeyTy &tblgenKey) const {
475 return (inner == std::get<0>(tblgenKey));
476 }
477
478 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
479 return ::llvm::hash_combine(std::get<0>(tblgenKey));
480 }
481
482 static CompoundNestedOuterQualTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
483 auto inner = std::get<0>(tblgenKey);
484 return new (allocator.allocate<CompoundNestedOuterQualTypeStorage>()) CompoundNestedOuterQualTypeStorage(inner);
485 }
486
487 ::test::CompoundNestedInnerType inner;
488};
489} // namespace detail
490CompoundNestedOuterQualType CompoundNestedOuterQualType::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerType inner) {
491 return Base::get(context, inner);
492}
493
494::mlir::Type CompoundNestedOuterQualType::parse(::mlir::AsmParser &odsParser) {
495 ::mlir::Builder odsBuilder(odsParser.getContext());
496 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
497 (void) odsLoc;
498 ::mlir::FailureOr<::test::CompoundNestedInnerType> _result_inner;
499 // Parse literal '<'
500 if (odsParser.parseLess()) return {};
501 // Parse literal 'i'
502 if (odsParser.parseKeyword("i")) return {};
503
504 // Parse variable 'inner'
505 _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerType>::parse(odsParser);
506 if (::mlir::failed(_result_inner)) {
507 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuterTypeQual parameter 'inner' which is to be a `::test::CompoundNestedInnerType`");
508 return {};
509 }
510 // Parse literal '>'
511 if (odsParser.parseGreater()) return {};
512 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/TestTypeDefs.cpp.inc", 512
, __extension__ __PRETTY_FUNCTION__))
;
513 return CompoundNestedOuterQualType::get(odsParser.getContext(),
514 ::test::CompoundNestedInnerType((*_result_inner)));
515}
516
517void CompoundNestedOuterQualType::print(::mlir::AsmPrinter &odsPrinter) const {
518 ::mlir::Builder odsBuilder(getContext());
519 odsPrinter << "<";
520 odsPrinter << "i";
521 odsPrinter << ' ';
522 odsPrinter << getInner();
523 odsPrinter << ">";
524}
525
526::test::CompoundNestedInnerType CompoundNestedOuterQualType::getInner() const {
527 return getImpl()->inner;
528}
529
530} // namespace test
531MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterQualType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundNestedOuterQualType>::id = {}; } }
532namespace test {
533namespace detail {
534struct CompoundATypeStorage : public ::mlir::TypeStorage {
535 using KeyTy = std::tuple<int, ::mlir::Type, ::llvm::ArrayRef<int>>;
536 CompoundATypeStorage(int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) : widthOfSomething(widthOfSomething), oneType(oneType), arrayOfInts(arrayOfInts) {}
537
538 bool operator==(const KeyTy &tblgenKey) const {
539 return (widthOfSomething == std::get<0>(tblgenKey)) && (oneType == std::get<1>(tblgenKey)) && (arrayOfInts == std::get<2>(tblgenKey));
540 }
541
542 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
543 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
544 }
545
546 static CompoundATypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
547 auto widthOfSomething = std::get<0>(tblgenKey);
548 auto oneType = std::get<1>(tblgenKey);
549 auto arrayOfInts = std::get<2>(tblgenKey);
550 arrayOfInts = allocator.copyInto(arrayOfInts);
551 return new (allocator.allocate<CompoundATypeStorage>()) CompoundATypeStorage(widthOfSomething, oneType, arrayOfInts);
552 }
553
554 int widthOfSomething;
555 ::mlir::Type oneType;
556 ::llvm::ArrayRef<int> arrayOfInts;
557};
558} // namespace detail
559CompoundAType CompoundAType::get(::mlir::MLIRContext *context, int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) {
560 return Base::get(context, widthOfSomething, oneType, arrayOfInts);
561}
562
563int CompoundAType::getWidthOfSomething() const {
564 return getImpl()->widthOfSomething;
565}
566
567::mlir::Type CompoundAType::getOneType() const {
568 return getImpl()->oneType;
569}
570
571::llvm::ArrayRef<int> CompoundAType::getArrayOfInts() const {
572 return getImpl()->arrayOfInts;
573}
574
575} // namespace test
576MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundAType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::CompoundAType>::id = {}; } }
577namespace test {
578namespace detail {
579struct TestIntegerTypeStorage : public ::mlir::TypeStorage {
580 using KeyTy = std::tuple<unsigned, ::test::TestIntegerType::SignednessSemantics>;
581 TestIntegerTypeStorage(unsigned width, ::test::TestIntegerType::SignednessSemantics signedness) : width(width), signedness(signedness) {}
582
583 bool operator==(const KeyTy &tblgenKey) const {
584 return (width == std::get<0>(tblgenKey)) && (signedness == std::get<1>(tblgenKey));
585 }
586
587 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
588 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
589 }
590
591 static TestIntegerTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
592 auto width = std::get<0>(tblgenKey);
593 auto signedness = std::get<1>(tblgenKey);
594 return new (allocator.allocate<TestIntegerTypeStorage>()) TestIntegerTypeStorage(width, signedness);
595 }
596
597 unsigned width;
598 ::test::TestIntegerType::SignednessSemantics signedness;
599};
600} // namespace detail
601TestIntegerType TestIntegerType::get(::mlir::MLIRContext *context, unsigned width, SignednessSemantics signedness) {
602 return Base::get(context, width, signedness);
603}
604
605TestIntegerType TestIntegerType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, unsigned width, SignednessSemantics signedness) {
606 return Base::getChecked(emitError, context, width, signedness);
607}
608
609unsigned TestIntegerType::getWidth() const {
610 return getImpl()->width;
611}
612
613::test::TestIntegerType::SignednessSemantics TestIntegerType::getSignedness() const {
614 return getImpl()->signedness;
615}
616
617} // namespace test
618MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestIntegerType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestIntegerType>::id = {}; } }
619namespace test {
620} // namespace test
621MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::SimpleAType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::SimpleAType>::id = {}; } }
622namespace test {
623namespace detail {
624struct StructTypeStorage : public ::mlir::TypeStorage {
625 using KeyTy = std::tuple<::llvm::ArrayRef<::test::FieldInfo>>;
626 StructTypeStorage(::llvm::ArrayRef<::test::FieldInfo> fields) : fields(fields) {}
627
628 bool operator==(const KeyTy &tblgenKey) const {
629 return (fields == std::get<0>(tblgenKey));
630 }
631
632 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
633 return ::llvm::hash_combine(std::get<0>(tblgenKey));
634 }
635
636 static StructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
637 auto fields = std::get<0>(tblgenKey);
638
639 llvm::SmallVector<::test::FieldInfo, 4> tmpFields;
640 for (size_t i = 0, e = fields.size(); i < e; ++i)
641 tmpFields.push_back(fields[i].allocateInto(allocator));
642 fields = allocator.copyInto(ArrayRef<::test::FieldInfo>(tmpFields));
643
644 return new (allocator.allocate<StructTypeStorage>()) StructTypeStorage(fields);
645 }
646
647 ::llvm::ArrayRef<::test::FieldInfo> fields;
648};
649} // namespace detail
650StructType StructType::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<::test::FieldInfo> fields) {
651 return Base::get(context, fields);
652}
653
654::llvm::ArrayRef<::test::FieldInfo> StructType::getFields() const {
655 return getImpl()->fields;
656}
657
658} // namespace test
659MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::StructType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::StructType>::id = {}; } }
660namespace test {
661} // namespace test
662MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestMemRefElementTypeType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestMemRefElementTypeType>::id = {}; } }
663namespace test {
664} // namespace test
665MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestType>::id = {}; } }
666namespace test {
667namespace detail {
668struct TestTypeAPFloatTypeStorage : public ::mlir::TypeStorage {
669 using KeyTy = std::tuple<llvm::APFloat>;
670 TestTypeAPFloatTypeStorage(llvm::APFloat a) : a(a) {}
671
672 bool operator==(const KeyTy &tblgenKey) const {
673 return (a.bitwiseIsEqual(std::get<0>(tblgenKey)));
674 }
675
676 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
677 return ::llvm::hash_combine(std::get<0>(tblgenKey));
678 }
679
680 static TestTypeAPFloatTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
681 auto a = std::get<0>(tblgenKey);
682 return new (allocator.allocate<TestTypeAPFloatTypeStorage>()) TestTypeAPFloatTypeStorage(a);
683 }
684
685 llvm::APFloat a;
686};
687} // namespace detail
688TestTypeAPFloatType TestTypeAPFloatType::get(::mlir::MLIRContext *context, llvm::APFloat a) {
689 return Base::get(context, a);
690}
691
692::mlir::Type TestTypeAPFloatType::parse(::mlir::AsmParser &odsParser) {
693 ::mlir::Builder odsBuilder(odsParser.getContext());
694 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
695 (void) odsLoc;
696 ::mlir::FailureOr<llvm::APFloat> _result_a;
697 // Parse literal '<'
698 if (odsParser.parseLess()) return {};
699
700 // Parse variable 'a'
701 _result_a = [&]() -> mlir::FailureOr<llvm::APFloat> {
702 mlir::FloatAttr attr;
703 auto result = odsParser.parseOptionalAttribute(attr);
704 if (result.has_value() && mlir::succeeded(*result))
705 return attr.getValue();
706 if (!result.has_value())
707 return llvm::APFloat(APFloat::getZero(APFloat::IEEEdouble()));
708 return mlir::failure();
709 }() ;
710 if (::mlir::failed(_result_a)) {
711 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeAPFloat parameter 'a' which is to be a `llvm::APFloat`");
712 return {};
713 }
714 // Parse literal '>'
715 if (odsParser.parseGreater()) return {};
716 return TestTypeAPFloatType::get(odsParser.getContext(),
717 llvm::APFloat((_result_a.value_or(llvm::APFloat(APFloat::getZero(APFloat::IEEEdouble()))))));
718}
719
720void TestTypeAPFloatType::print(::mlir::AsmPrinter &odsPrinter) const {
721 ::mlir::Builder odsBuilder(getContext());
722 odsPrinter << "<";
723 if (!(getA().bitwiseIsEqual(llvm::APFloat(APFloat::getZero(APFloat::IEEEdouble()))))) {
724 odsPrinter.printStrippedAttrOrType(getA());
725 }
726 odsPrinter << ">";
727}
728
729llvm::APFloat TestTypeAPFloatType::getA() const {
730 return getImpl()->a;
731}
732
733} // namespace test
734MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeAPFloatType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeAPFloatType>::id = {}; } }
735namespace test {
736namespace detail {
737struct TestTypeAllOptionalParamsTypeStorage : public ::mlir::TypeStorage {
738 using KeyTy = std::tuple<mlir::Optional<int>, mlir::Optional<int>>;
739 TestTypeAllOptionalParamsTypeStorage(mlir::Optional<int> a, mlir::Optional<int> b) : a(a), b(b) {}
740
741 bool operator==(const KeyTy &tblgenKey) const {
742 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
743 }
744
745 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
746 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
747 }
748
749 static TestTypeAllOptionalParamsTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
750 auto a = std::get<0>(tblgenKey);
751 auto b = std::get<1>(tblgenKey);
752 return new (allocator.allocate<TestTypeAllOptionalParamsTypeStorage>()) TestTypeAllOptionalParamsTypeStorage(a, b);
753 }
754
755 mlir::Optional<int> a;
756 mlir::Optional<int> b;
757};
758} // namespace detail
759TestTypeAllOptionalParamsType TestTypeAllOptionalParamsType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, mlir::Optional<int> b) {
760 return Base::get(context, a, b);
761}
762
763::mlir::Type TestTypeAllOptionalParamsType::parse(::mlir::AsmParser &odsParser) {
764 ::mlir::Builder odsBuilder(odsParser.getContext());
765 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
766 (void) odsLoc;
767 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
768 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
769 // Parse literal '<'
770 if (odsParser.parseLess()) return {};
771 // Parse parameter list
772 do {
773
774 // Parse variable 'a'
775 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
776 if (::mlir::failed(_result_a)) {
777 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeAllOptionalParams parameter 'a' which is to be a `mlir::Optional<int>`");
778 return {};
779 }
780 if (::mlir::succeeded(_result_a) && !((*_result_a) == mlir::Optional<int>())) {
781 // Parse literal ','
782 if (odsParser.parseOptionalComma()) break;
783 }
784
785 // Parse variable 'b'
786 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
787 if (::mlir::failed(_result_b)) {
788 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeAllOptionalParams parameter 'b' which is to be a `mlir::Optional<int>`");
789 return {};
790 }
791 } while(false);
792 // Parse literal '>'
793 if (odsParser.parseGreater()) return {};
794 return TestTypeAllOptionalParamsType::get(odsParser.getContext(),
795 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
796 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
797}
798
799void TestTypeAllOptionalParamsType::print(::mlir::AsmPrinter &odsPrinter) const {
800 ::mlir::Builder odsBuilder(getContext());
801 odsPrinter << "<";
802 {
803 bool _firstPrinted = true;
804 if (!(getA() == mlir::Optional<int>())) {
805 if (!_firstPrinted) odsPrinter << ", ";
806 _firstPrinted = false;
807 if (!(getA() == mlir::Optional<int>())) {
808 odsPrinter.printStrippedAttrOrType(getA());
809 }
810 }
811 if (!(getB() == mlir::Optional<int>())) {
812 if (!_firstPrinted) odsPrinter << ", ";
813 _firstPrinted = false;
814 if (!(getB() == mlir::Optional<int>())) {
815 odsPrinter.printStrippedAttrOrType(getB());
816 }
817 }
818 }
819 odsPrinter << ">";
820}
821
822mlir::Optional<int> TestTypeAllOptionalParamsType::getA() const {
823 return getImpl()->a;
824}
825
826mlir::Optional<int> TestTypeAllOptionalParamsType::getB() const {
827 return getImpl()->b;
828}
829
830} // namespace test
831MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeAllOptionalParamsType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeAllOptionalParamsType>::id = {}; } }
832namespace test {
833namespace detail {
834struct TestTypeAllOptionalStructTypeStorage : public ::mlir::TypeStorage {
835 using KeyTy = std::tuple<mlir::Optional<int>, mlir::Optional<int>>;
836 TestTypeAllOptionalStructTypeStorage(mlir::Optional<int> a, mlir::Optional<int> b) : a(a), b(b) {}
837
838 bool operator==(const KeyTy &tblgenKey) const {
839 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
840 }
841
842 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
843 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
844 }
845
846 static TestTypeAllOptionalStructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
847 auto a = std::get<0>(tblgenKey);
848 auto b = std::get<1>(tblgenKey);
849 return new (allocator.allocate<TestTypeAllOptionalStructTypeStorage>()) TestTypeAllOptionalStructTypeStorage(a, b);
850 }
851
852 mlir::Optional<int> a;
853 mlir::Optional<int> b;
854};
855} // namespace detail
856TestTypeAllOptionalStructType TestTypeAllOptionalStructType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, mlir::Optional<int> b) {
857 return Base::get(context, a, b);
858}
859
860::mlir::Type TestTypeAllOptionalStructType::parse(::mlir::AsmParser &odsParser) {
861 ::mlir::Builder odsBuilder(odsParser.getContext());
862 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
863 (void) odsLoc;
864 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
865 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
866 // Parse literal '<'
867 if (odsParser.parseLess()) return {};
868 // Parse parameter struct
869 bool _seen_a = false;
870 bool _seen_b = false;
871 {
872 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
873 // Parse literal '='
874 if (odsParser.parseEqual()) return {};
875 if (!_seen_a && _paramKey == "a") {
876 _seen_a = true;
877
878 // Parse variable 'a'
879 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
880 if (::mlir::failed(_result_a)) {
881 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeAllOptionalStruct parameter 'a' which is to be a `mlir::Optional<int>`");
882 return {};
883 }
884 } else if (!_seen_b && _paramKey == "b") {
885 _seen_b = true;
886
887 // Parse variable 'b'
888 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
889 if (::mlir::failed(_result_b)) {
890 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeAllOptionalStruct parameter 'b' which is to be a `mlir::Optional<int>`");
891 return {};
892 }
893 } else {
894 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
895 return {};
896 }
897 return true;
898 };
899 ::llvm::StringRef _paramKey;
900 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
901 if (!_loop_body(_paramKey)) return {};
902 while (!odsParser.parseOptionalComma()) {
903 ::llvm::StringRef _paramKey;
904 if (odsParser.parseKeyword(&_paramKey)) {
905 odsParser.emitError(odsParser.getCurrentLocation(),
906 "expected a parameter name in struct");
907 return {};
908 }
909 if (!_loop_body(_paramKey)) return {};
910 }
911 }
912 }
913 // Parse literal '>'
914 if (odsParser.parseGreater()) return {};
915 return TestTypeAllOptionalStructType::get(odsParser.getContext(),
916 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
917 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
918}
919
920void TestTypeAllOptionalStructType::print(::mlir::AsmPrinter &odsPrinter) const {
921 ::mlir::Builder odsBuilder(getContext());
922 odsPrinter << "<";
923 {
924 bool _firstPrinted = true;
925 if (!(getA() == mlir::Optional<int>())) {
926 if (!_firstPrinted) odsPrinter << ", ";
927 _firstPrinted = false;
928 odsPrinter << "a = ";
929 if (!(getA() == mlir::Optional<int>())) {
930 odsPrinter.printStrippedAttrOrType(getA());
931 }
932 }
933 if (!(getB() == mlir::Optional<int>())) {
934 if (!_firstPrinted) odsPrinter << ", ";
935 _firstPrinted = false;
936 odsPrinter << "b = ";
937 if (!(getB() == mlir::Optional<int>())) {
938 odsPrinter.printStrippedAttrOrType(getB());
939 }
940 }
941 }
942 odsPrinter << ">";
943}
944
945mlir::Optional<int> TestTypeAllOptionalStructType::getA() const {
946 return getImpl()->a;
947}
948
949mlir::Optional<int> TestTypeAllOptionalStructType::getB() const {
950 return getImpl()->b;
951}
952
953} // namespace test
954MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeAllOptionalStructType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeAllOptionalStructType>::id = {}; } }
955namespace test {
956namespace detail {
957struct TestTypeCustomTypeStorage : public ::mlir::TypeStorage {
958 using KeyTy = std::tuple<int, mlir::Optional<int>>;
959 TestTypeCustomTypeStorage(int a, mlir::Optional<int> b) : a(a), b(b) {}
960
961 bool operator==(const KeyTy &tblgenKey) const {
962 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
963 }
964
965 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
966 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
967 }
968
969 static TestTypeCustomTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
970 auto a = std::get<0>(tblgenKey);
971 auto b = std::get<1>(tblgenKey);
972 return new (allocator.allocate<TestTypeCustomTypeStorage>()) TestTypeCustomTypeStorage(a, b);
973 }
974
975 int a;
976 mlir::Optional<int> b;
977};
978} // namespace detail
979TestTypeCustomType TestTypeCustomType::get(::mlir::MLIRContext *context, int a, mlir::Optional<int> b) {
980 return Base::get(context, a, b);
981}
982
983::mlir::Type TestTypeCustomType::parse(::mlir::AsmParser &odsParser) {
984 ::mlir::Builder odsBuilder(odsParser.getContext());
985 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
986 (void) odsLoc;
987 ::mlir::FailureOr<int> _result_a;
988 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
989 // Parse literal '<'
990 if (odsParser.parseLess()) return {};
991 {
992 auto odsCustomLoc = odsParser.getCurrentLocation();
993 (void)odsCustomLoc;
994 auto odsCustomResult = parseCustomTypeA(odsParser,
995 _result_a);
996 if (::mlir::failed(odsCustomResult)) return {};
997 if (::mlir::failed(_result_a)) {
998 odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'a'");
999 return {};
1000 }
1001 }
1002 {
1003 auto odsCustomLoc = odsParser.getCurrentLocation();
1004 (void)odsCustomLoc;
1005 auto odsCustomResult = parseCustomTypeB(odsParser,
1006 *_result_a,
1007 _result_b);
1008 if (::mlir::failed(odsCustomResult)) return {};
1009 }
1010 // Parse literal '>'
1011 if (odsParser.parseGreater()) return {};
1012 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/TestTypeDefs.cpp.inc"
, 1012, __extension__ __PRETTY_FUNCTION__))
;
1013 return TestTypeCustomType::get(odsParser.getContext(),
1014 int((*_result_a)),
1015 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
1016}
1017
1018void TestTypeCustomType::print(::mlir::AsmPrinter &odsPrinter) const {
1019 ::mlir::Builder odsBuilder(getContext());
1020 odsPrinter << "<";
1021 printCustomTypeA(odsPrinter,
1022 getA());
1023 printCustomTypeB(odsPrinter,
1024 getA(),
1025 getB());
1026 odsPrinter << ">";
1027}
1028
1029int TestTypeCustomType::getA() const {
1030 return getImpl()->a;
1031}
1032
1033mlir::Optional<int> TestTypeCustomType::getB() const {
1034 return getImpl()->b;
1035}
1036
1037} // namespace test
1038MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeCustomType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeCustomType>::id = {}; } }
1039namespace test {
1040namespace detail {
1041struct TestTypeCustomStringTypeStorage : public ::mlir::TypeStorage {
1042 using KeyTy = std::tuple<::llvm::StringRef>;
1043 TestTypeCustomStringTypeStorage(::llvm::StringRef foo) : foo(foo) {}
1044
1045 bool operator==(const KeyTy &tblgenKey) const {
1046 return (foo == std::get<0>(tblgenKey));
1047 }
1048
1049 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1050 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1051 }
1052
1053 static TestTypeCustomStringTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1054 auto foo = std::get<0>(tblgenKey);
1055 foo = allocator.copyInto(foo);
1056 return new (allocator.allocate<TestTypeCustomStringTypeStorage>()) TestTypeCustomStringTypeStorage(foo);
1057 }
1058
1059 ::llvm::StringRef foo;
1060};
1061} // namespace detail
1062TestTypeCustomStringType TestTypeCustomStringType::get(::mlir::MLIRContext *context, ::llvm::StringRef foo) {
1063 return Base::get(context, foo);
1064}
1065
1066::mlir::Type TestTypeCustomStringType::parse(::mlir::AsmParser &odsParser) {
1067 ::mlir::Builder odsBuilder(odsParser.getContext());
1068 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1069 (void) odsLoc;
1070 ::mlir::FailureOr<std::string> _result_foo;
1071 // Parse literal '<'
1072 if (odsParser.parseLess()) return {};
1073 {
1074 auto odsCustomLoc = odsParser.getCurrentLocation();
1075 (void)odsCustomLoc;
1076 auto odsCustomResult = parseFooString(odsParser,
1077 _result_foo);
1078 if (::mlir::failed(odsCustomResult)) return {};
1079 if (::mlir::failed(_result_foo)) {
1080 odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'foo'");
1081 return {};
1082 }
1083 }
1084 {
1085 auto odsCustomLoc = odsParser.getCurrentLocation();
1086 (void)odsCustomLoc;
1087 auto odsCustomResult = parseBarString(odsParser,
1088 *_result_foo);
1089 if (::mlir::failed(odsCustomResult)) return {};
1090 }
1091 // Parse literal '>'
1092 if (odsParser.parseGreater()) return {};
1093 assert(::mlir::succeeded(_result_foo))(static_cast <bool> (::mlir::succeeded(_result_foo)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_foo)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 1093, __extension__ __PRETTY_FUNCTION__))
;
1094 return TestTypeCustomStringType::get(odsParser.getContext(),
1095 ::llvm::StringRef((*_result_foo)));
1096}
1097
1098void TestTypeCustomStringType::print(::mlir::AsmPrinter &odsPrinter) const {
1099 ::mlir::Builder odsBuilder(getContext());
1100 odsPrinter << "<";
1101 printFooString(odsPrinter,
1102 getFoo());
1103 printBarString(odsPrinter,
1104 getFoo());
1105 odsPrinter << ">";
1106}
1107
1108::llvm::StringRef TestTypeCustomStringType::getFoo() const {
1109 return getImpl()->foo;
1110}
1111
1112} // namespace test
1113MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeCustomStringType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeCustomStringType>::id = {}; } }
1114namespace test {
1115namespace detail {
1116struct TestTypeDefaultValuedTypeTypeStorage : public ::mlir::TypeStorage {
1117 using KeyTy = std::tuple<mlir::IntegerType>;
1118 TestTypeDefaultValuedTypeTypeStorage(mlir::IntegerType type) : type(type) {}
1119
1120 bool operator==(const KeyTy &tblgenKey) const {
1121 return (type == std::get<0>(tblgenKey));
1122 }
1123
1124 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1125 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1126 }
1127
1128 static TestTypeDefaultValuedTypeTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1129 auto type = std::get<0>(tblgenKey);
1130 return new (allocator.allocate<TestTypeDefaultValuedTypeTypeStorage>()) TestTypeDefaultValuedTypeTypeStorage(type);
1131 }
1132
1133 mlir::IntegerType type;
1134};
1135} // namespace detail
1136TestTypeDefaultValuedTypeType TestTypeDefaultValuedTypeType::get(::mlir::MLIRContext *context, mlir::IntegerType type) {
1137 return Base::get(context, type);
1138}
1139
1140::mlir::Type TestTypeDefaultValuedTypeType::parse(::mlir::AsmParser &odsParser) {
1141 ::mlir::Builder odsBuilder(odsParser.getContext());
1142 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1143 (void) odsLoc;
1144 ::mlir::FailureOr<mlir::IntegerType> _result_type;
1145 // Parse literal '<'
1146 if (odsParser.parseLess()) return {};
1147 // Parse literal '('
1148 if (odsParser.parseOptionalLParen()) {
1149 } else {
1150
1151 // Parse variable 'type'
1152 _result_type = ::mlir::FieldParser<mlir::IntegerType>::parse(odsParser);
1153 if (::mlir::failed(_result_type)) {
1154 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeDefaultValuedType parameter 'type' which is to be a `mlir::IntegerType`");
1155 return {};
1156 }
1157 // Parse literal ')'
1158 if (odsParser.parseRParen()) return {};
1159 }
1160 // Parse literal '>'
1161 if (odsParser.parseGreater()) return {};
1162 return TestTypeDefaultValuedTypeType::get(odsParser.getContext(),
1163 mlir::IntegerType((_result_type.value_or(mlir::IntegerType::get(odsParser.getContext(), 32)))));
1164}
1165
1166void TestTypeDefaultValuedTypeType::print(::mlir::AsmPrinter &odsPrinter) const {
1167 ::mlir::Builder odsBuilder(getContext());
1168 odsPrinter << "<";
1169 if (!(getType() == mlir::IntegerType::get(getContext(), 32))) {
1170 odsPrinter << "(";
1171 if (!(getType() == mlir::IntegerType::get(getContext(), 32))) {
1172 odsPrinter.printStrippedAttrOrType(getType());
1173 }
1174 odsPrinter << ")";
1175 } else {
1176 }
1177 odsPrinter << ">";
1178}
1179
1180mlir::IntegerType TestTypeDefaultValuedTypeType::getType() const {
1181 return getImpl()->type;
1182}
1183
1184} // namespace test
1185MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeDefaultValuedTypeType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeDefaultValuedTypeType>::id = {}; } }
1186namespace test {
1187namespace detail {
1188struct TestTypeElseAnchorTypeStorage : public ::mlir::TypeStorage {
1189 using KeyTy = std::tuple<mlir::Optional<int>>;
1190 TestTypeElseAnchorTypeStorage(mlir::Optional<int> a) : a(a) {}
1191
1192 bool operator==(const KeyTy &tblgenKey) const {
1193 return (a == std::get<0>(tblgenKey));
1194 }
1195
1196 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1197 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1198 }
1199
1200 static TestTypeElseAnchorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1201 auto a = std::get<0>(tblgenKey);
1202 return new (allocator.allocate<TestTypeElseAnchorTypeStorage>()) TestTypeElseAnchorTypeStorage(a);
1203 }
1204
1205 mlir::Optional<int> a;
1206};
1207} // namespace detail
1208TestTypeElseAnchorType TestTypeElseAnchorType::get(::mlir::MLIRContext *context, mlir::Optional<int> a) {
1209 return Base::get(context, a);
1210}
1211
1212::mlir::Type TestTypeElseAnchorType::parse(::mlir::AsmParser &odsParser) {
1213 ::mlir::Builder odsBuilder(odsParser.getContext());
1214 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1215 (void) odsLoc;
1216 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1217 // Parse literal '<'
1218 if (odsParser.parseLess()) return {};
1219 // Parse literal '?'
1220 if (odsParser.parseOptionalQuestion()) {
1221
1222 // Parse variable 'a'
1223 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1224 if (::mlir::failed(_result_a)) {
1225 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeElseAnchor parameter 'a' which is to be a `mlir::Optional<int>`");
1226 return {};
1227 }
1228 } else {
1229 }
1230 // Parse literal '>'
1231 if (odsParser.parseGreater()) return {};
1232 return TestTypeElseAnchorType::get(odsParser.getContext(),
1233 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))));
1234}
1235
1236void TestTypeElseAnchorType::print(::mlir::AsmPrinter &odsPrinter) const {
1237 ::mlir::Builder odsBuilder(getContext());
1238 odsPrinter << "<";
1239 if (!(!(getA() == mlir::Optional<int>()))) {
1240 odsPrinter << "?";
1241 } else {
1242 if (!(getA() == mlir::Optional<int>())) {
1243 odsPrinter.printStrippedAttrOrType(getA());
1244 }
1245 }
1246 odsPrinter << ">";
1247}
1248
1249mlir::Optional<int> TestTypeElseAnchorType::getA() const {
1250 return getImpl()->a;
1251}
1252
1253} // namespace test
1254MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeElseAnchorType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeElseAnchorType>::id = {}; } }
1255namespace test {
1256namespace detail {
1257struct TestTypeElseAnchorStructTypeStorage : public ::mlir::TypeStorage {
1258 using KeyTy = std::tuple<mlir::Optional<int>, mlir::Optional<int>>;
1259 TestTypeElseAnchorStructTypeStorage(mlir::Optional<int> a, mlir::Optional<int> b) : a(a), b(b) {}
1260
1261 bool operator==(const KeyTy &tblgenKey) const {
1262 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1263 }
1264
1265 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1266 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1267 }
1268
1269 static TestTypeElseAnchorStructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1270 auto a = std::get<0>(tblgenKey);
1271 auto b = std::get<1>(tblgenKey);
1272 return new (allocator.allocate<TestTypeElseAnchorStructTypeStorage>()) TestTypeElseAnchorStructTypeStorage(a, b);
1273 }
1274
1275 mlir::Optional<int> a;
1276 mlir::Optional<int> b;
1277};
1278} // namespace detail
1279TestTypeElseAnchorStructType TestTypeElseAnchorStructType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, mlir::Optional<int> b) {
1280 return Base::get(context, a, b);
1281}
1282
1283::mlir::Type TestTypeElseAnchorStructType::parse(::mlir::AsmParser &odsParser) {
1284 ::mlir::Builder odsBuilder(odsParser.getContext());
1285 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1286 (void) odsLoc;
1287 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1288 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
1289 // Parse literal '<'
1290 if (odsParser.parseLess()) return {};
1291 // Parse literal '?'
1292 if (odsParser.parseOptionalQuestion()) {
1293 // Parse parameter struct
1294 bool _seen_a = false;
1295 bool _seen_b = false;
1296 {
1297 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1298 // Parse literal '='
1299 if (odsParser.parseEqual()) return {};
1300 if (!_seen_a && _paramKey == "a") {
1301 _seen_a = true;
1302
1303 // Parse variable 'a'
1304 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1305 if (::mlir::failed(_result_a)) {
1306 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeElseAnchorStruct parameter 'a' which is to be a `mlir::Optional<int>`");
1307 return {};
1308 }
1309 } else if (!_seen_b && _paramKey == "b") {
1310 _seen_b = true;
1311
1312 // Parse variable 'b'
1313 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1314 if (::mlir::failed(_result_b)) {
1315 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeElseAnchorStruct parameter 'b' which is to be a `mlir::Optional<int>`");
1316 return {};
1317 }
1318 } else {
1319 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1320 return {};
1321 }
1322 return true;
1323 };
1324 ::llvm::StringRef _paramKey;
1325 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
1326 if (!_loop_body(_paramKey)) return {};
1327 while (!odsParser.parseOptionalComma()) {
1328 ::llvm::StringRef _paramKey;
1329 if (odsParser.parseKeyword(&_paramKey)) {
1330 odsParser.emitError(odsParser.getCurrentLocation(),
1331 "expected a parameter name in struct");
1332 return {};
1333 }
1334 if (!_loop_body(_paramKey)) return {};
1335 }
1336 }
1337 }
1338 } else {
1339 }
1340 // Parse literal '>'
1341 if (odsParser.parseGreater()) return {};
1342 return TestTypeElseAnchorStructType::get(odsParser.getContext(),
1343 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
1344 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
1345}
1346
1347void TestTypeElseAnchorStructType::print(::mlir::AsmPrinter &odsPrinter) const {
1348 ::mlir::Builder odsBuilder(getContext());
1349 odsPrinter << "<";
1350 if (!(!(getA() == mlir::Optional<int>()) || !(getB() == mlir::Optional<int>()))) {
1351 odsPrinter << "?";
1352 } else {
1353 {
1354 bool _firstPrinted = true;
1355 if (!(getA() == mlir::Optional<int>())) {
1356 if (!_firstPrinted) odsPrinter << ", ";
1357 _firstPrinted = false;
1358 odsPrinter << "a = ";
1359 if (!(getA() == mlir::Optional<int>())) {
1360 odsPrinter.printStrippedAttrOrType(getA());
1361 }
1362 }
1363 if (!(getB() == mlir::Optional<int>())) {
1364 if (!_firstPrinted) odsPrinter << ", ";
1365 _firstPrinted = false;
1366 odsPrinter << "b = ";
1367 if (!(getB() == mlir::Optional<int>())) {
1368 odsPrinter.printStrippedAttrOrType(getB());
1369 }
1370 }
1371 }
1372 }
1373 odsPrinter << ">";
1374}
1375
1376mlir::Optional<int> TestTypeElseAnchorStructType::getA() const {
1377 return getImpl()->a;
1378}
1379
1380mlir::Optional<int> TestTypeElseAnchorStructType::getB() const {
1381 return getImpl()->b;
1382}
1383
1384} // namespace test
1385MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeElseAnchorStructType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeElseAnchorStructType>::id = {}; } }
1386namespace test {
1387namespace detail {
1388struct TestTypeNoParserTypeStorage : public ::mlir::TypeStorage {
1389 using KeyTy = std::tuple<uint32_t, ::llvm::ArrayRef<int64_t>, ::llvm::StringRef, ::test::CustomParam>;
1390 TestTypeNoParserTypeStorage(uint32_t one, ::llvm::ArrayRef<int64_t> two, ::llvm::StringRef three, ::test::CustomParam four) : one(one), two(two), three(three), four(four) {}
1391
1392 bool operator==(const KeyTy &tblgenKey) const {
1393 return (one == std::get<0>(tblgenKey)) && (two == std::get<1>(tblgenKey)) && (three == std::get<2>(tblgenKey)) && (four == std::get<3>(tblgenKey));
1394 }
1395
1396 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1397 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
1398 }
1399
1400 static TestTypeNoParserTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1401 auto one = std::get<0>(tblgenKey);
1402 auto two = std::get<1>(tblgenKey);
1403 auto three = std::get<2>(tblgenKey);
1404 auto four = std::get<3>(tblgenKey);
1405 two = allocator.copyInto(two);
1406 three = allocator.copyInto(three);
1407 return new (allocator.allocate<TestTypeNoParserTypeStorage>()) TestTypeNoParserTypeStorage(one, two, three, four);
1408 }
1409
1410 uint32_t one;
1411 ::llvm::ArrayRef<int64_t> two;
1412 ::llvm::StringRef three;
1413 ::test::CustomParam four;
1414};
1415} // namespace detail
1416TestTypeNoParserType TestTypeNoParserType::get(::mlir::MLIRContext *context, uint32_t one, ::llvm::ArrayRef<int64_t> two, ::llvm::StringRef three, ::test::CustomParam four) {
1417 return Base::get(context, one, two, three, four);
1418}
1419
1420::mlir::Type TestTypeNoParserType::parse(::mlir::AsmParser &odsParser) {
1421 ::mlir::Builder odsBuilder(odsParser.getContext());
1422 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1423 (void) odsLoc;
1424 ::mlir::FailureOr<uint32_t> _result_one;
1425 ::mlir::FailureOr<::llvm::SmallVector<int64_t>> _result_two;
1426 ::mlir::FailureOr<std::string> _result_three;
1427 ::mlir::FailureOr<::test::CustomParam> _result_four;
1428 // Parse literal '<'
1429 if (odsParser.parseLess()) return {};
1430
1431 // Parse variable 'one'
1432 _result_one = ::mlir::FieldParser<uint32_t>::parse(odsParser);
1433 if (::mlir::failed(_result_one)) {
1434 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeNoParser parameter 'one' which is to be a `uint32_t`");
1435 return {};
1436 }
1437 // Parse literal ','
1438 if (odsParser.parseComma()) return {};
1439 // Parse literal '['
1440 if (odsParser.parseLSquare()) return {};
1441
1442 // Parse variable 'two'
1443 _result_two = ::mlir::FieldParser<::llvm::SmallVector<int64_t>>::parse(odsParser);
1444 if (::mlir::failed(_result_two)) {
1445 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeNoParser parameter 'two' which is to be a `::llvm::ArrayRef<int64_t>`");
1446 return {};
1447 }
1448 // Parse literal ']'
1449 if (odsParser.parseRSquare()) return {};
1450 // Parse literal ','
1451 if (odsParser.parseComma()) return {};
1452
1453 // Parse variable 'three'
1454 _result_three = ::mlir::FieldParser<std::string>::parse(odsParser);
1455 if (::mlir::failed(_result_three)) {
1456 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeNoParser parameter 'three' which is to be a `::llvm::StringRef`");
1457 return {};
1458 }
1459 // Parse literal ','
1460 if (odsParser.parseComma()) return {};
1461
1462 // Parse variable 'four'
1463 _result_four = ::mlir::FieldParser<::test::CustomParam>::parse(odsParser);
1464 if (::mlir::failed(_result_four)) {
1465 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeNoParser parameter 'four' which is to be a `::test::CustomParam`");
1466 return {};
1467 }
1468 // Parse literal '>'
1469 if (odsParser.parseGreater()) return {};
1470 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/TestTypeDefs.cpp.inc"
, 1470, __extension__ __PRETTY_FUNCTION__))
;
1471 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/TestTypeDefs.cpp.inc"
, 1471, __extension__ __PRETTY_FUNCTION__))
;
1472 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/TestTypeDefs.cpp.inc", 1472
, __extension__ __PRETTY_FUNCTION__))
;
1473 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/TestTypeDefs.cpp.inc", 1473
, __extension__ __PRETTY_FUNCTION__))
;
1474 return TestTypeNoParserType::get(odsParser.getContext(),
1475 uint32_t((*_result_one)),
1476 ::llvm::ArrayRef<int64_t>((*_result_two)),
1477 ::llvm::StringRef((*_result_three)),
1478 ::test::CustomParam((*_result_four)));
1479}
1480
1481void TestTypeNoParserType::print(::mlir::AsmPrinter &odsPrinter) const {
1482 ::mlir::Builder odsBuilder(getContext());
1483 odsPrinter << "<";
1484 odsPrinter.printStrippedAttrOrType(getOne());
1485 odsPrinter << ",";
1486 odsPrinter << ' ' << "[";
1487 odsPrinter.printStrippedAttrOrType(getTwo());
1488 odsPrinter << "]";
1489 odsPrinter << ",";
1490 odsPrinter << ' ';
1491 odsPrinter << '"' << getThree() << '"';;
1492 odsPrinter << ",";
1493 odsPrinter << ' ';
1494 odsPrinter.printStrippedAttrOrType(getFour());
1495 odsPrinter << ">";
1496}
1497
1498uint32_t TestTypeNoParserType::getOne() const {
1499 return getImpl()->one;
1500}
1501
1502::llvm::ArrayRef<int64_t> TestTypeNoParserType::getTwo() const {
1503 return getImpl()->two;
1504}
1505
1506::llvm::StringRef TestTypeNoParserType::getThree() const {
1507 return getImpl()->three;
1508}
1509
1510::test::CustomParam TestTypeNoParserType::getFour() const {
1511 return getImpl()->four;
1512}
1513
1514} // namespace test
1515MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeNoParserType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeNoParserType>::id = {}; } }
1516namespace test {
1517namespace detail {
1518struct TestTypeOptionalGroupTypeStorage : public ::mlir::TypeStorage {
1519 using KeyTy = std::tuple<int, mlir::Optional<int>>;
1520 TestTypeOptionalGroupTypeStorage(int a, mlir::Optional<int> b) : a(a), b(b) {}
1521
1522 bool operator==(const KeyTy &tblgenKey) const {
1523 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1524 }
1525
1526 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1527 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1528 }
1529
1530 static TestTypeOptionalGroupTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1531 auto a = std::get<0>(tblgenKey);
1532 auto b = std::get<1>(tblgenKey);
1533 return new (allocator.allocate<TestTypeOptionalGroupTypeStorage>()) TestTypeOptionalGroupTypeStorage(a, b);
1534 }
1535
1536 int a;
1537 mlir::Optional<int> b;
1538};
1539} // namespace detail
1540TestTypeOptionalGroupType TestTypeOptionalGroupType::get(::mlir::MLIRContext *context, int a, mlir::Optional<int> b) {
1541 return Base::get(context, a, b);
1542}
1543
1544::mlir::Type TestTypeOptionalGroupType::parse(::mlir::AsmParser &odsParser) {
1545 ::mlir::Builder odsBuilder(odsParser.getContext());
1546 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1547 (void) odsLoc;
1548 ::mlir::FailureOr<int> _result_a;
1549 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
1550 // Parse literal '<'
1551 if (odsParser.parseLess()) return {};
1552 // Parse literal '('
1553 if (odsParser.parseOptionalLParen()) {
1554 // Parse literal 'x'
1555 if (odsParser.parseKeyword("x")) return {};
1556 } else {
1557
1558 // Parse variable 'b'
1559 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1560 if (::mlir::failed(_result_b)) {
1561 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroup parameter 'b' which is to be a `mlir::Optional<int>`");
1562 return {};
1563 }
1564 // Parse literal ')'
1565 if (odsParser.parseRParen()) return {};
1566 }
1567
1568 // Parse variable 'a'
1569 _result_a = ::mlir::FieldParser<int>::parse(odsParser);
1570 if (::mlir::failed(_result_a)) {
1571 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroup parameter 'a' which is to be a `int`");
1572 return {};
1573 }
1574 // Parse literal '>'
1575 if (odsParser.parseGreater()) return {};
1576 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/TestTypeDefs.cpp.inc"
, 1576, __extension__ __PRETTY_FUNCTION__))
;
1577 return TestTypeOptionalGroupType::get(odsParser.getContext(),
1578 int((*_result_a)),
1579 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
1580}
1581
1582void TestTypeOptionalGroupType::print(::mlir::AsmPrinter &odsPrinter) const {
1583 ::mlir::Builder odsBuilder(getContext());
1584 odsPrinter << "<";
1585 if (!(getB() == mlir::Optional<int>())) {
1586 odsPrinter << "(";
1587 if (!(getB() == mlir::Optional<int>())) {
1588 odsPrinter.printStrippedAttrOrType(getB());
1589 }
1590 odsPrinter << ")";
1591 } else {
1592 odsPrinter << "x";
1593 }
1594 odsPrinter << ' ';
1595 odsPrinter.printStrippedAttrOrType(getA());
1596 odsPrinter << ">";
1597}
1598
1599int TestTypeOptionalGroupType::getA() const {
1600 return getImpl()->a;
1601}
1602
1603mlir::Optional<int> TestTypeOptionalGroupType::getB() const {
1604 return getImpl()->b;
1605}
1606
1607} // namespace test
1608MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalGroupType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalGroupType>::id = {}; } }
1609namespace test {
1610namespace detail {
1611struct TestTypeOptionalGroupParamsTypeStorage : public ::mlir::TypeStorage {
1612 using KeyTy = std::tuple<mlir::Optional<int>, mlir::Optional<int>>;
1613 TestTypeOptionalGroupParamsTypeStorage(mlir::Optional<int> a, mlir::Optional<int> b) : a(a), b(b) {}
1614
1615 bool operator==(const KeyTy &tblgenKey) const {
1616 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1617 }
1618
1619 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1620 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1621 }
1622
1623 static TestTypeOptionalGroupParamsTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1624 auto a = std::get<0>(tblgenKey);
1625 auto b = std::get<1>(tblgenKey);
1626 return new (allocator.allocate<TestTypeOptionalGroupParamsTypeStorage>()) TestTypeOptionalGroupParamsTypeStorage(a, b);
1627 }
1628
1629 mlir::Optional<int> a;
1630 mlir::Optional<int> b;
1631};
1632} // namespace detail
1633TestTypeOptionalGroupParamsType TestTypeOptionalGroupParamsType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, mlir::Optional<int> b) {
1634 return Base::get(context, a, b);
1635}
1636
1637::mlir::Type TestTypeOptionalGroupParamsType::parse(::mlir::AsmParser &odsParser) {
1638 ::mlir::Builder odsBuilder(odsParser.getContext());
1639 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1640 (void) odsLoc;
1641 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1642 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
1643 // Parse literal '<'
1644 if (odsParser.parseLess()) return {};
1645 // Parse literal '('
1646 if (odsParser.parseOptionalLParen()) {
1647 // Parse literal 'x'
1648 if (odsParser.parseKeyword("x")) return {};
1649 } else {
1650 // Parse parameter list
1651 do {
1652
1653 // Parse variable 'a'
1654 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1655 if (::mlir::failed(_result_a)) {
1656 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroupParams parameter 'a' which is to be a `mlir::Optional<int>`");
1657 return {};
1658 }
1659 if (::mlir::succeeded(_result_a) && !((*_result_a) == 10)) {
1660 // Parse literal ','
1661 if (odsParser.parseOptionalComma()) break;
1662 }
1663
1664 // Parse variable 'b'
1665 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1666 if (::mlir::failed(_result_b)) {
1667 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroupParams parameter 'b' which is to be a `mlir::Optional<int>`");
1668 return {};
1669 }
1670 } while(false);
1671 // Parse literal ')'
1672 if (odsParser.parseRParen()) return {};
1673 }
1674 // Parse literal '>'
1675 if (odsParser.parseGreater()) return {};
1676 return TestTypeOptionalGroupParamsType::get(odsParser.getContext(),
1677 mlir::Optional<int>((_result_a.value_or(10))),
1678 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
1679}
1680
1681void TestTypeOptionalGroupParamsType::print(::mlir::AsmPrinter &odsPrinter) const {
1682 ::mlir::Builder odsBuilder(getContext());
1683 odsPrinter << "<";
1684 if (!(getA() == 10) || !(getB() == mlir::Optional<int>())) {
1685 odsPrinter << "(";
1686 {
1687 bool _firstPrinted = true;
1688 if (!(getA() == 10)) {
1689 if (!_firstPrinted) odsPrinter << ", ";
1690 _firstPrinted = false;
1691 if (!(getA() == 10)) {
1692 odsPrinter.printStrippedAttrOrType(getA());
1693 }
1694 }
1695 if (!(getB() == mlir::Optional<int>())) {
1696 if (!_firstPrinted) odsPrinter << ", ";
1697 _firstPrinted = false;
1698 if (!(getB() == mlir::Optional<int>())) {
1699 odsPrinter.printStrippedAttrOrType(getB());
1700 }
1701 }
1702 }
1703 odsPrinter << ")";
1704 } else {
1705 odsPrinter << "x";
1706 }
1707 odsPrinter << ">";
1708}
1709
1710mlir::Optional<int> TestTypeOptionalGroupParamsType::getA() const {
1711 return getImpl()->a;
1712}
1713
1714mlir::Optional<int> TestTypeOptionalGroupParamsType::getB() const {
1715 return getImpl()->b;
1716}
1717
1718} // namespace test
1719MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalGroupParamsType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalGroupParamsType>::id = {}; } }
1720namespace test {
1721namespace detail {
1722struct TestTypeOptionalGroupStructTypeStorage : public ::mlir::TypeStorage {
1723 using KeyTy = std::tuple<mlir::Optional<int>, mlir::Optional<int>>;
1724 TestTypeOptionalGroupStructTypeStorage(mlir::Optional<int> a, mlir::Optional<int> b) : a(a), b(b) {}
1725
1726 bool operator==(const KeyTy &tblgenKey) const {
1727 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1728 }
1729
1730 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1731 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1732 }
1733
1734 static TestTypeOptionalGroupStructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1735 auto a = std::get<0>(tblgenKey);
1736 auto b = std::get<1>(tblgenKey);
1737 return new (allocator.allocate<TestTypeOptionalGroupStructTypeStorage>()) TestTypeOptionalGroupStructTypeStorage(a, b);
1738 }
1739
1740 mlir::Optional<int> a;
1741 mlir::Optional<int> b;
1742};
1743} // namespace detail
1744TestTypeOptionalGroupStructType TestTypeOptionalGroupStructType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, mlir::Optional<int> b) {
1745 return Base::get(context, a, b);
1746}
1747
1748::mlir::Type TestTypeOptionalGroupStructType::parse(::mlir::AsmParser &odsParser) {
1749 ::mlir::Builder odsBuilder(odsParser.getContext());
1750 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1751 (void) odsLoc;
1752 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1753 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
1754 // Parse literal '<'
1755 if (odsParser.parseLess()) return {};
1756 // Parse literal '('
1757 if (odsParser.parseOptionalLParen()) {
1758 // Parse literal 'x'
1759 if (odsParser.parseKeyword("x")) return {};
1760 } else {
1761 // Parse parameter struct
1762 bool _seen_a = false;
1763 bool _seen_b = false;
1764 {
1765 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1766 // Parse literal '='
1767 if (odsParser.parseEqual()) return {};
1768 if (!_seen_a && _paramKey == "a") {
1769 _seen_a = true;
1770
1771 // Parse variable 'a'
1772 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1773 if (::mlir::failed(_result_a)) {
1774 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroupStruct parameter 'a' which is to be a `mlir::Optional<int>`");
1775 return {};
1776 }
1777 } else if (!_seen_b && _paramKey == "b") {
1778 _seen_b = true;
1779
1780 // Parse variable 'b'
1781 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1782 if (::mlir::failed(_result_b)) {
1783 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalGroupStruct parameter 'b' which is to be a `mlir::Optional<int>`");
1784 return {};
1785 }
1786 } else {
1787 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1788 return {};
1789 }
1790 return true;
1791 };
1792 ::llvm::StringRef _paramKey;
1793 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
1794 if (!_loop_body(_paramKey)) return {};
1795 while (!odsParser.parseOptionalComma()) {
1796 ::llvm::StringRef _paramKey;
1797 if (odsParser.parseKeyword(&_paramKey)) {
1798 odsParser.emitError(odsParser.getCurrentLocation(),
1799 "expected a parameter name in struct");
1800 return {};
1801 }
1802 if (!_loop_body(_paramKey)) return {};
1803 }
1804 }
1805 }
1806 // Parse literal ')'
1807 if (odsParser.parseRParen()) return {};
1808 }
1809 // Parse literal '>'
1810 if (odsParser.parseGreater()) return {};
1811 return TestTypeOptionalGroupStructType::get(odsParser.getContext(),
1812 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
1813 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
1814}
1815
1816void TestTypeOptionalGroupStructType::print(::mlir::AsmPrinter &odsPrinter) const {
1817 ::mlir::Builder odsBuilder(getContext());
1818 odsPrinter << "<";
1819 if (!(getA() == mlir::Optional<int>()) || !(getB() == mlir::Optional<int>())) {
1820 odsPrinter << "(";
1821 {
1822 bool _firstPrinted = true;
1823 if (!(getA() == mlir::Optional<int>())) {
1824 if (!_firstPrinted) odsPrinter << ", ";
1825 _firstPrinted = false;
1826 odsPrinter << "a = ";
1827 if (!(getA() == mlir::Optional<int>())) {
1828 odsPrinter.printStrippedAttrOrType(getA());
1829 }
1830 }
1831 if (!(getB() == mlir::Optional<int>())) {
1832 if (!_firstPrinted) odsPrinter << ", ";
1833 _firstPrinted = false;
1834 odsPrinter << "b = ";
1835 if (!(getB() == mlir::Optional<int>())) {
1836 odsPrinter.printStrippedAttrOrType(getB());
1837 }
1838 }
1839 }
1840 odsPrinter << ")";
1841 } else {
1842 odsPrinter << "x";
1843 }
1844 odsPrinter << ">";
1845}
1846
1847mlir::Optional<int> TestTypeOptionalGroupStructType::getA() const {
1848 return getImpl()->a;
1849}
1850
1851mlir::Optional<int> TestTypeOptionalGroupStructType::getB() const {
1852 return getImpl()->b;
1853}
1854
1855} // namespace test
1856MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalGroupStructType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalGroupStructType>::id = {}; } }
1857namespace test {
1858namespace detail {
1859struct TestTypeOptionalParamTypeStorage : public ::mlir::TypeStorage {
1860 using KeyTy = std::tuple<mlir::Optional<int>, int>;
1861 TestTypeOptionalParamTypeStorage(mlir::Optional<int> a, int b) : a(a), b(b) {}
1862
1863 bool operator==(const KeyTy &tblgenKey) const {
1864 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1865 }
1866
1867 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1868 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1869 }
1870
1871 static TestTypeOptionalParamTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1872 auto a = std::get<0>(tblgenKey);
1873 auto b = std::get<1>(tblgenKey);
1874 return new (allocator.allocate<TestTypeOptionalParamTypeStorage>()) TestTypeOptionalParamTypeStorage(a, b);
1875 }
1876
1877 mlir::Optional<int> a;
1878 int b;
1879};
1880} // namespace detail
1881TestTypeOptionalParamType TestTypeOptionalParamType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, int b) {
1882 return Base::get(context, a, b);
1883}
1884
1885::mlir::Type TestTypeOptionalParamType::parse(::mlir::AsmParser &odsParser) {
1886 ::mlir::Builder odsBuilder(odsParser.getContext());
1887 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1888 (void) odsLoc;
1889 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1890 ::mlir::FailureOr<int> _result_b;
1891 // Parse literal '<'
1892 if (odsParser.parseLess()) return {};
1893
1894 // Parse variable 'a'
1895 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1896 if (::mlir::failed(_result_a)) {
1897 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParam parameter 'a' which is to be a `mlir::Optional<int>`");
1898 return {};
1899 }
1900 // Parse literal ','
1901 if (odsParser.parseComma()) return {};
1902
1903 // Parse variable 'b'
1904 _result_b = ::mlir::FieldParser<int>::parse(odsParser);
1905 if (::mlir::failed(_result_b)) {
1906 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParam parameter 'b' which is to be a `int`");
1907 return {};
1908 }
1909 // Parse literal '>'
1910 if (odsParser.parseGreater()) return {};
1911 assert(::mlir::succeeded(_result_b))(static_cast <bool> (::mlir::succeeded(_result_b)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_b)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 1911, __extension__ __PRETTY_FUNCTION__))
;
1912 return TestTypeOptionalParamType::get(odsParser.getContext(),
1913 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
1914 int((*_result_b)));
1915}
1916
1917void TestTypeOptionalParamType::print(::mlir::AsmPrinter &odsPrinter) const {
1918 ::mlir::Builder odsBuilder(getContext());
1919 odsPrinter << "<";
1920 if (!(getA() == mlir::Optional<int>())) {
1921 odsPrinter.printStrippedAttrOrType(getA());
1922 }
1923 odsPrinter << ",";
1924 odsPrinter << ' ';
1925 odsPrinter.printStrippedAttrOrType(getB());
1926 odsPrinter << ">";
1927}
1928
1929mlir::Optional<int> TestTypeOptionalParamType::getA() const {
1930 return getImpl()->a;
1931}
1932
1933int TestTypeOptionalParamType::getB() const {
1934 return getImpl()->b;
1935}
1936
1937} // namespace test
1938MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalParamType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalParamType>::id = {}; } }
1939namespace test {
1940namespace detail {
1941struct TestTypeOptionalParamsTypeStorage : public ::mlir::TypeStorage {
1942 using KeyTy = std::tuple<mlir::Optional<int>, ::llvm::StringRef>;
1943 TestTypeOptionalParamsTypeStorage(mlir::Optional<int> a, ::llvm::StringRef b) : a(a), b(b) {}
1944
1945 bool operator==(const KeyTy &tblgenKey) const {
1946 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
1947 }
1948
1949 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1950 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1951 }
1952
1953 static TestTypeOptionalParamsTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1954 auto a = std::get<0>(tblgenKey);
1955 auto b = std::get<1>(tblgenKey);
1956 b = allocator.copyInto(b);
1957 return new (allocator.allocate<TestTypeOptionalParamsTypeStorage>()) TestTypeOptionalParamsTypeStorage(a, b);
1958 }
1959
1960 mlir::Optional<int> a;
1961 ::llvm::StringRef b;
1962};
1963} // namespace detail
1964TestTypeOptionalParamsType TestTypeOptionalParamsType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, ::llvm::StringRef b) {
1965 return Base::get(context, a, b);
1966}
1967
1968::mlir::Type TestTypeOptionalParamsType::parse(::mlir::AsmParser &odsParser) {
1969 ::mlir::Builder odsBuilder(odsParser.getContext());
1970 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1971 (void) odsLoc;
1972 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
1973 ::mlir::FailureOr<std::string> _result_b;
1974 // Parse literal '<'
1975 if (odsParser.parseLess()) return {};
1976 // Parse parameter list
1977 do {
1978
1979 // Parse variable 'a'
1980 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
1981 if (::mlir::failed(_result_a)) {
1982 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParams parameter 'a' which is to be a `mlir::Optional<int>`");
1983 return {};
1984 }
1985 if (::mlir::succeeded(_result_a) && !((*_result_a) == mlir::Optional<int>())) {
1986 // Parse literal ','
1987 if (odsParser.parseComma()) return {};
1988 }
1989
1990 // Parse variable 'b'
1991 _result_b = ::mlir::FieldParser<std::string>::parse(odsParser);
1992 if (::mlir::failed(_result_b)) {
1993 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParams parameter 'b' which is to be a `::llvm::StringRef`");
1994 return {};
1995 }
1996 } while(false);
1997 // Parse literal '>'
1998 if (odsParser.parseGreater()) return {};
1999 assert(::mlir::succeeded(_result_b))(static_cast <bool> (::mlir::succeeded(_result_b)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_b)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 1999, __extension__ __PRETTY_FUNCTION__))
;
2000 return TestTypeOptionalParamsType::get(odsParser.getContext(),
2001 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
2002 ::llvm::StringRef((*_result_b)));
2003}
2004
2005void TestTypeOptionalParamsType::print(::mlir::AsmPrinter &odsPrinter) const {
2006 ::mlir::Builder odsBuilder(getContext());
2007 odsPrinter << "<";
2008 {
2009 bool _firstPrinted = true;
2010 if (!(getA() == mlir::Optional<int>())) {
2011 if (!_firstPrinted) odsPrinter << ", ";
2012 _firstPrinted = false;
2013 if (!(getA() == mlir::Optional<int>())) {
2014 odsPrinter.printStrippedAttrOrType(getA());
2015 }
2016 }
2017 if (!_firstPrinted) odsPrinter << ", ";
2018 _firstPrinted = false;
2019 odsPrinter << '"' << getB() << '"';;
2020 }
2021 odsPrinter << ">";
2022}
2023
2024mlir::Optional<int> TestTypeOptionalParamsType::getA() const {
2025 return getImpl()->a;
2026}
2027
2028::llvm::StringRef TestTypeOptionalParamsType::getB() const {
2029 return getImpl()->b;
2030}
2031
2032} // namespace test
2033MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalParamsType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalParamsType>::id = {}; } }
2034namespace test {
2035namespace detail {
2036struct TestTypeOptionalParamsAfterRequiredTypeStorage : public ::mlir::TypeStorage {
2037 using KeyTy = std::tuple<::llvm::StringRef, mlir::Optional<int>>;
2038 TestTypeOptionalParamsAfterRequiredTypeStorage(::llvm::StringRef a, mlir::Optional<int> b) : a(a), b(b) {}
2039
2040 bool operator==(const KeyTy &tblgenKey) const {
2041 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
2042 }
2043
2044 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2045 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
2046 }
2047
2048 static TestTypeOptionalParamsAfterRequiredTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2049 auto a = std::get<0>(tblgenKey);
2050 auto b = std::get<1>(tblgenKey);
2051 a = allocator.copyInto(a);
2052 return new (allocator.allocate<TestTypeOptionalParamsAfterRequiredTypeStorage>()) TestTypeOptionalParamsAfterRequiredTypeStorage(a, b);
2053 }
2054
2055 ::llvm::StringRef a;
2056 mlir::Optional<int> b;
2057};
2058} // namespace detail
2059TestTypeOptionalParamsAfterRequiredType TestTypeOptionalParamsAfterRequiredType::get(::mlir::MLIRContext *context, ::llvm::StringRef a, mlir::Optional<int> b) {
2060 return Base::get(context, a, b);
2061}
2062
2063::mlir::Type TestTypeOptionalParamsAfterRequiredType::parse(::mlir::AsmParser &odsParser) {
2064 ::mlir::Builder odsBuilder(odsParser.getContext());
2065 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2066 (void) odsLoc;
2067 ::mlir::FailureOr<std::string> _result_a;
2068 ::mlir::FailureOr<mlir::Optional<int>> _result_b;
2069 // Parse literal '<'
2070 if (odsParser.parseLess()) return {};
2071 // Parse parameter list
2072 do {
2073
2074 // Parse variable 'a'
2075 _result_a = ::mlir::FieldParser<std::string>::parse(odsParser);
2076 if (::mlir::failed(_result_a)) {
2077 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParamsAfterRequired parameter 'a' which is to be a `::llvm::StringRef`");
2078 return {};
2079 }
2080 // Parse literal ','
2081 if (odsParser.parseOptionalComma()) break;
2082
2083 // Parse variable 'b'
2084 _result_b = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
2085 if (::mlir::failed(_result_b)) {
2086 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalParamsAfterRequired parameter 'b' which is to be a `mlir::Optional<int>`");
2087 return {};
2088 }
2089 } while(false);
2090 // Parse literal '>'
2091 if (odsParser.parseGreater()) return {};
2092 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/TestTypeDefs.cpp.inc"
, 2092, __extension__ __PRETTY_FUNCTION__))
;
2093 return TestTypeOptionalParamsAfterRequiredType::get(odsParser.getContext(),
2094 ::llvm::StringRef((*_result_a)),
2095 mlir::Optional<int>((_result_b.value_or(mlir::Optional<int>()))));
2096}
2097
2098void TestTypeOptionalParamsAfterRequiredType::print(::mlir::AsmPrinter &odsPrinter) const {
2099 ::mlir::Builder odsBuilder(getContext());
2100 odsPrinter << "<";
2101 {
2102 bool _firstPrinted = true;
2103 if (!_firstPrinted) odsPrinter << ", ";
2104 _firstPrinted = false;
2105 odsPrinter << '"' << getA() << '"';;
2106 if (!(getB() == mlir::Optional<int>())) {
2107 if (!_firstPrinted) odsPrinter << ", ";
2108 _firstPrinted = false;
2109 if (!(getB() == mlir::Optional<int>())) {
2110 odsPrinter.printStrippedAttrOrType(getB());
2111 }
2112 }
2113 }
2114 odsPrinter << ">";
2115}
2116
2117::llvm::StringRef TestTypeOptionalParamsAfterRequiredType::getA() const {
2118 return getImpl()->a;
2119}
2120
2121mlir::Optional<int> TestTypeOptionalParamsAfterRequiredType::getB() const {
2122 return getImpl()->b;
2123}
2124
2125} // namespace test
2126MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalParamsAfterRequiredType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalParamsAfterRequiredType>::id =
{}; } }
2127namespace test {
2128namespace detail {
2129struct TestTypeOptionalStructTypeStorage : public ::mlir::TypeStorage {
2130 using KeyTy = std::tuple<mlir::Optional<int>, ::llvm::StringRef>;
2131 TestTypeOptionalStructTypeStorage(mlir::Optional<int> a, ::llvm::StringRef b) : a(a), b(b) {}
2132
2133 bool operator==(const KeyTy &tblgenKey) const {
2134 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
2135 }
2136
2137 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2138 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
2139 }
2140
2141 static TestTypeOptionalStructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2142 auto a = std::get<0>(tblgenKey);
2143 auto b = std::get<1>(tblgenKey);
2144 b = allocator.copyInto(b);
2145 return new (allocator.allocate<TestTypeOptionalStructTypeStorage>()) TestTypeOptionalStructTypeStorage(a, b);
2146 }
2147
2148 mlir::Optional<int> a;
2149 ::llvm::StringRef b;
2150};
2151} // namespace detail
2152TestTypeOptionalStructType TestTypeOptionalStructType::get(::mlir::MLIRContext *context, mlir::Optional<int> a, ::llvm::StringRef b) {
2153 return Base::get(context, a, b);
2154}
2155
2156::mlir::Type TestTypeOptionalStructType::parse(::mlir::AsmParser &odsParser) {
2157 ::mlir::Builder odsBuilder(odsParser.getContext());
2158 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2159 (void) odsLoc;
2160 ::mlir::FailureOr<mlir::Optional<int>> _result_a;
2161 ::mlir::FailureOr<std::string> _result_b;
2162 // Parse literal '<'
2163 if (odsParser.parseLess()) return {};
2164 // Parse parameter struct
2165 bool _seen_a = false;
2166 bool _seen_b = false;
2167 {
2168 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2169 // Parse literal '='
2170 if (odsParser.parseEqual()) return {};
2171 if (!_seen_a && _paramKey == "a") {
2172 _seen_a = true;
2173
2174 // Parse variable 'a'
2175 _result_a = ::mlir::FieldParser<mlir::Optional<int>>::parse(odsParser);
2176 if (::mlir::failed(_result_a)) {
2177 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalStruct parameter 'a' which is to be a `mlir::Optional<int>`");
2178 return {};
2179 }
2180 } else if (!_seen_b && _paramKey == "b") {
2181 _seen_b = true;
2182
2183 // Parse variable 'b'
2184 _result_b = ::mlir::FieldParser<std::string>::parse(odsParser);
2185 if (::mlir::failed(_result_b)) {
2186 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeOptionalStruct parameter 'b' which is to be a `::llvm::StringRef`");
2187 return {};
2188 }
2189 } else {
2190 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2191 return {};
2192 }
2193 return true;
2194 };
2195 do {
2196 ::llvm::StringRef _paramKey;
2197 if (odsParser.parseKeyword(&_paramKey)) {
2198 odsParser.emitError(odsParser.getCurrentLocation(),
2199 "expected a parameter name in struct");
2200 return {};
2201 }
2202 if (!_loop_body(_paramKey)) return {};
2203 } while(!odsParser.parseOptionalComma());
2204 if (!_seen_b) {
2205 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "b";
2206 return {};
2207 }
2208 }
2209 // Parse literal '>'
2210 if (odsParser.parseGreater()) return {};
2211 assert(::mlir::succeeded(_result_b))(static_cast <bool> (::mlir::succeeded(_result_b)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_b)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 2211, __extension__ __PRETTY_FUNCTION__))
;
2212 return TestTypeOptionalStructType::get(odsParser.getContext(),
2213 mlir::Optional<int>((_result_a.value_or(mlir::Optional<int>()))),
2214 ::llvm::StringRef((*_result_b)));
2215}
2216
2217void TestTypeOptionalStructType::print(::mlir::AsmPrinter &odsPrinter) const {
2218 ::mlir::Builder odsBuilder(getContext());
2219 odsPrinter << "<";
2220 {
2221 bool _firstPrinted = true;
2222 if (!(getA() == mlir::Optional<int>())) {
2223 if (!_firstPrinted) odsPrinter << ", ";
2224 _firstPrinted = false;
2225 odsPrinter << "a = ";
2226 if (!(getA() == mlir::Optional<int>())) {
2227 odsPrinter.printStrippedAttrOrType(getA());
2228 }
2229 }
2230 if (!_firstPrinted) odsPrinter << ", ";
2231 _firstPrinted = false;
Value stored to '_firstPrinted' is never read
2232 odsPrinter << "b = ";
2233 odsPrinter << '"' << getB() << '"';;
2234 }
2235 odsPrinter << ">";
2236}
2237
2238mlir::Optional<int> TestTypeOptionalStructType::getA() const {
2239 return getImpl()->a;
2240}
2241
2242::llvm::StringRef TestTypeOptionalStructType::getB() const {
2243 return getImpl()->b;
2244}
2245
2246} // namespace test
2247MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeOptionalStructType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeOptionalStructType>::id = {}; } }
2248namespace test {
2249namespace detail {
2250struct TestTypeSpaceSTypeStorage : public ::mlir::TypeStorage {
2251 using KeyTy = std::tuple<int, int>;
2252 TestTypeSpaceSTypeStorage(int a, int b) : a(a), b(b) {}
2253
2254 bool operator==(const KeyTy &tblgenKey) const {
2255 return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey));
2256 }
2257
2258 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2259 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
2260 }
2261
2262 static TestTypeSpaceSTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2263 auto a = std::get<0>(tblgenKey);
2264 auto b = std::get<1>(tblgenKey);
2265 return new (allocator.allocate<TestTypeSpaceSTypeStorage>()) TestTypeSpaceSTypeStorage(a, b);
2266 }
2267
2268 int a;
2269 int b;
2270};
2271} // namespace detail
2272TestTypeSpaceSType TestTypeSpaceSType::get(::mlir::MLIRContext *context, int a, int b) {
2273 return Base::get(context, a, b);
2274}
2275
2276::mlir::Type TestTypeSpaceSType::parse(::mlir::AsmParser &odsParser) {
2277 ::mlir::Builder odsBuilder(odsParser.getContext());
2278 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2279 (void) odsLoc;
2280 ::mlir::FailureOr<int> _result_a;
2281 ::mlir::FailureOr<int> _result_b;
2282 // Parse literal '<'
2283 if (odsParser.parseLess()) return {};
2284
2285 // Parse variable 'a'
2286 _result_a = ::mlir::FieldParser<int>::parse(odsParser);
2287 if (::mlir::failed(_result_a)) {
2288 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeSpaces parameter 'a' which is to be a `int`");
2289 return {};
2290 }
2291 // Parse literal '('
2292 if (odsParser.parseLParen()) return {};
2293 // Parse literal ')'
2294 if (odsParser.parseRParen()) return {};
2295 // Parse literal '('
2296 if (odsParser.parseLParen()) return {};
2297 // Parse literal ')'
2298 if (odsParser.parseRParen()) return {};
2299
2300 // Parse variable 'b'
2301 _result_b = ::mlir::FieldParser<int>::parse(odsParser);
2302 if (::mlir::failed(_result_b)) {
2303 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeSpaces parameter 'b' which is to be a `int`");
2304 return {};
2305 }
2306 // Parse literal '>'
2307 if (odsParser.parseGreater()) return {};
2308 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/TestTypeDefs.cpp.inc"
, 2308, __extension__ __PRETTY_FUNCTION__))
;
2309 assert(::mlir::succeeded(_result_b))(static_cast <bool> (::mlir::succeeded(_result_b)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_b)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 2309, __extension__ __PRETTY_FUNCTION__))
;
2310 return TestTypeSpaceSType::get(odsParser.getContext(),
2311 int((*_result_a)),
2312 int((*_result_b)));
2313}
2314
2315void TestTypeSpaceSType::print(::mlir::AsmPrinter &odsPrinter) const {
2316 ::mlir::Builder odsBuilder(getContext());
2317 odsPrinter << "<";
2318 odsPrinter << " ";
2319 odsPrinter.printStrippedAttrOrType(getA());
2320 odsPrinter << '\n';
2321 odsPrinter << "(";
2322 odsPrinter << ")";
2323 odsPrinter << "(";
2324 odsPrinter << ")";
2325 odsPrinter << ' ';
2326 odsPrinter.printStrippedAttrOrType(getB());
2327 odsPrinter << ">";
2328}
2329
2330int TestTypeSpaceSType::getA() const {
2331 return getImpl()->a;
2332}
2333
2334int TestTypeSpaceSType::getB() const {
2335 return getImpl()->b;
2336}
2337
2338} // namespace test
2339MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeSpaceSType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeSpaceSType>::id = {}; } }
2340namespace test {
2341namespace detail {
2342struct TestStructTypeCaptureAllTypeStorage : public ::mlir::TypeStorage {
2343 using KeyTy = std::tuple<int, int, int, int>;
2344 TestStructTypeCaptureAllTypeStorage(int v0, int v1, int v2, int v3) : v0(v0), v1(v1), v2(v2), v3(v3) {}
2345
2346 bool operator==(const KeyTy &tblgenKey) const {
2347 return (v0 == std::get<0>(tblgenKey)) && (v1 == std::get<1>(tblgenKey)) && (v2 == std::get<2>(tblgenKey)) && (v3 == std::get<3>(tblgenKey));
2348 }
2349
2350 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2351 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
2352 }
2353
2354 static TestStructTypeCaptureAllTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2355 auto v0 = std::get<0>(tblgenKey);
2356 auto v1 = std::get<1>(tblgenKey);
2357 auto v2 = std::get<2>(tblgenKey);
2358 auto v3 = std::get<3>(tblgenKey);
2359 return new (allocator.allocate<TestStructTypeCaptureAllTypeStorage>()) TestStructTypeCaptureAllTypeStorage(v0, v1, v2, v3);
2360 }
2361
2362 int v0;
2363 int v1;
2364 int v2;
2365 int v3;
2366};
2367} // namespace detail
2368TestStructTypeCaptureAllType TestStructTypeCaptureAllType::get(::mlir::MLIRContext *context, int v0, int v1, int v2, int v3) {
2369 return Base::get(context, v0, v1, v2, v3);
2370}
2371
2372::mlir::Type TestStructTypeCaptureAllType::parse(::mlir::AsmParser &odsParser) {
2373 ::mlir::Builder odsBuilder(odsParser.getContext());
2374 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2375 (void) odsLoc;
2376 ::mlir::FailureOr<int> _result_v0;
2377 ::mlir::FailureOr<int> _result_v1;
2378 ::mlir::FailureOr<int> _result_v2;
2379 ::mlir::FailureOr<int> _result_v3;
2380 // Parse literal '<'
2381 if (odsParser.parseLess()) return {};
2382 // Parse parameter struct
2383 bool _seen_v0 = false;
2384 bool _seen_v1 = false;
2385 bool _seen_v2 = false;
2386 bool _seen_v3 = false;
2387 {
2388 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2389 // Parse literal '='
2390 if (odsParser.parseEqual()) return {};
2391 if (!_seen_v0 && _paramKey == "v0") {
2392 _seen_v0 = true;
2393
2394 // Parse variable 'v0'
2395 _result_v0 = ::mlir::FieldParser<int>::parse(odsParser);
2396 if (::mlir::failed(_result_v0)) {
2397 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeStructCaptureAll parameter 'v0' which is to be a `int`");
2398 return {};
2399 }
2400 } else if (!_seen_v1 && _paramKey == "v1") {
2401 _seen_v1 = true;
2402
2403 // Parse variable 'v1'
2404 _result_v1 = ::mlir::FieldParser<int>::parse(odsParser);
2405 if (::mlir::failed(_result_v1)) {
2406 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeStructCaptureAll parameter 'v1' which is to be a `int`");
2407 return {};
2408 }
2409 } else if (!_seen_v2 && _paramKey == "v2") {
2410 _seen_v2 = true;
2411
2412 // Parse variable 'v2'
2413 _result_v2 = ::mlir::FieldParser<int>::parse(odsParser);
2414 if (::mlir::failed(_result_v2)) {
2415 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeStructCaptureAll parameter 'v2' which is to be a `int`");
2416 return {};
2417 }
2418 } else if (!_seen_v3 && _paramKey == "v3") {
2419 _seen_v3 = true;
2420
2421 // Parse variable 'v3'
2422 _result_v3 = ::mlir::FieldParser<int>::parse(odsParser);
2423 if (::mlir::failed(_result_v3)) {
2424 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeStructCaptureAll parameter 'v3' which is to be a `int`");
2425 return {};
2426 }
2427 } else {
2428 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2429 return {};
2430 }
2431 return true;
2432 };
2433 for (unsigned odsStructIndex = 0; odsStructIndex < 4; ++odsStructIndex) {
2434 ::llvm::StringRef _paramKey;
2435 if (odsParser.parseKeyword(&_paramKey)) {
2436 odsParser.emitError(odsParser.getCurrentLocation(),
2437 "expected a parameter name in struct");
2438 return {};
2439 }
2440 if (!_loop_body(_paramKey)) return {};
2441 if ((odsStructIndex != 4 - 1) && odsParser.parseComma())
2442 return {};
2443 }
2444 }
2445 // Parse literal '>'
2446 if (odsParser.parseGreater()) return {};
2447 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/TestTypeDefs.cpp.inc"
, 2447, __extension__ __PRETTY_FUNCTION__))
;
2448 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/TestTypeDefs.cpp.inc"
, 2448, __extension__ __PRETTY_FUNCTION__))
;
2449 assert(::mlir::succeeded(_result_v2))(static_cast <bool> (::mlir::succeeded(_result_v2)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_v2)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 2449, __extension__ __PRETTY_FUNCTION__))
;
2450 assert(::mlir::succeeded(_result_v3))(static_cast <bool> (::mlir::succeeded(_result_v3)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_v3)", "tools/mlir/test/lib/Dialect/Test/TestTypeDefs.cpp.inc"
, 2450, __extension__ __PRETTY_FUNCTION__))
;
2451 return TestStructTypeCaptureAllType::get(odsParser.getContext(),
2452 int((*_result_v0)),
2453 int((*_result_v1)),
2454 int((*_result_v2)),
2455 int((*_result_v3)));
2456}
2457
2458void TestStructTypeCaptureAllType::print(::mlir::AsmPrinter &odsPrinter) const {
2459 ::mlir::Builder odsBuilder(getContext());
2460 odsPrinter << "<";
2461 {
2462 bool _firstPrinted = true;
2463 if (!_firstPrinted) odsPrinter << ", ";
2464 _firstPrinted = false;
2465 odsPrinter << "v0 = ";
2466 odsPrinter.printStrippedAttrOrType(getV0());
2467 if (!_firstPrinted) odsPrinter << ", ";
2468 _firstPrinted = false;
2469 odsPrinter << "v1 = ";
2470 odsPrinter.printStrippedAttrOrType(getV1());
2471 if (!_firstPrinted) odsPrinter << ", ";
2472 _firstPrinted = false;
2473 odsPrinter << "v2 = ";
2474 odsPrinter.printStrippedAttrOrType(getV2());
2475 if (!_firstPrinted) odsPrinter << ", ";
2476 _firstPrinted = false;
2477 odsPrinter << "v3 = ";
2478 odsPrinter.printStrippedAttrOrType(getV3());
2479 }
2480 odsPrinter << ">";
2481}
2482
2483int TestStructTypeCaptureAllType::getV0() const {
2484 return getImpl()->v0;
2485}
2486
2487int TestStructTypeCaptureAllType::getV1() const {
2488 return getImpl()->v1;
2489}
2490
2491int TestStructTypeCaptureAllType::getV2() const {
2492 return getImpl()->v2;
2493}
2494
2495int TestStructTypeCaptureAllType::getV3() const {
2496 return getImpl()->v3;
2497}
2498
2499} // namespace test
2500MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestStructTypeCaptureAllType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestStructTypeCaptureAllType>::id = {}; } }
2501namespace test {
2502namespace detail {
2503struct TestTypeWithFormatTypeStorage : public ::mlir::TypeStorage {
2504 using KeyTy = std::tuple<int64_t, std::string, ::mlir::Attribute>;
2505 TestTypeWithFormatTypeStorage(int64_t one, std::string two, ::mlir::Attribute three) : one(one), two(two), three(three) {}
2506
2507 bool operator==(const KeyTy &tblgenKey) const {
2508 return (one == std::get<0>(tblgenKey)) && (two == std::get<1>(tblgenKey)) && (three == std::get<2>(tblgenKey));
2509 }
2510
2511 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2512 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
2513 }
2514
2515 static TestTypeWithFormatTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2516 auto one = std::get<0>(tblgenKey);
2517 auto two = std::get<1>(tblgenKey);
2518 auto three = std::get<2>(tblgenKey);
2519 return new (allocator.allocate<TestTypeWithFormatTypeStorage>()) TestTypeWithFormatTypeStorage(one, two, three);
2520 }
2521
2522 int64_t one;
2523 std::string two;
2524 ::mlir::Attribute three;
2525};
2526} // namespace detail
2527TestTypeWithFormatType TestTypeWithFormatType::get(::mlir::MLIRContext *context, int64_t one, std::string two, ::mlir::Attribute three) {
2528 return Base::get(context, one, two, three);
2529}
2530
2531::mlir::Type TestTypeWithFormatType::parse(::mlir::AsmParser &odsParser) {
2532 ::mlir::Builder odsBuilder(odsParser.getContext());
2533 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2534 (void) odsLoc;
2535 ::mlir::FailureOr<int64_t> _result_one;
2536 ::mlir::FailureOr<std::string> _result_two;
2537 ::mlir::FailureOr<::mlir::Attribute> _result_three;
2538 // Parse literal '<'
2539 if (odsParser.parseLess()) return {};
2540
2541 // Parse variable 'one'
2542 _result_one = ::mlir::FieldParser<int64_t>::parse(odsParser);
2543 if (::mlir::failed(_result_one)) {
2544 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeWithFormat parameter 'one' which is to be a `int64_t`");
2545 return {};
2546 }
2547 // Parse literal ','
2548 if (odsParser.parseComma()) return {};
2549 // Parse parameter struct
2550 bool _seen_three = false;
2551 bool _seen_two = false;
2552 {
2553 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2554 // Parse literal '='
2555 if (odsParser.parseEqual()) return {};
2556 if (!_seen_three && _paramKey == "three") {
2557 _seen_three = true;
2558
2559 // Parse variable 'three'
2560 _result_three = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser);
2561 if (::mlir::failed(_result_three)) {
2562 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeWithFormat parameter 'three' which is to be a `::mlir::Attribute`");
2563 return {};
2564 }
2565 } else if (!_seen_two && _paramKey == "two") {
2566 _seen_two = true;
2567
2568 // Parse variable 'two'
2569 _result_two = ::mlir::FieldParser<std::string>::parse(odsParser);
2570 if (::mlir::failed(_result_two)) {
2571 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestTypeWithFormat parameter 'two' which is to be a `std::string`");
2572 return {};
2573 }
2574 } else {
2575 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2576 return {};
2577 }
2578 return true;
2579 };
2580 for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) {
2581 ::llvm::StringRef _paramKey;
2582 if (odsParser.parseKeyword(&_paramKey)) {
2583 odsParser.emitError(odsParser.getCurrentLocation(),
2584 "expected a parameter name in struct");
2585 return {};
2586 }
2587 if (!_loop_body(_paramKey)) return {};
2588 if ((odsStructIndex != 2 - 1) && odsParser.parseComma())
2589 return {};
2590 }
2591 }
2592 // Parse literal '>'
2593 if (odsParser.parseGreater()) return {};
2594 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/TestTypeDefs.cpp.inc"
, 2594, __extension__ __PRETTY_FUNCTION__))
;
2595 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/TestTypeDefs.cpp.inc"
, 2595, __extension__ __PRETTY_FUNCTION__))
;
2596 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/TestTypeDefs.cpp.inc", 2596
, __extension__ __PRETTY_FUNCTION__))
;
2597 return TestTypeWithFormatType::get(odsParser.getContext(),
2598 int64_t((*_result_one)),
2599 std::string((*_result_two)),
2600 ::mlir::Attribute((*_result_three)));
2601}
2602
2603void TestTypeWithFormatType::print(::mlir::AsmPrinter &odsPrinter) const {
2604 ::mlir::Builder odsBuilder(getContext());
2605 odsPrinter << "<";
2606 odsPrinter.printStrippedAttrOrType(getOne());
2607 odsPrinter << ",";
2608 odsPrinter << ' ';
2609 {
2610 bool _firstPrinted = true;
2611 if (!_firstPrinted) odsPrinter << ", ";
2612 _firstPrinted = false;
2613 odsPrinter << "three = ";
2614 odsPrinter.printStrippedAttrOrType(getThree());
2615 if (!_firstPrinted) odsPrinter << ", ";
2616 _firstPrinted = false;
2617 odsPrinter << "two = ";
2618 odsPrinter << '"' << getTwo() << '"';
2619 }
2620 odsPrinter << ">";
2621}
2622
2623int64_t TestTypeWithFormatType::getOne() const {
2624 return getImpl()->one;
2625}
2626
2627llvm::StringRef TestTypeWithFormatType::getTwo() const {
2628 return getImpl()->two;
2629}
2630
2631::mlir::Attribute TestTypeWithFormatType::getThree() const {
2632 return getImpl()->three;
2633}
2634
2635} // namespace test
2636MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeWithFormatType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeWithFormatType>::id = {}; } }
2637namespace test {
2638namespace detail {
2639struct TestTypeWithLayoutTypeStorage : public ::mlir::TypeStorage {
2640 using KeyTy = std::tuple<unsigned>;
2641 TestTypeWithLayoutTypeStorage(unsigned key) : key(key) {}
2642
2643 bool operator==(const KeyTy &tblgenKey) const {
2644 return (key == std::get<0>(tblgenKey));
2645 }
2646
2647 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2648 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2649 }
2650
2651 static TestTypeWithLayoutTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2652 auto key = std::get<0>(tblgenKey);
2653 return new (allocator.allocate<TestTypeWithLayoutTypeStorage>()) TestTypeWithLayoutTypeStorage(key);
2654 }
2655
2656 unsigned key;
2657};
2658} // namespace detail
2659TestTypeWithLayoutType TestTypeWithLayoutType::get(::mlir::MLIRContext *context, unsigned key) {
2660 return Base::get(context, key);
2661}
2662
2663unsigned TestTypeWithLayoutType::getKey() const {
2664 return getImpl()->key;
2665}
2666
2667} // namespace test
2668MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeWithLayoutType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeWithLayoutType>::id = {}; } }
2669namespace test {
2670} // namespace test
2671MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestTypeWithTraitType)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::test::TestTypeWithTraitType>::id = {}; } }
2672
2673#endif // GET_TYPEDEF_CLASSES
2674