Skip to content

Commit cbb7650

Browse files
committed
matrix max element check isn't needed anymore
1 parent 842a52a commit cbb7650

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11089,8 +11089,8 @@ def err_first_argument_to_cwsc_pdtor_call : Error<
1108911089
def err_second_argument_to_cwsc_not_pointer : Error<
1109011090
"second argument to __builtin_call_with_static_chain must be of pointer type">;
1109111091

11092-
def err_tensor_incorrect_num_elements : Error<
11093-
"%select{too many|too few}0 elements in %select{vector|matrix}1 %select{initialization|operand}4 (expected %2 elements, have %3)">;
11092+
def err_vector_incorrect_num_elements : Error<
11093+
"%select{too many|too few}0 elements in vector %select{initialization|operand}3 (expected %1 elements, have %2)">;
1109411094
def err_altivec_empty_initializer : Error<"expected initializer">;
1109511095

1109611096
def err_vector_incorrect_bit_count : Error<

clang/lib/Sema/SemaInit.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,14 +1912,7 @@ void InitListChecker::CheckMatrixType(const InitializedEntity &Entity,
19121912
}
19131913

19141914
// HLSL requires exactly NumEltsInit to equal Max initializers.
1915-
if (NumEltsInit != MaxElts) {
1916-
if (!VerifyOnly)
1917-
SemaRef.Diag(IList->getBeginLoc(),
1918-
diag::err_tensor_incorrect_num_elements)
1919-
<< (NumEltsInit < MaxElts) << /*matrix*/ 1 << MaxElts << NumEltsInit
1920-
<< /*initialization*/ 0;
1921-
hadError = true;
1922-
}
1915+
assert(NumEltsInit == MaxElts && "NumEltsInit must equal MaxElts");
19231916
}
19241917

19251918
void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
@@ -2071,9 +2064,9 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
20712064
if (numEltsInit != maxElements) {
20722065
if (!VerifyOnly)
20732066
SemaRef.Diag(IList->getBeginLoc(),
2074-
diag::err_tensor_incorrect_num_elements)
2075-
<< (numEltsInit < maxElements) << /*vector*/ 0 << maxElements
2076-
<< numEltsInit << /*initialization*/ 0;
2067+
diag::err_vector_incorrect_num_elements)
2068+
<< (numEltsInit < maxElements) << maxElements << numEltsInit
2069+
<< /*initialization*/ 0;
20772070
hadError = true;
20782071
}
20792072
}

0 commit comments

Comments
 (0)