diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11318,11 +11318,8 @@ "matrix row and column subscripts cannot be separated by any expression">; def err_matrix_subscript_comma: Error< "comma expressions are not allowed as indices in matrix subscript expressions">; -def err_builtin_matrix_arg: Error<"1st argument must be a matrix">; def err_builtin_matrix_scalar_unsigned_arg: Error< "%0 argument must be a constant unsigned integer expression">; -def err_builtin_matrix_pointer_arg: Error< - "%ordinal0 argument must be a pointer to a valid matrix element type">; def err_builtin_matrix_pointer_arg_mismatch: Error< "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">; def err_builtin_matrix_store_to_const: Error< diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -16578,7 +16578,8 @@ auto *MType = Matrix->getType()->getAs(); if (!MType) { - Diag(Matrix->getBeginLoc(), diag::err_builtin_matrix_arg); + Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << "matrix" << Matrix->getType(); return ExprError(); } @@ -16649,15 +16650,17 @@ auto *PtrTy = PtrExpr->getType()->getAs(); QualType ElementTy; if (!PtrTy) { - Diag(PtrExpr->getBeginLoc(), diag::err_builtin_matrix_pointer_arg) - << PtrArgIdx + 1; + Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << PtrArgIdx + 1 << "pointer to a valid matrix element type" + << PtrExpr->getType(); ArgError = true; } else { ElementTy = PtrTy->getPointeeType().getUnqualifiedType(); if (!ConstantMatrixType::isValidElementType(ElementTy)) { - Diag(PtrExpr->getBeginLoc(), diag::err_builtin_matrix_pointer_arg) - << PtrArgIdx + 1; + Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << PtrArgIdx + 1 << "pointer to a valid matrix element type" + << PtrExpr->getType(); ArgError = true; } } @@ -16756,7 +16759,8 @@ auto *MatrixTy = MatrixExpr->getType()->getAs(); if (!MatrixTy) { - Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_matrix_arg) << 0; + Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << "matrix" << MatrixExpr->getType(); ArgError = true; } @@ -16775,8 +16779,9 @@ // Check pointer argument. auto *PtrTy = PtrExpr->getType()->getAs(); if (!PtrTy) { - Diag(PtrExpr->getBeginLoc(), diag::err_builtin_matrix_pointer_arg) - << PtrArgIdx + 1; + Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << PtrArgIdx + 1 << "pointer to a valid matrix element type" + << PtrExpr->getType(); ArgError = true; } else { QualType ElementTy = PtrTy->getPointeeType();