@@ -1983,25 +1983,29 @@ checkMathBuiltinElementType(Sema &S, SourceLocation Loc, QualType ArgTy,
19831983 if (!ArgTy->getAs<VectorType>() &&
19841984 !ConstantMatrixType::isValidElementType(ArgTy)) {
19851985 return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
1986- << ArgOrdinal << /* vector, integer or float ty*/ 0 << ArgTy;
1986+ << ArgOrdinal << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1
1987+ << ArgTy;
19871988 }
19881989 break;
19891990 case Sema::EltwiseBuiltinArgTyRestriction::FloatTy:
19901991 if (!EltTy->isRealFloatingType()) {
19911992 return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
1992- << ArgOrdinal << /* vector or float ty*/ 5 << ArgTy;
1993+ << ArgOrdinal << /* scalar or vector */ 5 << /* no int */ 0
1994+ << /* floating-point */ 1 << ArgTy;
19931995 }
19941996 break;
19951997 case Sema::EltwiseBuiltinArgTyRestriction::IntegerTy:
19961998 if (!EltTy->isIntegerType()) {
19971999 return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
1998- << ArgOrdinal << /* vector or int ty*/ 10 << ArgTy;
2000+ << ArgOrdinal << /* scalar or vector */ 5 << /* integer */ 1
2001+ << /* no fp */ 0 << ArgTy;
19992002 }
20002003 break;
20012004 case Sema::EltwiseBuiltinArgTyRestriction::SignedIntOrFloatTy:
20022005 if (EltTy->isUnsignedIntegerType()) {
20032006 return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
2004- << 1 << /* signed integer or float ty*/ 3 << ArgTy;
2007+ << 1 << /* scalar or vector */ 5 << /* signed int */ 2
2008+ << /* or fp */ 1 << ArgTy;
20052009 }
20062010 break;
20072011 }
@@ -2071,7 +2075,8 @@ static bool BuiltinPopcountg(Sema &S, CallExpr *TheCall) {
20712075
20722076 if (!ArgTy->isUnsignedIntegerType()) {
20732077 S.Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2074- << 1 << /*unsigned integer ty*/ 7 << ArgTy;
2078+ << 1 << /* scalar */ 1 << /* unsigned integer ty */ 3 << /* no fp */ 0
2079+ << ArgTy;
20752080 return true;
20762081 }
20772082 return false;
@@ -2095,7 +2100,8 @@ static bool BuiltinCountZeroBitsGeneric(Sema &S, CallExpr *TheCall) {
20952100
20962101 if (!Arg0Ty->isUnsignedIntegerType()) {
20972102 S.Diag(Arg0->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2098- << 1 << /*unsigned integer ty*/ 7 << Arg0Ty;
2103+ << 1 << /* scalar */ 1 << /* unsigned integer ty */ 3 << /* no fp */ 0
2104+ << Arg0Ty;
20992105 return true;
21002106 }
21012107
@@ -2111,7 +2117,7 @@ static bool BuiltinCountZeroBitsGeneric(Sema &S, CallExpr *TheCall) {
21112117
21122118 if (!Arg1Ty->isSpecificBuiltinType(BuiltinType::Int)) {
21132119 S.Diag(Arg1->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2114- << 2 << /*'int' ty*/ 8 << Arg1Ty;
2120+ << 2 << /* scalar */ 1 << /* 'int' ty */ 4 << /* no fp */ 0 << Arg1Ty;
21152121 return true;
21162122 }
21172123 }
@@ -2826,7 +2832,8 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28262832
28272833 if (ElTy.isNull()) {
28282834 Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2829- << 1 << /* vector ty*/ 4 << Arg->getType();
2835+ << 1 << /* vector ty */ 2 << /* no int */ 0 << /* no fp */ 0
2836+ << Arg->getType();
28302837 return ExprError();
28312838 }
28322839
@@ -2849,7 +2856,8 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28492856
28502857 if (ElTy.isNull() || !ElTy->isFloatingType()) {
28512858 Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2852- << 1 << /* vector of floating points */ 9 << Arg->getType();
2859+ << 1 << /* vector of */ 4 << /* no int */ 0 << /* fp */ 1
2860+ << Arg->getType();
28532861 return ExprError();
28542862 }
28552863
@@ -2878,7 +2886,8 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28782886
28792887 if (ElTy.isNull() || !ElTy->isIntegerType()) {
28802888 Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2881- << 1 << /* vector of integers */ 6 << Arg->getType();
2889+ << 1 << /* vector of */ 4 << /* int */ 1 << /* no fp */ 0
2890+ << Arg->getType();
28822891 return ExprError();
28832892 }
28842893
@@ -14785,8 +14794,9 @@ bool Sema::BuiltinNonDeterministicValue(CallExpr *TheCall) {
1478514794 QualType TyArg = Arg.get()->getType();
1478614795
1478714796 if (!TyArg->isBuiltinType() && !TyArg->isVectorType())
14788- return Diag(TheCall->getArg(0)->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14789- << 1 << /*vector, integer or floating point ty*/ 0 << TyArg;
14797+ return Diag(TheCall->getArg(0)->getBeginLoc(),
14798+ diag::err_builtin_invalid_arg_type)
14799+ << 1 << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1 << TyArg;
1479014800
1479114801 TheCall->setType(TyArg);
1479214802 return false;
@@ -14805,7 +14815,7 @@ ExprResult Sema::BuiltinMatrixTranspose(CallExpr *TheCall,
1480514815 auto *MType = Matrix->getType()->getAs<ConstantMatrixType>();
1480614816 if (!MType) {
1480714817 Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14808- << 1 << /* matrix ty*/ 1 << Matrix->getType();
14818+ << 1 << 0 << /* matrix ty */ 5 << /* no fp */ 0 << Matrix->getType();
1480914819 return ExprError();
1481014820 }
1481114821
@@ -14877,15 +14887,16 @@ ExprResult Sema::BuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
1487714887 QualType ElementTy;
1487814888 if (!PtrTy) {
1487914889 Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14880- << PtrArgIdx + 1 << /*pointer to element ty*/ 2 << PtrExpr->getType();
14890+ << PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << /* no fp */ 0
14891+ << PtrExpr->getType();
1488114892 ArgError = true;
1488214893 } else {
1488314894 ElementTy = PtrTy->getPointeeType().getUnqualifiedType();
1488414895
1488514896 if (!ConstantMatrixType::isValidElementType(ElementTy)) {
1488614897 Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14887- << PtrArgIdx + 1 << /* pointer to element ty*/ 2
14888- << PtrExpr->getType();
14898+ << PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6
14899+ << /* no fp */ 0 << PtrExpr->getType();
1488914900 ArgError = true;
1489014901 }
1489114902 }
@@ -14985,7 +14996,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1498514996 auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>();
1498614997 if (!MatrixTy) {
1498714998 Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14988- << 1 << /* matrix ty */ 1 << MatrixExpr->getType();
14999+ << 1 << 0 << /* matrix ty */ 5 << 0 << MatrixExpr->getType();
1498915000 ArgError = true;
1499015001 }
1499115002
@@ -15005,7 +15016,8 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1500515016 auto *PtrTy = PtrExpr->getType()->getAs<PointerType>();
1500615017 if (!PtrTy) {
1500715018 Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15008- << PtrArgIdx + 1 << /*pointer to element ty*/ 2 << PtrExpr->getType();
15019+ << PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << 0
15020+ << PtrExpr->getType();
1500915021 ArgError = true;
1501015022 } else {
1501115023 QualType ElementTy = PtrTy->getPointeeType();
0 commit comments