================
@@ -5303,6 +5303,22 @@ def HLSLMatrixLayout : InheritableAttr {
   let Documentation = [HLSLMatrixLayoutDocs];
 }
 
+// Internal type-attribute markers attached to matrix QualTypes by Sema when
+// a decl carries `[[hlsl::row_major]]` / `[[hlsl::column_major]]`. They let
+// CodeGen / const-eval recover the layout from any matrix-typed expression
+// without re-walking back to the source decl.
+def HLSLRowMajor : TypeAttr {
+  let Spellings = [];
+  let LangOpts = [HLSL];
+  let Documentation = [InternalOnly];
+}
+
+def HLSLColumnMajor : TypeAttr {
+  let Spellings = [];
+  let LangOpts = [HLSL];
+  let Documentation = [InternalOnly];
+}
----------------
AaronBallman wrote:

> I think we should change these type attributes to have spelling, parse them 
> into `AttributedType`, and remove the separate `HLSLMatrixLayoutAttr`. 
> Because it is indeed a type attribute, not a decl attribute. Or it is there a 
> reason why we need both?

Full disclosure: I have no expertise in HLSL.

This sounds like the correct approach to me; these don't seem to be declaration 
attributes and the `[[]]` spelling in particular *should absolutely not be 
sliding around to whatever makes sense*.

> Since we spell them on the decl via HLSLMatrixLayoutAttr and Sema is what 
> propagates them onto the type. 

is a big red flag that the attribute is designed incorrectly.

https://github.com/llvm/llvm-project/pull/197013
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to