brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 5f1c61a Raw
49 lines · plain
1// RUN: not mlir-tblgen -gen-attrdef-decls -I %S/../../include %s 2>&1 | FileCheck %s2 3include "mlir/IR/OpBase.td"4 5def Test_Dialect : Dialect {6  let name = "test";7  let cppNamespace = "::test";8}9 10class TestAttr<string attrName, string attrMnemonic, list<Trait> traits = []>11    : AttrDef<Test_Dialect, attrName, traits> {12  let mnemonic = attrMnemonic;13}14 15def TestAttr : TestAttr<"Test", "test"> {16  let summary = "Test attrubute";17  let description = "Test attribute";18 19  let parameters = (ins AttrParameter<"std::int64_t", "arg">:$arg);20  let builders = [AttrBuilder<(ins "std::int64_t":$arg), [{21            return $_get($_ctxt, arg);22        }]>];23 24  let assemblyFormat = "`<` $arg `>`";25 26  let skipDefaultBuilders = 0;27  let genVerifyDecl = 1;28  let genMnemonicAlias = 1;29}30 31def Test_TestAttrOp : Op<Test_Dialect, "test", []> {32  let summary = "test operation with attribute";33  let description = "test operation with attribute";34 35  let arguments = (ins TestAttr:$testAttr);36  let assemblyFormat = "$testAttr attr-dict";37}38 39// CHECK: attr-duplicated-builder-error.td:20:7: error: builder `get` conflicts with an existing builder. 40// CHECK-NEXT:   let builders = [AttrBuilder<(ins "std::int64_t":$arg), [{41// CHECK-NEXT:       ^42// CHECK-NEXT: note: A new builder with signature:43// CHECK-NEXT: static TestAttr get(::mlir::MLIRContext *context, std::int64_t arg);44// CHECK-EMPTY:45// CHECK-NEXT: is shadowed by an existing builder with signature:46// CHECK-NEXT: static TestAttr get(::mlir::MLIRContext *context, std::int64_t arg);47// CHECK-EMPTY:48// CHECK-NEXT: Please remove one of the conflicting definitions.49