Skip to content

Commit 3c2e2df

Browse files
committed
[MLIR][ODS] Add constBuilderCall for TypeArrayAttr
constBuilderCall was not defined for TypeArrayAttr, resulting in tblgen not emitting the correct code when TypeArrayAttr is used with a default valued attribute. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D87907
1 parent ceadd98 commit 3c2e2df

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mlir/include/mlir/IR/OpBase.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ def StrArrayAttr : TypedArrayAttrBase<StrAttr, "string array attribute"> {
14321432
let constBuilderCall = "$_builder.getStrArrayAttr($0)";
14331433
}
14341434
def TypeArrayAttr : TypedArrayAttrBase<TypeAttr, "type array attribute"> {
1435-
let constBuilderCall = ?;
1435+
let constBuilderCall = "$_builder.getTypeArrayAttr($0)";
14361436
}
14371437

14381438
// Attribute information for an Attribute field within a StructAttr.

mlir/test/lib/Dialect/Test/TestOps.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
168168
def TypeArrayAttrOp : TEST_Op<"type_array_attr"> {
169169
let arguments = (ins TypeArrayAttr:$attr);
170170
}
171+
def TypeArrayAttrWithDefaultOp : TEST_Op<"type_array_attr_with_default"> {
172+
let arguments = (ins DefaultValuedAttr<TypeArrayAttr, "{}">:$attr);
173+
}
171174
def TypeStringAttrWithTypeOp : TEST_Op<"string_attr_with_type"> {
172175
let arguments = (ins TypedStrAttr<AnyType>:$attr);
173176
let assemblyFormat = "$attr attr-dict";

0 commit comments

Comments
 (0)