Skip to content

Commit 2035ce5

Browse files
committed
use hasProperties
1 parent 30da0f5 commit 2035ce5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

mlir/test/mlir-tblgen/op-attribute.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def AOp : NS_Op<"a_op", []> {
173173
// DEF: ::llvm::ArrayRef<::mlir::NamedAttribute> attributes
174174
// DEF: odsState.addAttributes(attributes);
175175

176+
// DEF: void AOp::populateDefaultAttrs
177+
176178
// Test the above but with prefix.
177179

178180
def Test2_Dialect : Dialect {
@@ -287,6 +289,17 @@ def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
287289
// DEF: ::llvm::ArrayRef<::mlir::NamedAttribute> attributes
288290
// DEF: odsState.addAttributes(attributes);
289291

292+
// Test the above but using properties.
293+
def ApropOp : NS_Op<"a_prop_op", []> {
294+
let arguments = (ins
295+
Property<"unsigned">:$aAttr,
296+
DefaultValuedAttr<SomeAttr, "4.2">:$bAttr
297+
);
298+
}
299+
300+
// DEF-LABEL: ApropOp definitions
301+
// DEF: void ApropOp::populateDefaultProperties
302+
290303
def SomeTypeAttr : TypeAttrBase<"SomeType", "some type attribute">;
291304

292305
def BOp : NS_Op<"b_op", []> {

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,7 @@ void OpEmitter::genPopulateDefaultAttributes() {
25062506
}))
25072507
return;
25082508

2509-
if (op.getDialect().usePropertiesForAttributes()) {
2509+
if (emitHelper.hasProperties()) {
25102510
SmallVector<MethodParameter> paramList;
25112511
paramList.emplace_back("::mlir::OperationName", "opName");
25122512
paramList.emplace_back("Properties &", "properties");

0 commit comments

Comments
 (0)