@@ -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>();
@@ -2050,10 +2050,6 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall, unsigned NumA
20502050 return false ;
20512051}
20522052
2053- static bool CheckVectorElementCallArgs (Sema *S, CallExpr *TheCall) {
2054- return CheckVectorElementCallArgs (S, TheCall, TheCall->getNumArgs ());
2055- }
2056-
20572053static bool CheckAllArgsHaveSameType (Sema *S, CallExpr *TheCall) {
20582054 assert (TheCall->getNumArgs () > 1 );
20592055 QualType ArgTy0 = TheCall->getArg (0 )->getType ();
@@ -2096,10 +2092,10 @@ static bool CheckArgTypeIsCorrect(
20962092 return false ;
20972093}
20982094
2099- static bool CheckArgTypesAreCorrect (
2100- Sema *S, CallExpr *TheCall, unsigned NumArgs, QualType ExpectedType,
2095+ static bool CheckAllArgTypesAreCorrect (
2096+ Sema *S, CallExpr *TheCall, QualType ExpectedType,
21012097 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) {
21032099 Expr *Arg = TheCall->getArg (i);
21042100 if (CheckArgTypeIsCorrect (S, Arg, ExpectedType, Check)) {
21052101 return true ;
@@ -2108,13 +2104,6 @@ static bool CheckArgTypesAreCorrect(
21082104 return false ;
21092105}
21102106
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-
21182107static bool CheckAllArgsHaveFloatRepresentation (Sema *S, CallExpr *TheCall) {
21192108 auto checkAllFloatTypes = [](clang::QualType PassedType) -> bool {
21202109 return !PassedType->hasFloatingRepresentation ();
@@ -2158,17 +2147,15 @@ static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall,
21582147 return true ;
21592148}
21602149
2161- static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall,
2162- unsigned NumArgs, QualType ExpectedType) {
2150+ static bool CheckNoDoubleVectors (Sema *S, CallExpr *TheCall) {
21632151 auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
21642152 if (const auto *VecTy = PassedType->getAs <VectorType>())
21652153 return VecTy->getElementType ()->isDoubleType ();
21662154 return false ;
21672155 };
2168- return CheckArgTypesAreCorrect (S, TheCall, NumArgs,
2169- ExpectedType, checkDoubleVector);
2156+ return CheckAllArgTypesAreCorrect (S, TheCall, S-> Context . FloatTy ,
2157+ checkDoubleVector);
21702158}
2171-
21722159static bool CheckFloatingOrIntRepresentation (Sema *S, CallExpr *TheCall) {
21732160 auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool {
21742161 return !PassedType->hasIntegerRepresentation () &&
@@ -2484,8 +2471,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24842471 return true ;
24852472 if (SemaRef.BuiltinVectorToScalarMath (TheCall))
24862473 return true ;
2487- if (CheckNoDoubleVectors (&SemaRef, TheCall,
2488- TheCall->getNumArgs (), SemaRef.Context .FloatTy ))
2474+ if (CheckNoDoubleVectors (&SemaRef, TheCall))
24892475 return true ;
24902476 break ;
24912477 }
0 commit comments