[Mlir-commits] [mlir] [mlir] Make `TypedStrAttr` actually enforce the string type. (PR #124770)
Ingo Müller
llvmlistbot at llvm.org
Wed Jan 29 04:09:25 PST 2025
================
@@ -343,8 +343,10 @@ def SymbolNameAttr : StringBasedAttr<CPred<"::llvm::isa<::mlir::StringAttr>($_se
// String attribute that has a specific value type.
class TypedStrAttr<Type ty>
- : StringBasedAttr<CPred<"::llvm::isa<::mlir::StringAttr>($_self)">,
- "string attribute"> {
+ : StringBasedAttr<
+ SubstLeaves<"$_self", "::mlir::cast<StringAttr>($_self).getType()",
----------------
ingomueller-net wrote:
I had, since opening the PR, encountered a crash with the first version, which didn't test for `StringAttr`. The second commit fixed that but didn't add a test. A just pushed a third commit that adds a test that crashes without the fix from the second commit (but passes with the fix). Thanks for suggesting that!
https://github.com/llvm/llvm-project/pull/124770
More information about the Mlir-commits
mailing list