[clang] Remove unused param from CheckVectorOperands; NFC (PR #228136)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 09:53:27 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Aaron Ballman (AaronBallman)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/228136.diff
3 Files Affected:
- (modified) clang/include/clang/Sema/Sema.h (+1-1)
- (modified) clang/lib/Sema/SemaExpr.cpp (+16-25)
- (modified) clang/lib/Sema/SemaExprCXX.cpp (+2-4)
``````````diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 3edf6f6c295002..85ebe0cfdba1e8 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 34a36e98ba38e0..785c7409d89525 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 1bf6430665ddfa..b89c97f2b8900a 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/228136
More information about the cfe-commits
mailing list