@@ -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>();
@@ -2050,10 +2050,6 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
2050
2050
return false ;
2051
2051
}
2052
2052
2053
- static bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall) {
2054
- return CheckVectorElementCallArgs (S, TheCall, TheCall->getNumArgs ());
2055
- }
2056
-
2057
2053
static bool CheckAllArgsHaveSameType (Sema *S, CallExpr *TheCall) {
2058
2054
assert (TheCall->getNumArgs () > 1 );
2059
2055
QualType ArgTy0 = TheCall->getArg (0 )->getType ();
@@ -2096,10 +2092,10 @@ static bool CheckArgTypeIsCorrect(
2096
2092
return false ;
2097
2093
}
2098
2094
2099
- static bool CheckArgTypesAreCorrect (
2100
- Sema *S, CallExpr *TheCall, unsigned NumArgs, QualType ExpectedType,
2095
+ static bool CheckAllArgTypesAreCorrect (
2096
+ Sema *S, CallExpr *TheCall, QualType ExpectedType,
2101
2097
llvm::function_ref<bool (clang::QualType PassedType)> Check) {
2102
- for (unsigned i = 0 ; i < NumArgs ; ++i) {
2098
+ for (unsigned i = 0 ; i < TheCall-> getNumArgs () ; ++i) {
2103
2099
Expr *Arg = TheCall->getArg (i);
2104
2100
if (CheckArgTypeIsCorrect (S, Arg, ExpectedType, Check)) {
2105
2101
return true ;
@@ -2108,13 +2104,6 @@ static bool CheckArgTypesAreCorrect(
2108
2104
return false ;
2109
2105
}
2110
2106
2111
- static bool CheckAllArgTypesAreCorrect (
2112
- Sema *S, CallExpr *TheCall, QualType ExpectedType,
2113
- llvm::function_ref<bool (clang::QualType PassedType)> Check) {
2114
- return CheckArgTypesAreCorrect (S, TheCall, TheCall->getNumArgs (),
2115
- ExpectedType, Check);
2116
- }
2117
-
2118
2107
static bool CheckAllArgsHaveFloatRepresentation (Sema *S, CallExpr *TheCall) {
2119
2108
auto checkAllFloatTypes = [](clang::QualType PassedType) -> bool {
2120
2109
return !PassedType->hasFloatingRepresentation ();
@@ -2158,17 +2147,15 @@ static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall,
2158
2147
return true ;
2159
2148
}
2160
2149
2161
- static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall,
2162
- unsigned NumArgs, QualType ExpectedType) {
2150
+ static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall) {
2163
2151
auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
2164
2152
if (const auto *VecTy = PassedType->getAs <VectorType>())
2165
2153
return VecTy->getElementType ()->isDoubleType ();
2166
2154
return false ;
2167
2155
};
2168
- return CheckArgTypesAreCorrect (S, TheCall, NumArgs,
2169
- ExpectedType, checkDoubleVector);
2156
+ return CheckAllArgTypesAreCorrect (S, TheCall, S-> Context . FloatTy ,
2157
+ checkDoubleVector);
2170
2158
}
2171
-
2172
2159
static bool CheckFloatingOrIntRepresentation (Sema *S, CallExpr *TheCall) {
2173
2160
auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool {
2174
2161
return !PassedType->hasIntegerRepresentation () &&
@@ -2484,8 +2471,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
2484
2471
return true ;
2485
2472
if (SemaRef.BuiltinVectorToScalarMath (TheCall))
2486
2473
return true ;
2487
- if (CheckNoDoubleVectors (&SemaRef, TheCall,
2488
- TheCall->getNumArgs (), SemaRef.Context .FloatTy ))
2474
+ if (CheckNoDoubleVectors (&SemaRef, TheCall))
2489
2475
return true ;
2490
2476
break ;
2491
2477
}
0 commit comments