[Mlir-commits] [mlir] [mlir][spirv] Add support for structs decorations (PR #149793)
Jakub Kuderski
llvmlistbot at llvm.org
Mon Jul 21 07:49:44 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 {
----------------
kuhar wrote:
nit: we generally prefer free / friend functions for comparison operators
```suggestion
friend bool operator==(const StructDecorationInfo &lhs, const StructDecorationInfo &rhs) {
return lhs.decoration == rhs.decoration &&
lhs.decorationValue == rhs.other.decorationValue;
}
friend bool operator<(const StructDecorationInfo &lhs, const StructDecorationInfo &rhs) const {
```
Also, should we compare the `.hasValue` field?
https://github.com/llvm/llvm-project/pull/149793
More information about the Mlir-commits
mailing list