Skip to content

Commit

Permalink
[MLIR][ODS] Add constBuilderCall for TypeArrayAttr
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andyly committed Sep 18, 2020
1 parent ceadd98 commit 3c2e2df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mlir/include/mlir/IR/OpBase.td
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ def StrArrayAttr : TypedArrayAttrBase<StrAttr, "string array attribute"> {
let constBuilderCall = "$_builder.getStrArrayAttr($0)";
}
def TypeArrayAttr : TypedArrayAttrBase<TypeAttr, "type array attribute"> {
let constBuilderCall = ?;
let constBuilderCall = "$_builder.getTypeArrayAttr($0)";
}

// Attribute information for an Attribute field within a StructAttr.
Expand Down
3 changes: 3 additions & 0 deletions mlir/test/lib/Dialect/Test/TestOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
def TypeArrayAttrOp : TEST_Op<"type_array_attr"> {
let arguments = (ins TypeArrayAttr:$attr);
}
def TypeArrayAttrWithDefaultOp : TEST_Op<"type_array_attr_with_default"> {
let arguments = (ins DefaultValuedAttr<TypeArrayAttr, "{}">:$attr);
}
def TypeStringAttrWithTypeOp : TEST_Op<"string_attr_with_type"> {
let arguments = (ins TypedStrAttr<AnyType>:$attr);
let assemblyFormat = "$attr attr-dict";
Expand Down

0 comments on commit 3c2e2df

Please sign in to comment.