================
@@ -1877,6 +1887,93 @@ void InitListChecker::CheckReferenceType(const
InitializedEntity &Entity,
AggrDeductionCandidateParamTypes->push_back(DeclType);
}
+void InitListChecker::CheckMatrixType(const InitializedEntity &Entity,
+ InitListExpr *IList, QualType DeclType,
+ unsigned &Index,
+ InitListExpr *StructuredList,
+ unsigned &StructuredIndex) {
+ if (!SemaRef.getLangOpts().HLSL)
+ return;
+
+ const ConstantMatrixType *MT = DeclType->castAs<ConstantMatrixType>();
+ QualType ElemTy = MT->getElementType();
+ const unsigned Rows = MT->getNumRows();
+ const unsigned Cols = MT->getNumColumns();
+ const unsigned MaxElts = Rows * Cols;
+
+ unsigned NumEltsInit = 0;
+ InitializedEntity ElemEnt =
+ InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
+
+ // A Matrix initalizer should be able to take scalars, vectors, and matrices.
+ auto HandleInit = [&](InitListExpr *List, unsigned &Idx) {
----------------
fhahn wrote:
It would be nice to also support initialization syntax for regular matrix
types, addressing the TODO from
https://clang.llvm.org/docs/MatrixTypes.html#todos
https://github.com/llvm/llvm-project/pull/160960
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits