@@ -1989,7 +1989,7 @@ void SemaHLSL::diagnoseAvailabilityViolations(TranslationUnitDecl *TU) {
1989
1989
}
1990
1990
1991
1991
// Helper function for CheckHLSLBuiltinFunctionCall
1992
- static bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall, unsigned NumArgs ) {
1992
+ static bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall) {
1993
1993
assert (TheCall->getNumArgs () > 1 );
1994
1994
ExprResult A = TheCall->getArg (0 );
1995
1995
@@ -1999,7 +1999,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
1999
1999
SourceLocation BuiltinLoc = TheCall->getBeginLoc ();
2000
2000
2001
2001
bool AllBArgAreVectors = true ;
2002
- for (unsigned i = 1 ; i < NumArgs ; ++i) {
2002
+ for (unsigned i = 1 ; i < TheCall-> getNumArgs () ; ++i) {
2003
2003
ExprResult B = TheCall->getArg (i);
2004
2004
QualType ArgTyB = B.get ()->getType ();
2005
2005
auto *VecTyB = ArgTyB->getAs <VectorType>();
@@ -2049,10 +2049,6 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
2049
2049
return false ;
2050
2050
}
2051
2051
2052
- static bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall) {
2053
- return CheckVectorElementCallArgs (S, TheCall, TheCall->getNumArgs ());
2054
- }
2055
-
2056
2052
static bool CheckAllArgsHaveSameType (Sema *S, CallExpr *TheCall) {
2057
2053
assert (TheCall->getNumArgs () > 1 );
2058
2054
QualType ArgTy0 = TheCall->getArg (0 )->getType ();
@@ -2095,10 +2091,10 @@ static bool CheckArgTypeIsCorrect(
2095
2091
return false ;
2096
2092
}
2097
2093
2098
- static bool CheckArgTypesAreCorrect (
2099
- Sema *S, CallExpr *TheCall, unsigned NumArgs, QualType ExpectedType,
2094
+ static bool CheckAllArgTypesAreCorrect (
2095
+ Sema *S, CallExpr *TheCall, QualType ExpectedType,
2100
2096
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) {
2102
2098
Expr *Arg = TheCall->getArg (i);
2103
2099
if (CheckArgTypeIsCorrect (S, Arg, ExpectedType, Check)) {
2104
2100
return true ;
@@ -2107,13 +2103,6 @@ static bool CheckArgTypesAreCorrect(
2107
2103
return false ;
2108
2104
}
2109
2105
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
-
2117
2106
static bool CheckAllArgsHaveFloatRepresentation (Sema *S, CallExpr *TheCall) {
2118
2107
auto checkAllFloatTypes = [](clang::QualType PassedType) -> bool {
2119
2108
return !PassedType->hasFloatingRepresentation ();
@@ -2157,17 +2146,15 @@ static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall,
2157
2146
return true ;
2158
2147
}
2159
2148
2160
- static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall,
2161
- unsigned NumArgs, QualType ExpectedType) {
2149
+ static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall) {
2162
2150
auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
2163
2151
if (const auto *VecTy = PassedType->getAs <VectorType>())
2164
2152
return VecTy->getElementType ()->isDoubleType ();
2165
2153
return false ;
2166
2154
};
2167
- return CheckArgTypesAreCorrect (S, TheCall, NumArgs,
2168
- ExpectedType, checkDoubleVector);
2155
+ return CheckAllArgTypesAreCorrect (S, TheCall, S-> Context . FloatTy ,
2156
+ checkDoubleVector);
2169
2157
}
2170
-
2171
2158
static bool CheckFloatingOrIntRepresentation (Sema *S, CallExpr *TheCall) {
2172
2159
auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool {
2173
2160
return !PassedType->hasIntegerRepresentation () &&
@@ -2481,8 +2468,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
2481
2468
return true ;
2482
2469
if (SemaRef.BuiltinVectorToScalarMath (TheCall))
2483
2470
return true ;
2484
- if (CheckNoDoubleVectors (&SemaRef, TheCall,
2485
- TheCall->getNumArgs (), SemaRef.Context .FloatTy ))
2471
+ if (CheckNoDoubleVectors (&SemaRef, TheCall))
2486
2472
return true ;
2487
2473
break ;
2488
2474
}
0 commit comments