Bug Summary

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