[clang] [Matrix][HLSL] Add codgen support for Matrix Layout keywords (PR #197013)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 06:40:35 PDT 2026


================
@@ -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];
+}
----------------
farzonl wrote:

I'm going to let claude run build out some prototypes will send diffs and update this pr as assisted by AI if we pick one of them.

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


More information about the cfe-commits mailing list