================
@@ -1877,6 +1887,41 @@ 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 MaxElts = MT->getNumElementsFlattened();
+
+  unsigned NumEltsInit = 0;
+  InitializedEntity ElemEnt =
+      InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity);
+
+  while (NumEltsInit < MaxElts && Index < IList->getNumInits()) {
+    // Not a sublist: just consume directly.
+    ElemEnt.setElementIndex(Index);
+    CheckSubElementType(ElemEnt, IList, ElemTy, Index, StructuredList,
+                        StructuredIndex);
+    ++NumEltsInit;
+  }
----------------
llvm-beanz wrote:

I looked at this and I understand what is going on. We need the code up to 
here. We'll never get this far if we have the wrong number of initializers 
because this happens after initializer flattening. We should add an assert 
`assert(NumEltsInit != MaxElts)`, and drop the rest of the function because 
that's unreachable.

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

Reply via email to