Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/mlir-tblgen/op-format.td
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
// CHECK-LABEL: OptionalGroupB::print | // CHECK-LABEL: OptionalGroupB::print | ||||
// CHECK: if (!(*this)->getAttr("a")) | // CHECK: if (!(*this)->getAttr("a")) | ||||
// CHECK-NEXT: odsPrinter << ' ' << "foo" | // CHECK-NEXT: odsPrinter << ' ' << "foo" | ||||
// CHECK-NEXT: else | // CHECK-NEXT: else | ||||
// CHECK-NEXT: odsPrinter << ' ' << "bar" | // CHECK-NEXT: odsPrinter << ' ' << "bar" | ||||
def OptionalGroupB : TestFormat_Op<[{ | def OptionalGroupB : TestFormat_Op<[{ | ||||
(`foo`) : (`bar` $a^)? attr-dict | (`foo`) : (`bar` $a^)? attr-dict | ||||
}]>, Arguments<(ins UnitAttr:$a)>; | }]>, Arguments<(ins UnitAttr:$a)>; | ||||
// Optional group anchored on a default-valued attribute: | |||||
// CHECK-LABEL: OptionalGroupC::parse | |||||
// CHECK: if ((*this)->getAttr("a") != ::mlir::OpBuilder(getContext()).getStringAttr("default")) { | |||||
// CHECK-NEXT: odsPrinter << ' '; | |||||
// CHECK-NEXT: odsPrinter.printAttributeWithoutType(getAAttr()); | |||||
// CHECK-NEXT: } | |||||
def OptionalGroupC : TestFormat_Op<[{ | |||||
($a^)? attr-dict | |||||
}]>, Arguments<(ins DefaultValuedAttr<StrAttr, "\"default\"">:$a)>; |