Lines Matching refs:Loc
35 SourceLocation Loc, bool &Res) { in lookupMember() argument
37 LookupResult LR(S, DN, Loc, Sema::LookupMemberName); in lookupMember()
46 SourceLocation Loc) { in lookupMember() argument
48 lookupMember(S, Name, RD, Loc, Res); in lookupMember()
142 SourceLocation Loc) { in lookupCoroutineHandleType() argument
150 Loc, Sema::LookupOrdinaryName); in lookupCoroutineHandleType()
152 S.Diag(Loc, diag::err_implied_coroutine_type_not_found) in lookupCoroutineHandleType()
167 TemplateArgumentListInfo Args(Loc, Loc); in lookupCoroutineHandleType()
170 S.Context.getTrivialTypeSourceInfo(PromiseType, Loc))); in lookupCoroutineHandleType()
174 S.CheckTemplateIdType(TemplateName(CoroHandle), Loc, Args); in lookupCoroutineHandleType()
177 if (S.RequireCompleteType(Loc, CoroHandleType, in lookupCoroutineHandleType()
184 static bool isValidCoroutineContext(Sema &S, SourceLocation Loc, in isValidCoroutineContext() argument
194 S.Diag(Loc, isa<ObjCMethodDecl>(S.CurContext) in isValidCoroutineContext()
213 S.Diag(Loc, diag::err_coroutine_invalid_func_context) << ID << Keyword; in isValidCoroutineContext()
252 ExprResult Sema::BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, in BuildOperatorCoawaitCall() argument
256 return CreateOverloadedUnaryOp(Loc, UO_Coawait, Functions, E); in BuildOperatorCoawaitCall()
260 SourceLocation Loc, Expr *E) { in buildOperatorCoawaitCall() argument
261 ExprResult R = SemaRef.BuildOperatorCoawaitLookupExpr(S, Loc); in buildOperatorCoawaitCall()
264 return SemaRef.BuildOperatorCoawaitCall(Loc, E, in buildOperatorCoawaitCall()
269 SourceLocation Loc) { in buildCoroutineHandle() argument
270 QualType CoroHandleType = lookupCoroutineHandleType(S, PromiseType, Loc); in buildCoroutineHandle()
275 LookupResult Found(S, &S.PP.getIdentifierTable().get("from_address"), Loc, in buildCoroutineHandle()
278 S.Diag(Loc, diag::err_coroutine_handle_missing_member) in buildCoroutineHandle()
284 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_frame, {}); in buildCoroutineHandle()
292 return S.BuildCallExpr(nullptr, FromAddr.get(), Loc, FramePtr, Loc); in buildCoroutineHandle()
302 static ExprResult buildMemberCall(Sema &S, Expr *Base, SourceLocation Loc, in buildMemberCall() argument
304 DeclarationNameInfo NameInfo(&S.PP.getIdentifierTable().get(Name), Loc); in buildMemberCall()
309 Base, Base->getType(), Loc, /*IsPtr=*/false, SS, in buildMemberCall()
318 S.Diag(Loc, diag::err_no_member) in buildMemberCall()
324 auto EndLoc = Args.empty() ? Loc : Args.back()->getEndLoc(); in buildMemberCall()
325 return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, EndLoc, nullptr); in buildMemberCall()
333 SourceLocation Loc) { in maybeTailCall() argument
344 ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", std::nullopt); in maybeTailCall()
384 return S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_resume, in maybeTailCall()
458 SourceLocation Loc, Expr *E) { in buildCoawaitCalls() argument
460 OpaqueValueExpr(Loc, E->getType(), VK_LValue, E->getObjectKind(), E); in buildCoawaitCalls()
470 ExprResult Result = buildMemberCall(S, Operand, Loc, Func, Arg); in buildCoawaitCalls()
491 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required) in buildCoawaitCalls()
499 buildCoroutineHandle(S, CoroPromise->getType(), Loc); in buildCoawaitCalls()
522 maybeTailCall(S, RetType, AwaitSuspend, Loc)) in buildCoawaitCalls()
536 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required) in buildCoawaitCalls()
554 SourceLocation Loc, StringRef Name, in buildPromiseCall() argument
559 Promise, Promise->getType().getNonReferenceType(), VK_LValue, Loc); in buildPromiseCall()
563 return buildMemberCall(S, PromiseRef.get(), Loc, Name, Args); in buildPromiseCall()
566 VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) { in buildCoroutinePromise() argument
578 : lookupPromiseType(*this, FD, Loc); in buildCoroutinePromise()
584 Context.getTrivialTypeSourceInfo(T, Loc), SC_None); in buildCoroutinePromise()
599 ExprResult ThisExpr = ActOnCXXThis(Loc); in buildCoroutinePromise()
602 ThisExpr = CreateBuiltinUnaryOp(Loc, UO_Deref, ThisExpr.get()); in buildCoroutinePromise()
670 static FunctionScopeInfo *checkCoroutineContext(Sema &S, SourceLocation Loc, in checkCoroutineContext() argument
673 if (!isValidCoroutineContext(S, Loc, Keyword)) in checkCoroutineContext()
682 ScopeInfo->setFirstCoroutineStmt(Loc, Keyword); in checkCoroutineContext()
687 if (!S.buildCoroutineParameterMoves(Loc)) in checkCoroutineContext()
690 ScopeInfo->CoroutinePromise = S.buildCoroutinePromise(Loc); in checkCoroutineContext()
793 SourceLocation Loc = Fn->getLocation(); in ActOnCoroutineBodyStart() local
797 Loc, Name, std::nullopt); in ActOnCoroutineBodyStart()
801 buildOperatorCoawaitCall(*this, SC, Loc, Operand.get()); in ActOnCoroutineBodyStart()
804 Suspend = BuildResolvedCoawaitExpr(Loc, Operand.get(), Suspend.get(), in ActOnCoroutineBodyStart()
808 Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required) in ActOnCoroutineBodyStart()
859 static bool checkSuspensionContext(Sema &S, SourceLocation Loc, in checkSuspensionContext() argument
865 S.Diag(Loc, diag::err_coroutine_unevaluated_context) << Keyword; in checkSuspensionContext()
871 S.Diag(Loc, diag::err_coroutine_within_handler) << Keyword; in checkSuspensionContext()
878 ExprResult Sema::ActOnCoawaitExpr(Scope *S, SourceLocation Loc, Expr *E) { in ActOnCoawaitExpr() argument
879 if (!checkSuspensionContext(*this, Loc, "co_await")) in ActOnCoawaitExpr()
882 if (!ActOnCoroutineBodyStart(S, Loc, "co_await")) { in ActOnCoawaitExpr()
892 ExprResult Lookup = BuildOperatorCoawaitLookupExpr(S, Loc); in ActOnCoawaitExpr()
895 return BuildUnresolvedCoawaitExpr(Loc, E, in ActOnCoawaitExpr()
899 ExprResult Sema::BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc) { in BuildOperatorCoawaitLookupExpr() argument
913 DeclarationNameInfo(OpName, Loc), /*RequiresADL*/ true, IsOverloaded, in BuildOperatorCoawaitLookupExpr()
921 ExprResult Sema::BuildUnresolvedCoawaitExpr(SourceLocation Loc, Expr *Operand, in BuildUnresolvedCoawaitExpr() argument
923 auto *FSI = checkCoroutineContext(*this, Loc, "co_await"); in BuildUnresolvedCoawaitExpr()
937 DependentCoawaitExpr(Loc, Context.DependentTy, Operand, Lookup); in BuildUnresolvedCoawaitExpr()
943 if (lookupMember(*this, "await_transform", RD, Loc)) { in BuildUnresolvedCoawaitExpr()
945 buildPromiseCall(*this, Promise, Loc, "await_transform", Operand); in BuildUnresolvedCoawaitExpr()
947 Diag(Loc, in BuildUnresolvedCoawaitExpr()
954 ExprResult Awaiter = BuildOperatorCoawaitCall(Loc, Transformed, Lookup); in BuildUnresolvedCoawaitExpr()
958 return BuildResolvedCoawaitExpr(Loc, Operand, Awaiter.get()); in BuildUnresolvedCoawaitExpr()
961 ExprResult Sema::BuildResolvedCoawaitExpr(SourceLocation Loc, Expr *Operand, in BuildResolvedCoawaitExpr() argument
963 auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await", IsImplicit); in BuildResolvedCoawaitExpr()
975 CoawaitExpr(Loc, Context.DependentTy, Operand, Awaiter, IsImplicit); in BuildResolvedCoawaitExpr()
996 CoawaitExpr(Loc, Operand, Awaiter, RSS.Results[0], RSS.Results[1], in BuildResolvedCoawaitExpr()
1002 ExprResult Sema::ActOnCoyieldExpr(Scope *S, SourceLocation Loc, Expr *E) { in ActOnCoyieldExpr() argument
1003 if (!checkSuspensionContext(*this, Loc, "co_yield")) in ActOnCoyieldExpr()
1006 if (!ActOnCoroutineBodyStart(S, Loc, "co_yield")) { in ActOnCoyieldExpr()
1013 *this, getCurFunction()->CoroutinePromise, Loc, "yield_value", E); in ActOnCoyieldExpr()
1018 Awaitable = buildOperatorCoawaitCall(*this, S, Loc, Awaitable.get()); in ActOnCoyieldExpr()
1022 return BuildCoyieldExpr(Loc, Awaitable.get()); in ActOnCoyieldExpr()
1024 ExprResult Sema::BuildCoyieldExpr(SourceLocation Loc, Expr *E) { in BuildCoyieldExpr() argument
1025 auto *Coroutine = checkCoroutineContext(*this, Loc, "co_yield"); in BuildCoyieldExpr()
1038 Expr *Res = new (Context) CoyieldExpr(Loc, Context.DependentTy, Operand, E); in BuildCoyieldExpr()
1049 *this, Coroutine->CoroutinePromise, Loc, E); in BuildCoyieldExpr()
1054 new (Context) CoyieldExpr(Loc, Operand, E, RSS.Results[0], RSS.Results[1], in BuildCoyieldExpr()
1060 StmtResult Sema::ActOnCoreturnStmt(Scope *S, SourceLocation Loc, Expr *E) { in ActOnCoreturnStmt() argument
1061 if (!ActOnCoroutineBodyStart(S, Loc, "co_return")) { in ActOnCoreturnStmt()
1065 return BuildCoreturnStmt(Loc, E); in ActOnCoreturnStmt()
1068 StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E, in BuildCoreturnStmt() argument
1070 auto *FSI = checkCoroutineContext(*this, Loc, "co_return", IsImplicit); in BuildCoreturnStmt()
1085 PC = buildPromiseCall(*this, Promise, Loc, "return_value", E); in BuildCoreturnStmt()
1088 PC = buildPromiseCall(*this, Promise, Loc, "return_void", std::nullopt); in BuildCoreturnStmt()
1095 Stmt *Res = new (Context) CoreturnStmt(Loc, E, PCE, IsImplicit); in BuildCoreturnStmt()
1100 static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) { in buildStdNoThrowDeclRef() argument
1104 LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc, in buildStdNoThrowDeclRef()
1109 S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found); in buildStdNoThrowDeclRef()
1122 ExprResult DR = S.BuildDeclRefExpr(VD, VD->getType(), VK_LValue, Loc); in buildStdNoThrowDeclRef()
1130 SourceLocation Loc) { in getTypeSourceInfoForStdAlignValT() argument
1137 static bool findDeleteForPromise(Sema &S, SourceLocation Loc, QualType PromiseType, in findDeleteForPromise() argument
1151 if (S.FindDeallocationFunction(Loc, PointeeRD, DeleteName, OperatorDelete, in findDeleteForPromise()
1169 OperatorDelete = S.FindUsualDeallocationFunction(Loc, CanProvideSize, in findDeleteForPromise()
1176 S.MarkFunctionReferenced(Loc, OperatorDelete); in findDeleteForPromise()
1250 : S(S), FD(FD), Fn(Fn), Loc(FD.getLocation()), in CoroutineStmtBuilder()
1289 S.ActOnDeclStmt(S.ConvertDeclToDeclGroup(Fn.CoroutinePromise), Loc, Loc); in makePromiseStmt()
1308 auto Loc = E->getExprLoc(); in diagReturnOnAllocFailure() local
1315 Loc = Decl->getLocation(); in diagReturnOnAllocFailure()
1320 Loc, in diagReturnOnAllocFailure()
1343 LookupResult Found(S, DN, Loc, Sema::LookupMemberName); in makeReturnOnAllocFailure()
1357 S.BuildCallExpr(nullptr, DeclNameExpr.get(), Loc, {}, Loc); in makeReturnOnAllocFailure()
1362 S.BuildReturnStmt(Loc, ReturnObjectOnAllocationFailure.get()); in makeReturnOnAllocFailure()
1378 static bool collectPlacementArgs(Sema &S, FunctionDecl &FD, SourceLocation Loc, in collectPlacementArgs() argument
1382 ExprResult ThisExpr = S.ActOnCXXThis(Loc); in collectPlacementArgs()
1385 ThisExpr = S.CreateBuiltinUnaryOp(Loc, UO_Deref, ThisExpr.get()); in collectPlacementArgs()
1416 if (S.RequireCompleteType(Loc, PromiseType, diag::err_incomplete_type)) in makeNewAndDeleteExpr()
1460 LookupResult R(S, NewName, Loc, Sema::LookupOrdinaryName); in makeNewAndDeleteExpr()
1486 S.FindAllocationFunctions(Loc, SourceRange(), NewScope, in makeNewAndDeleteExpr()
1497 if (PromiseContainsNew && !collectPlacementArgs(S, FD, Loc, PlacementArgs)) in makeNewAndDeleteExpr()
1560 auto *StdNoThrow = buildStdNoThrowDeclRef(S, Loc); in makeNewAndDeleteExpr()
1579 S.Diag(Loc, diag::err_coroutine_unusable_new) << PromiseType << &FD; in makeNewAndDeleteExpr()
1581 S.Diag(Loc, diag::err_coroutine_unfound_nothrow_new) in makeNewAndDeleteExpr()
1593 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required) in makeNewAndDeleteExpr()
1600 if (!findDeleteForPromise(S, Loc, PromiseType, OperatorDelete)) { in makeNewAndDeleteExpr()
1608 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_frame, {}); in makeNewAndDeleteExpr()
1611 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_size, {}); in makeNewAndDeleteExpr()
1617 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_align, {}); in makeNewAndDeleteExpr()
1619 TypeSourceInfo *AlignValTy = getTypeSourceInfoForStdAlignValT(S, Loc); in makeNewAndDeleteExpr()
1623 FrameAlignment = S.BuildCXXNamedCast(Loc, tok::kw_static_cast, AlignValTy, in makeNewAndDeleteExpr()
1624 FrameAlignment, SourceRange(Loc, Loc), in makeNewAndDeleteExpr()
1625 SourceRange(Loc, Loc)) in makeNewAndDeleteExpr()
1631 S.BuildDeclRefExpr(OperatorNew, OperatorNew->getType(), VK_LValue, Loc); in makeNewAndDeleteExpr()
1643 S.BuildCallExpr(S.getCurScope(), NewRef.get(), Loc, NewArgs, Loc); in makeNewAndDeleteExpr()
1653 S.BuildDeclRefExpr(OperatorDelete, OpDeleteQualType, VK_LValue, Loc); in makeNewAndDeleteExpr()
1658 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_free, {FramePtr}); in makeNewAndDeleteExpr()
1693 S.BuildCallExpr(S.getCurScope(), DeleteRef.get(), Loc, DeleteArgs, Loc); in makeNewAndDeleteExpr()
1718 lookupMember(S, "return_void", PromiseRecordDecl, Loc, HasRVoid); in makeOnFallthrough()
1720 lookupMember(S, "return_value", PromiseRecordDecl, Loc, HasRValue); in makeOnFallthrough()
1768 if (!lookupMember(S, "unhandled_exception", PromiseRecordDecl, Loc)) { in makeOnException()
1774 S.Diag(Loc, DiagID) << PromiseRecordDecl; in makeOnException()
1785 S, Fn.CoroutinePromise, Loc, "unhandled_exception", std::nullopt); in makeOnException()
1786 UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc, in makeOnException()
1808 ExprResult ReturnObject = buildPromiseCall(S, Fn.CoroutinePromise, Loc, in makeReturnObject()
1850 S.ActOnFinishFullExpr(this->ReturnValue, Loc, /*DiscardedValue*/ false); in makeGroDeclAndReturnStmt()
1862 InitializedEntity::InitializeResult(Loc, FnRetType); in makeGroDeclAndReturnStmt()
1871 ReturnStmt = S.BuildReturnStmt(Loc, ReturnValue); in makeGroDeclAndReturnStmt()
1876 S.Context.getTrivialTypeSourceInfo(GroType, Loc), SC_None); in makeGroDeclAndReturnStmt()
1901 S.ActOnDeclStmt(S.ConvertDeclToDeclGroup(GroDecl), Loc, Loc); in makeGroDeclAndReturnStmt()
1907 ExprResult declRef = S.BuildDeclRefExpr(GroDecl, GroType, VK_LValue, Loc); in makeGroDeclAndReturnStmt()
1911 ReturnStmt = S.BuildReturnStmt(Loc, declRef.get()); in makeGroDeclAndReturnStmt()
1944 static VarDecl *buildVarDecl(Sema &S, SourceLocation Loc, QualType Type, in buildVarDecl() argument
1946 TypeSourceInfo *TInfo = S.Context.getTrivialTypeSourceInfo(Type, Loc); in buildVarDecl()
1947 VarDecl *Decl = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, II, Type, in buildVarDecl()
1955 bool Sema::buildCoroutineParameterMoves(SourceLocation Loc) { in buildCoroutineParameterMoves() argument
1978 ExprValueKind::VK_LValue, Loc); // FIXME: scope? in buildCoroutineParameterMoves()
1994 auto *D = buildVarDecl(*this, Loc, PD->getType(), PD->getIdentifier()); in buildCoroutineParameterMoves()
1998 StmtResult Stmt = ActOnDeclStmt(ConvertDeclToDeclGroup(D), Loc, Loc); in buildCoroutineParameterMoves()