Skip to content

Commit 4e5cfed

Browse files
committed
Right, there was supposed to be a unit test here
1 parent 058b5ec commit 4e5cfed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mlir/unittests/TableGen/OpBuildGen.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,20 @@ TEST_F(OpBuildGenTest, BuildMethodsVariadicProperties) {
291291
verifyOp(std::move(op), {f32Ty}, {*cstI32}, {*cstI32}, attrs);
292292
}
293293

294+
TEST_F(OpBuildGenTest, BuildMethodsInherentDiscardableAttrs) {
295+
test::TableGenBuildOp7::Properties props;
296+
props.attr0 = cast<BoolAttr>(attrs[0].getValue());
297+
ArrayRef<NamedAttribute> discardableAttrs = attrs.drop_front();
298+
auto op7 = builder.create<test::TableGenBuildOp7>(
299+
loc, TypeRange{}, ValueRange{}, props, discardableAttrs);
300+
verifyOp(op7, {}, {}, attrs);
301+
302+
// Check that the old-style builder where all the attributes go in the same
303+
// place works.
304+
auto op7b = builder.create<test::TableGenBuildOp7>(loc, TypeRange{},
305+
ValueRange{}, attrs);
306+
verifyOp(op7b, {}, {}, attrs);
307+
ASSERT_EQ(op7b.getProperties().getAttr0(), attrs[0].getValue());
308+
}
309+
294310
} // namespace mlir

0 commit comments

Comments
 (0)