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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri Jun 28 14:44:15 PDT 2024


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

Should we complain when the field is missing? This would be the case for attributes defined outside tablegen.

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


More information about the Mlir-commits mailing list