fhahn updated this revision to Diff 382373. fhahn marked an inline comment as done. fhahn added a comment.
Reabsed after landing D111985 <https://reviews.llvm.org/D111985>. Also turned the custom message parts into a select as suggested. In D112532#3087371 <https://reviews.llvm.org/D112532#3087371>, @aaron.ballman wrote: > In general, I like the direction of this cleanup. Thanks! > > In D112532#3087293 <https://reviews.llvm.org/D112532#3087293>, @erichkeane > wrote: > >> I'm fine with this change in general... but did this not manage to break any >> tests? > > Precommit CI says things are broken: > https://buildkite.com/llvm-project/premerge-checks/builds/62247#63e5ea73-b0b3-4df4-898a-dd05d1f4bf81 I think that is a build failure due the me not linking the dependency in Phab. Now that D111985 <https://reviews.llvm.org/D111985> has landed it should be come back green. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112532/new/ https://reviews.llvm.org/D112532 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaChecking.cpp Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -16530,7 +16530,7 @@ QualType Ty) { if (!Ty->getAs<VectorType>() && !ConstantMatrixType::isValidElementType(Ty)) { S.Diag(Loc, diag::err_builtin_invalid_arg_type) - << 1 << "vector, integer or floating point type" << Ty; + << 1 << 0 << Ty; return true; } return false; @@ -16578,7 +16578,8 @@ auto *MType = Matrix->getType()->getAs<ConstantMatrixType>(); if (!MType) { - Diag(Matrix->getBeginLoc(), diag::err_builtin_matrix_arg); + Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << 1 << Matrix->getType(); return ExprError(); } @@ -16649,15 +16650,17 @@ auto *PtrTy = PtrExpr->getType()->getAs<PointerType>(); 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 << 2 + << 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 << 2 + << PtrExpr->getType(); ArgError = true; } } @@ -16756,7 +16759,8 @@ auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>(); if (!MatrixTy) { - Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_matrix_arg) << 0; + Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << 1 << MatrixExpr->getType(); ArgError = true; } @@ -16775,8 +16779,9 @@ // Check pointer argument. auto *PtrTy = PtrExpr->getType()->getAs<PointerType>(); if (!PtrTy) { - Diag(PtrExpr->getBeginLoc(), diag::err_builtin_matrix_pointer_arg) - << PtrArgIdx + 1; + Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << PtrArgIdx + 1 << 2 + << PtrExpr->getType(); ArgError = true; } else { QualType ElementTy = PtrTy->getPointeeType(); Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11304,7 +11304,9 @@ "'__builtin_launder' is not allowed">; def err_builtin_invalid_arg_type: Error < - "%ordinal0 argument must be a %1 (was %2)">; + "%ordinal0 argument must be a " + "%select{vector, integer or floating point type|matrix|" + "pointer to a valid matrix element type}1 (was %2)">; def err_builtin_matrix_disabled: Error< "matrix types extension is disabled. Pass -fenable-matrix to enable it">; @@ -11318,11 +11320,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<
Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -16530,7 +16530,7 @@ QualType Ty) { if (!Ty->getAs<VectorType>() && !ConstantMatrixType::isValidElementType(Ty)) { S.Diag(Loc, diag::err_builtin_invalid_arg_type) - << 1 << "vector, integer or floating point type" << Ty; + << 1 << 0 << Ty; return true; } return false; @@ -16578,7 +16578,8 @@ auto *MType = Matrix->getType()->getAs<ConstantMatrixType>(); if (!MType) { - Diag(Matrix->getBeginLoc(), diag::err_builtin_matrix_arg); + Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << 1 << Matrix->getType(); return ExprError(); } @@ -16649,15 +16650,17 @@ auto *PtrTy = PtrExpr->getType()->getAs<PointerType>(); 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 << 2 + << 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 << 2 + << PtrExpr->getType(); ArgError = true; } } @@ -16756,7 +16759,8 @@ auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>(); if (!MatrixTy) { - Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_matrix_arg) << 0; + Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << 1 << 1 << MatrixExpr->getType(); ArgError = true; } @@ -16775,8 +16779,9 @@ // Check pointer argument. auto *PtrTy = PtrExpr->getType()->getAs<PointerType>(); if (!PtrTy) { - Diag(PtrExpr->getBeginLoc(), diag::err_builtin_matrix_pointer_arg) - << PtrArgIdx + 1; + Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type) + << PtrArgIdx + 1 << 2 + << PtrExpr->getType(); ArgError = true; } else { QualType ElementTy = PtrTy->getPointeeType(); Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11304,7 +11304,9 @@ "'__builtin_launder' is not allowed">; def err_builtin_invalid_arg_type: Error < - "%ordinal0 argument must be a %1 (was %2)">; + "%ordinal0 argument must be a " + "%select{vector, integer or floating point type|matrix|" + "pointer to a valid matrix element type}1 (was %2)">; def err_builtin_matrix_disabled: Error< "matrix types extension is disabled. Pass -fenable-matrix to enable it">; @@ -11318,11 +11320,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<
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits