[Mlir-commits] [mlir] [mlir] Attribute add printStripped (PR #78008)

Mehdi Amini llvmlistbot at llvm.org
Mon Jan 15 20:52:08 PST 2024


================
@@ -483,4 +483,22 @@ TEST(CopyCountAttr, CopyCount) {
 #endif
 }
 
+// Test stripped printing using test dialect attribute.
+TEST(CopyCountAttr, PrintStripped) {
+  MLIRContext context;
+  context.loadDialect<test::TestDialect>();
+  // Doesn't matter which dialect attribute is used, just chose TestCopyCount
+  // given proximity.
+  test::CopyCount::counter = 0;
+  test::CopyCount copyCount("hello");
+  auto res = test::TestCopyCountAttr::get(&context, std::move(copyCount));
----------------
joker-eph wrote:

```suggestion
  Attribute res = test::TestCopyCountAttr::get(&context, std::move(copyCount));
```

We need to type-erased here, to differentiate with a concrete attribute.

https://github.com/llvm/llvm-project/pull/78008


More information about the Mlir-commits mailing list