Lines Matching defs:TheCall

1929 static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
1930 assert(TheCall->getNumArgs() > 1);
1931 ExprResult A = TheCall->getArg(0);
1936 SourceLocation BuiltinLoc = TheCall->getBeginLoc();
1939 for (unsigned i = 1; i < TheCall->getNumArgs(); ++i) {
1940 ExprResult B = TheCall->getArg(i);
1949 << TheCall->getDirectCallee() << /*useAllTerminology*/ true
1958 S->Diag(TheCall->getBeginLoc(),
1960 << TheCall->getDirectCallee() << /*useAllTerminology*/ true
1969 << TheCall->getDirectCallee() << /*useAllTerminology*/ true
1982 << TheCall->getDirectCallee() << /*useAllTerminology*/ true
2015 Sema *S, CallExpr *TheCall, QualType ExpectedType,
2017 for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) {
2018 Expr *Arg = TheCall->getArg(i);
2026 static bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) {
2030 return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.FloatTy,
2034 static bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {
2042 return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.FloatTy,
2046 static bool CheckModifiableLValue(Sema *S, CallExpr *TheCall,
2048 auto *Arg = TheCall->getArg(ArgIndex);
2057 static bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
2063 return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.FloatTy,
2066 static bool CheckFloatingOrIntRepresentation(Sema *S, CallExpr *TheCall) {
2071 return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.IntTy,
2075 static bool CheckUnsignedIntRepresentation(Sema *S, CallExpr *TheCall) {
2079 return CheckAllArgTypesAreCorrect(S, TheCall, S->Context.UnsignedIntTy,
2083 static void SetElementTypeAsReturnType(Sema *S, CallExpr *TheCall,
2085 auto *VecTyA = TheCall->getArg(0)->getType()->getAs<VectorType>();
2089 TheCall->setType(ReturnType);
2092 static bool CheckScalarOrVector(Sema *S, CallExpr *TheCall, QualType Scalar,
2094 assert(TheCall->getNumArgs() >= ArgIndex);
2095 QualType ArgType = TheCall->getArg(ArgIndex)->getType();
2101 S->Diag(TheCall->getArg(0)->getBeginLoc(),
2109 static bool CheckAnyScalarOrVector(Sema *S, CallExpr *TheCall,
2111 assert(TheCall->getNumArgs() >= ArgIndex);
2112 QualType ArgType = TheCall->getArg(ArgIndex)->getType();
2117 S->Diag(TheCall->getArg(0)->getBeginLoc(),
2125 static bool CheckWaveActive(Sema *S, CallExpr *TheCall) {
2127 assert(TheCall->getNumArgs() >= 1);
2128 QualType ArgType = TheCall->getArg(0)->getType();
2134 S->Diag(TheCall->getArg(0)->getBeginLoc(),
2142 static bool CheckBoolSelect(Sema *S, CallExpr *TheCall) {
2143 assert(TheCall->getNumArgs() == 3);
2144 Expr *Arg1 = TheCall->getArg(1);
2145 Expr *Arg2 = TheCall->getArg(2);
2147 S->Diag(TheCall->getBeginLoc(),
2154 TheCall->setType(Arg1->getType());
2158 static bool CheckVectorSelect(Sema *S, CallExpr *TheCall) {
2159 assert(TheCall->getNumArgs() == 3);
2160 Expr *Arg1 = TheCall->getArg(1);
2161 Expr *Arg2 = TheCall->getArg(2);
2164 << "Second" << TheCall->getDirectCallee() << Arg1->getType()
2171 << "Third" << TheCall->getDirectCallee() << Arg2->getType()
2177 S->Diag(TheCall->getBeginLoc(),
2186 if (TheCall->getArg(0)->getType()->getAs<VectorType>()->getNumElements() !=
2188 S->Diag(TheCall->getBeginLoc(),
2190 << TheCall->getArg(0)->getType() << Arg1->getType()
2191 << TheCall->getArg(0)->getSourceRange() << Arg1->getSourceRange();
2194 TheCall->setType(Arg1->getType());
2199 Sema *S, CallExpr *TheCall, unsigned ArgIndex,
2202 assert(TheCall->getNumArgs() >= ArgIndex);
2203 QualType ArgType = TheCall->getArg(ArgIndex)->getType();
2207 S->Diag(TheCall->getArg(ArgIndex)->getBeginLoc(),
2213 S->Diag(TheCall->getArg(ArgIndex)->getExprLoc(),
2223 bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
2226 if (SemaRef.checkArgCount(TheCall, 2) ||
2227 CheckResourceHandle(&SemaRef, TheCall, 0) ||
2228 CheckArgTypeMatches(&SemaRef, TheCall->getArg(1),
2233 TheCall->getArg(0)->getType()->castAs<HLSLAttributedResourceType>();
2236 TheCall->setType(getASTContext().getPointerType(ContainedTy));
2237 TheCall->setValueKind(VK_LValue);
2243 if (SemaRef.checkArgCount(TheCall, 1))
2248 if (SemaRef.checkArgCount(TheCall, 2))
2250 if (CheckUnsignedIntRepresentation(&SemaRef, TheCall))
2253 SetElementTypeAsReturnType(&SemaRef, TheCall, getASTContext().DoubleTy);
2257 if (SemaRef.checkArgCount(TheCall, 3))
2259 if (CheckVectorElementCallArgs(&SemaRef, TheCall))
2262 TheCall, /*CheckForFloatArgs*/
2263 TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
2268 if (SemaRef.checkArgCount(TheCall, 2))
2270 if (CheckVectorElementCallArgs(&SemaRef, TheCall))
2272 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2276 TheCall->getArg(0)->getType()->castAs<VectorType>()->getNumElements();
2278 TheCall->getArg(1)->getType()->castAs<VectorType>()->getNumElements();
2282 SemaRef.Diag(TheCall->getBeginLoc(),
2290 SemaRef.Diag(TheCall->getBeginLoc(),
2296 ExprResult A = TheCall->getArg(0);
2299 TheCall->setType(ArgTyA);
2303 if (SemaRef.checkArgCount(TheCall, 2))
2305 if (CheckVectorElementCallArgs(&SemaRef, TheCall))
2307 if (SemaRef.BuiltinVectorToScalarMath(TheCall))
2309 if (CheckNoDoubleVectors(&SemaRef, TheCall))
2315 if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
2318 const Expr *Arg = TheCall->getArg(0);
2336 TheCall->setType(ResTy);
2340 if (SemaRef.checkArgCount(TheCall, 3))
2342 if (CheckScalarOrVector(&SemaRef, TheCall, getASTContext().BoolTy, 0))
2344 QualType ArgTy = TheCall->getArg(0)->getType();
2345 if (ArgTy->isBooleanType() && CheckBoolSelect(&SemaRef, TheCall))
2349 CheckVectorSelect(&SemaRef, TheCall))
2355 if (CheckAllArgsHaveFloatRepresentation(&SemaRef, TheCall))
2357 if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
2365 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2367 if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
2372 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2374 if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
2376 SetElementTypeAsReturnType(&SemaRef, TheCall, getASTContext().BoolTy);
2380 if (SemaRef.checkArgCount(TheCall, 3))
2382 if (CheckVectorElementCallArgs(&SemaRef, TheCall))
2384 if (SemaRef.BuiltinElementwiseTernaryMath(TheCall))
2386 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2391 if (SemaRef.checkArgCount(TheCall, 3))
2393 if (CheckVectorElementCallArgs(&SemaRef, TheCall))
2396 TheCall, /*CheckForFloatArgs*/
2397 TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
2402 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2404 if (SemaRef.checkArgCount(TheCall, 1))
2407 ExprResult A = TheCall->getArg(0);
2410 TheCall->setType(ArgTyA);
2414 if (CheckFloatingOrIntRepresentation(&SemaRef, TheCall))
2416 if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
2418 SetElementTypeAsReturnType(&SemaRef, TheCall, getASTContext().IntTy);
2422 if (SemaRef.checkArgCount(TheCall, 2))
2424 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2427 ExprResult A = TheCall->getArg(0);
2430 TheCall->setType(ArgTyA);
2435 if (SemaRef.checkArgCount(TheCall, 1))
2439 if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
2441 if (CheckWaveActive(&SemaRef, TheCall))
2443 ExprResult Expr = TheCall->getArg(0);
2445 TheCall->setType(ArgTyExpr);
2451 if (CheckUnsignedIntRepresentation(&SemaRef, TheCall))
2456 if (SemaRef.checkArgCount(TheCall, 2))
2460 ExprResult Index = TheCall->getArg(1);
2463 SemaRef.Diag(TheCall->getArg(1)->getBeginLoc(),
2470 if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
2473 ExprResult Expr = TheCall->getArg(0);
2475 TheCall->setType(ArgTyExpr);
2479 if (SemaRef.checkArgCount(TheCall, 0))
2484 if (SemaRef.checkArgCount(TheCall, 3))
2487 if (CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.DoubleTy, 0) ||
2488 CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.UnsignedIntTy,
2490 CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.UnsignedIntTy,
2494 if (CheckModifiableLValue(&SemaRef, TheCall, 1) ||
2495 CheckModifiableLValue(&SemaRef, TheCall, 2))
2500 if (SemaRef.checkArgCount(TheCall, 1))
2503 if (CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.FloatTy, 0))
2529 if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
2538 if (SemaRef.checkArgCount(TheCall, 2) ||
2539 CheckResourceHandle(&SemaRef, TheCall, 0, checkResTy) ||
2540 CheckArgTypeMatches(&SemaRef, TheCall->getArg(1),
2543 Expr *OffsetExpr = TheCall->getArg(1);
2547 SemaRef.Diag(TheCall->getArg(1)->getBeginLoc(),