================ @@ -2164,30 +2083,48 @@ static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall, return true; } -static bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) { - auto checkDoubleVector = [](clang::QualType PassedType) -> bool { - if (const auto *VecTy = PassedType->getAs<VectorType>()) - return VecTy->getElementType()->isDoubleType(); - return false; - }; - return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.FloatTy, - checkDoubleVector); +static bool CheckNoDoubleVectors(Sema *S, SourceLocation Loc, int ArgOrdinal, + clang::QualType PassedType) { + if (const auto *VecTy = PassedType->getAs<VectorType>()) + if (VecTy->getElementType()->isDoubleType()) + return S->Diag(Loc, diag::err_builtin_invalid_arg_type) + << ArgOrdinal << /* scalar */ 1 << /* no int */ 0 << /* fp */ 1 + << PassedType; + return false; } ---------------- farzonl wrote:
Small Nit: I really like to try to avoid nesting if possible. seems like we might be able to if we do the negation checks first. ```suggestion static bool CheckNoDoubleVectors(Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType) { const auto *VecTy = PassedType->getAs<VectorType>(); if (!VecTy) return false; if (!VecTy->getElementType()->isDoubleType()) return false; return S->Diag(Loc, diag::err_builtin_invalid_arg_type) << ArgOrdinal << /* scalar */ 1 << /* no int */ 0 << /* fp */ 1 << PassedType; } ``` https://github.com/llvm/llvm-project/pull/138429 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits