[Mlir-commits] [mlir] [mlir][spirv] Add support for structs decorations (PR #149793)

Jakub Kuderski llvmlistbot at llvm.org
Tue Jul 22 07:27:19 PDT 2025


================
@@ -327,10 +327,33 @@ class StructType
     }
   };
 
+  // Type for specifying the decoration(s) on the struct itself
+  struct StructDecorationInfo {
+    bool hasValue;
+    Decoration decoration;
+    Attribute decorationValue;
+
+    StructDecorationInfo(bool hasValue, Decoration decoration,
+                         Attribute decorationValue)
+        : hasValue(hasValue), decoration(decoration),
+          decorationValue(decorationValue) {}
+
+    bool operator==(const StructDecorationInfo &other) const {
+      return (this->decoration == other.decoration) &&
+             (this->decorationValue == other.decorationValue);
+    }
+
+    bool operator<(const StructDecorationInfo &other) const {
+      return static_cast<uint32_t>(this->decoration) <
+             static_cast<uint32_t>(other.decoration);
----------------
kuhar wrote:

You can avoid hardcoding the exact enum type by using `llvm::to_underlying`

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


More information about the Mlir-commits mailing list