[Mlir-commits] [mlir] [mlir] load dialect in parser for optional parameters (PR #96667)
Jeremy Kun
llvmlistbot at llvm.org
Sun Jul 7 21:08:53 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);
----------------
j2kun wrote:
If I had a generated TypeID, I'm still not sure how I would use it to get the dialect. [This method](https://github.com/llvm/llvm-project/blob/3ed76b45be185469f0ff58292102a4202902679d/mlir/include/mlir/IR/MLIRContext.h#L234) seems to still need the dialect namespace as a string.
https://github.com/llvm/llvm-project/pull/96667
More information about the Mlir-commits
mailing list