https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/228136
The ReportInvalid parameter was being set to true in all of the call sites, so remove the parameter entirely. Follow-up to https://github.com/llvm/llvm-project/pull/227837#discussion_r4157894862 >From f12152e1b77d36032dec92ee31d26d8c3f9f1701 Mon Sep 17 00:00:00 2001 From: Aaron Ballman <[email protected]> Date: Thu, 1 Oct 2026 12:46:27 -0400 Subject: [PATCH] Remove unused param from CheckVectorOperands; NFC The ReportInvalid parameter was being set to true in all of the call sites, so remove the parameter entirely. Follow-up to https://github.com/llvm/llvm-project/pull/227837#discussion_r4157894862 --- clang/include/clang/Sema/Sema.h | 2 +- clang/lib/Sema/SemaExpr.cpp | 41 +++++++++++++-------------------- clang/lib/Sema/SemaExprCXX.cpp | 6 ++--- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 3edf6f6c29500..85ebe0cfdba1e 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -7931,7 +7931,7 @@ class Sema final : public SemaBase { QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, - bool AllowBoolOperation, bool ReportInvalid); + bool AllowBoolOperation); /// Return a signed ext_vector_type that is of identical size and number of /// elements. For floating point vectors, return an integer type of identical diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 34a36e98ba38e..785c7409d8952 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -8971,8 +8971,7 @@ OpenCLCheckVectorConditional(Sema &S, ExprResult &Cond, /*isCompAssign*/ false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ false, - /*AllowBooleanOperation*/ IsBoolVecLang, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ IsBoolVecLang); if (VecResTy.isNull()) return QualType(); // The result type must match the condition type as specified in @@ -9055,8 +9054,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, return CheckVectorOperands(LHS, RHS, QuestionLoc, /*isCompAssign*/ false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ false, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); QualType ResTy = UsualArithmeticConversions(LHS, RHS, QuestionLoc, ArithConvKind::Conditional); @@ -10866,8 +10864,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversions, - bool AllowBoolOperation, - bool ReportInvalid) { + bool AllowBoolOperation) { if (!IsCompAssign) { LHS = DefaultFunctionArrayLvalueConversion(LHS.get()); if (LHS.isInvalid()) @@ -10900,12 +10897,12 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, if (!AllowBothBool && LHSVecType && LHSVecType->getVectorKind() == VectorKind::AltiVecBool && RHSVecType && RHSVecType->getVectorKind() == VectorKind::AltiVecBool) - return ReportInvalid ? InvalidOperands(Loc, LHS, RHS) : QualType(); + return InvalidOperands(Loc, LHS, RHS); // This operation may not be performed on boolean vectors. if (!AllowBoolOperation && (LHSType->isExtVectorBoolType() || RHSType->isExtVectorBoolType())) - return ReportInvalid ? InvalidOperands(Loc, LHS, RHS) : QualType(); + return InvalidOperands(Loc, LHS, RHS); // If the vector types are identical, return. if (Context.hasSameType(LHSType, RHSType)) @@ -11396,8 +11393,7 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign, /*AllowBothBool*/ getLangOpts().AltiVec, /*AllowBoolConversions*/ false, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); if (LHSTy->isSveVLSBuiltinType() || RHSTy->isSveVLSBuiltinType()) return CheckSizelessVectorOperands(LHS, RHS, Loc, IsCompAssign, ArithConvKind::Arithmetic); @@ -11459,8 +11455,7 @@ QualType Sema::CheckRemainderOperands( return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign, /*AllowBothBool*/ getLangOpts().AltiVec, /*AllowBoolConversions*/ false, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); return InvalidOperands(Loc, LHS, RHS); } @@ -11785,8 +11780,7 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, CheckVectorOperands(LHS, RHS, Loc, CompLHSTy, /*AllowBothBool*/ getLangOpts().AltiVec, /*AllowBoolConversions*/ getLangOpts().ZVector, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); if (CompLHSTy) *CompLHSTy = compType; return compType; } @@ -11932,8 +11926,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, CheckVectorOperands(LHS, RHS, Loc, CompLHSTy, /*AllowBothBool*/ getLangOpts().AltiVec, /*AllowBoolConversions*/ getLangOpts().ZVector, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); if (CompLHSTy) *CompLHSTy = compType; return compType; } @@ -13659,8 +13652,7 @@ QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, CheckVectorOperands(LHS, RHS, Loc, /*isCompAssign*/ false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ getLangOpts().ZVector, - /*AllowBooleanOperation*/ true, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ true); if (vType.isNull()) return vType; @@ -13906,8 +13898,7 @@ QualType Sema::CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, QualType vType = CheckVectorOperands(LHS, RHS, Loc, false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ false, - /*AllowBooleanOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBooleanOperation*/ false); if (vType.isNull()) return QualType(); if (getLangOpts().OpenCL && @@ -14063,11 +14054,11 @@ inline QualType Sema::CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, RHS.get()->getType()->isVectorType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) - return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign, - /*AllowBothBool*/ true, - /*AllowBoolConversions*/ getLangOpts().ZVector, - /*AllowBooleanOperation*/ LegalBoolVecOperator, - /*ReportInvalid*/ true); + return CheckVectorOperands( + LHS, RHS, Loc, IsCompAssign, + /*AllowBothBool*/ true, + /*AllowBoolConversions*/ getLangOpts().ZVector, + /*AllowBooleanOperation*/ LegalBoolVecOperator); return InvalidOperands(Loc, LHS, RHS); } diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 1bf6430665ddf..b89c97f2b8900 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -5966,8 +5966,7 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ResultType = CheckVectorOperands( LHS, RHS, QuestionLoc, /*isCompAssign*/ false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ false, - /*AllowBoolOperation*/ true, - /*ReportInvalid*/ true); + /*AllowBoolOperation*/ true); if (ResultType.isNull()) return {}; } else { @@ -6266,8 +6265,7 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, return CheckVectorOperands(LHS, RHS, QuestionLoc, /*isCompAssign*/ false, /*AllowBothBool*/ true, /*AllowBoolConversions*/ false, - /*AllowBoolOperation*/ false, - /*ReportInvalid*/ true); + /*AllowBoolOperation*/ false); // -- The second and third operands have arithmetic or enumeration type; // the usual arithmetic conversions are performed to bring them to a _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
