[Mlir-commits] [mlir] [MLIR] Add ODS support for generating helpers for dialect (discardable) attributes (PR #77024)
Mehdi Amini
llvmlistbot at llvm.org
Sat Jan 6 03:13:07 PST 2024
================
@@ -181,6 +196,37 @@ static const char *const operationInterfaceFallbackDecl = R"(
mlir::OperationName opName) override;
)";
+/// The code block for the discardable attribute helper.
+static const char *const discardableAttrHelperDecl = R"(
+ /// Helper to manage the discardable attribute `{1}`.
+ class {0}AttrHelper {{
+ mlir::StringAttr name;
+ public:
+ static constexpr llvm::StringLiteral getNameStr() {{
----------------
joker-eph wrote:
Aren't we already avoiding having raw strings spreaded through the codebase and use symbols instead?
Here we could generate separately a `constexpr StringLiteral kMyDiscardableAttrName = "the dialect.my_discardable_attr";` ; but since we're already having a class for the rest of the functionality it seemed better to group it all together.
How would you do this?
https://github.com/llvm/llvm-project/pull/77024
More information about the Mlir-commits
mailing list