[Mlir-commits] [mlir] [mlir][mlir-tblgen] Emit correct error message if method is pruned (PR #160334)
Mehdi Amini
llvmlistbot at llvm.org
Fri Sep 26 06:22:32 PDT 2025
================
@@ -0,0 +1,43 @@
+// RUN: not mlir-tblgen -gen-attrdef-decls -I %S/../../include %s 2>&1 | FileCheck %s
+
+include "mlir/IR/OpBase.td"
+
+def Test_Dialect : Dialect {
+ let name = "test";
+ let cppNamespace = "::test";
+}
+
+class TestAttr<string attrName, string attrMnemonic, list<Trait> traits = []>
+ : AttrDef<Test_Dialect, attrName, traits> {
+ let mnemonic = attrMnemonic;
+}
+
+def TestAttr : TestAttr<"Test", "test"> {
+ let summary = "Test attrubute";
+ let description = "Test attribute";
+
+ let parameters = (ins AttrParameter<"std::int64_t", "arg">:$arg);
+ let builders = [AttrBuilder<(ins "std::int64_t":$arg), [{
+ return $_get($_ctxt, arg);
+ }]>,
+ AttrBuilder<(ins "std::int64_t":$arg), [{
+ // Duplicated builder
+ return $_get($_ctxt, arg);
+ }]>];
+
+ let assemblyFormat = "`<` $arg `>`";
+
+ let skipDefaultBuilders = 1;
+ let genVerifyDecl = 1;
+ let genMnemonicAlias = 1;
+}
+
+def Test_TestAttrOp : Op<Test_Dialect, "test", []> {
+ let summary = "test operation with attribute";
+ let description = "test operation with attribute";
+
+ let arguments = (ins TestAttr:$testAttr);
+ let assemblyFormat = "$testAttr attr-dict";
+}
+
+// CHECK: attr-duplicated-custom-builders-error.td:15:5: error: Unexpected overlap when generating `get` for TestAttr (from line {{.*}})
----------------
joker-eph wrote:
The error is quite terse, can we improve it? Can we point at the two methods that are shadowing each other?
https://github.com/llvm/llvm-project/pull/160334
More information about the Mlir-commits
mailing list