[Mlir-commits] [mlir] [mlir] load dialect in parser for optional parameters (PR #96667)

Mehdi Amini llvmlistbot at llvm.org
Sun Jul 7 04:28:00 PDT 2024


================
@@ -112,6 +130,9 @@ struct FieldParser<
     std::enable_if_t<std::is_base_of<Attribute, AttributeT>::value,
                      std::optional<AttributeT>>> {
   static FailureOr<std::optional<AttributeT>> parse(AsmParser &parser) {
+    if constexpr (HasStaticDialectName<AttributeT>::value) {
+      parser.getContext()->getOrLoadDialect(AttributeT::dialectName);
----------------
joker-eph wrote:

The way you get TypeID is through `TypeID::get<DialectClass>()`.
I would think that if you can generate a `dialectName` field, you could generate a TypeID one instead?

https://github.com/llvm/llvm-project/pull/96667


More information about the Mlir-commits mailing list