Skip to content

Commit 2e4fe63

Browse files
committed
Revert not required change
1 parent 2c9cee5 commit 2e4fe63

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ void SemaHLSL::diagnoseAvailabilityViolations(TranslationUnitDecl *TU) {
19891989
}
19901990

19911991
// Helper function for CheckHLSLBuiltinFunctionCall
1992-
static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumArgs) {
1992+
static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
19931993
assert(TheCall->getNumArgs() > 1);
19941994
ExprResult A = TheCall->getArg(0);
19951995

@@ -1999,7 +1999,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
19991999
SourceLocation BuiltinLoc = TheCall->getBeginLoc();
20002000

20012001
bool AllBArgAreVectors = true;
2002-
for (unsigned i = 1; i < NumArgs; ++i) {
2002+
for (unsigned i = 1; i < TheCall->getNumArgs(); ++i) {
20032003
ExprResult B = TheCall->getArg(i);
20042004
QualType ArgTyB = B.get()->getType();
20052005
auto *VecTyB = ArgTyB->getAs<VectorType>();
@@ -2049,10 +2049,6 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
20492049
return false;
20502050
}
20512051

2052-
static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
2053-
return CheckVectorElementCallArgs(S, TheCall, TheCall->getNumArgs());
2054-
}
2055-
20562052
static bool CheckAllArgsHaveSameType(Sema *S, CallExpr *TheCall) {
20572053
assert(TheCall->getNumArgs() > 1);
20582054
QualType ArgTy0 = TheCall->getArg(0)->getType();
@@ -2095,10 +2091,10 @@ static bool CheckArgTypeIsCorrect(
20952091
return false;
20962092
}
20972093

2098-
static bool CheckArgTypesAreCorrect(
2099-
Sema *S, CallExpr *TheCall, unsigned NumArgs, QualType ExpectedType,
2094+
static bool CheckAllArgTypesAreCorrect(
2095+
Sema *S, CallExpr *TheCall, QualType ExpectedType,
21002096
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
2101-
for (unsigned i = 0; i < NumArgs; ++i) {
2097+
for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) {
21022098
Expr *Arg = TheCall->getArg(i);
21032099
if (CheckArgTypeIsCorrect(S, Arg, ExpectedType, Check)) {
21042100
return true;
@@ -2107,13 +2103,6 @@ static bool CheckArgTypesAreCorrect(
21072103
return false;
21082104
}
21092105

2110-
static bool CheckAllArgTypesAreCorrect(
2111-
Sema *S, CallExpr *TheCall, QualType ExpectedType,
2112-
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
2113-
return CheckArgTypesAreCorrect(S, TheCall, TheCall->getNumArgs(),
2114-
ExpectedType, Check);
2115-
}
2116-
21172106
static bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) {
21182107
auto checkAllFloatTypes = [](clang::QualType PassedType) -> bool {
21192108
return !PassedType->hasFloatingRepresentation();
@@ -2157,17 +2146,15 @@ static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall,
21572146
return true;
21582147
}
21592148

2160-
static bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall,
2161-
unsigned NumArgs, QualType ExpectedType) {
2149+
static bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
21622150
auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
21632151
if (const auto *VecTy = PassedType->getAs<VectorType>())
21642152
return VecTy->getElementType()->isDoubleType();
21652153
return false;
21662154
};
2167-
return CheckArgTypesAreCorrect(S, TheCall, NumArgs,
2168-
ExpectedType, checkDoubleVector);
2155+
return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.FloatTy,
2156+
checkDoubleVector);
21692157
}
2170-
21712158
static bool CheckFloatingOrIntRepresentation(Sema *S, CallExpr *TheCall) {
21722159
auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool {
21732160
return !PassedType->hasIntegerRepresentation() &&
@@ -2481,8 +2468,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24812468
return true;
24822469
if (SemaRef.BuiltinVectorToScalarMath(TheCall))
24832470
return true;
2484-
if (CheckNoDoubleVectors(&SemaRef, TheCall,
2485-
TheCall->getNumArgs(), SemaRef.Context.FloatTy))
2471+
if (CheckNoDoubleVectors(&SemaRef, TheCall))
24862472
return true;
24872473
break;
24882474
}

0 commit comments

Comments
 (0)