[Mlir-commits] [mlir] [mlir] [irdl] Optional attributes in irdl (PR #110981)

Fehr Mathieu llvmlistbot at llvm.org
Fri Nov 22 07:05:36 PST 2024


================
@@ -107,11 +107,18 @@ LogicalResult ResultsOp::verify() {
 LogicalResult AttributesOp::verify() {
   size_t namesSize = getAttributeValueNames().size();
   size_t valuesSize = getAttributeValues().size();
+  size_t numVariadicities = getVariadicity().size();
+
+  if (numVariadicities != valuesSize)
+    return emitOpError()
+           << "the number of attributes and their variadicities must be "
+              "the same, but got "
+           << valuesSize << " and " << numVariadicities << " respectively";
 
   if (namesSize != valuesSize)
     return emitOpError()
            << "the number of attribute names and their constraints must be "
-              "the same but got "
+              "the same, but got "
            << namesSize << " and " << valuesSize << " respectively";
 
----------------
math-fehr wrote:

Can you add a check that no variadicity of attribute is `variadic`?
Optional attributes make sense, but not variadic ones (they should be put in an array instead).

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


More information about the Mlir-commits mailing list