Lines Matching defs:Loc
35 SourceLocation Loc, bool &Res) {
37 LookupResult LR(S, DN, Loc, Sema::LookupMemberName);
46 SourceLocation Loc) {
48 lookupMember(S, Name, RD, Loc, Res);
142 SourceLocation Loc) {
150 Loc, Sema::LookupOrdinaryName);
152 S.Diag(Loc, diag::err_implied_coroutine_type_not_found)
167 TemplateArgumentListInfo Args(Loc, Loc);
170 S.Context.getTrivialTypeSourceInfo(PromiseType, Loc)));
174 S.CheckTemplateIdType(TemplateName(CoroHandle), Loc, Args);
177 if (S.RequireCompleteType(Loc, CoroHandleType,
184 static bool isValidCoroutineContext(Sema &S, SourceLocation Loc,
194 S.Diag(Loc, isa<ObjCMethodDecl>(S.CurContext)
213 S.Diag(Loc, diag::err_coroutine_invalid_func_context) << ID << Keyword;
252 ExprResult Sema::BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E,
256 return CreateOverloadedUnaryOp(Loc, UO_Coawait, Functions, E);
260 SourceLocation Loc, Expr *E) {
261 ExprResult R = SemaRef.BuildOperatorCoawaitLookupExpr(S, Loc);
264 return SemaRef.BuildOperatorCoawaitCall(Loc, E,
269 SourceLocation Loc) {
270 QualType CoroHandleType = lookupCoroutineHandleType(S, PromiseType, Loc);
275 LookupResult Found(S, &S.PP.getIdentifierTable().get("from_address"), Loc,
278 S.Diag(Loc, diag::err_coroutine_handle_missing_member)
284 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_frame, {});
292 return S.BuildCallExpr(nullptr, FromAddr.get(), Loc, FramePtr, Loc);
302 static ExprResult buildMemberCall(Sema &S, Expr *Base, SourceLocation Loc,
304 DeclarationNameInfo NameInfo(&S.PP.getIdentifierTable().get(Name), Loc);
309 Base, Base->getType(), Loc, /*IsPtr=*/false, SS,
318 S.Diag(Loc, diag::err_no_member)
324 auto EndLoc = Args.empty() ? Loc : Args.back()->getEndLoc();
325 return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, EndLoc, nullptr);
333 SourceLocation Loc) {
344 ExprResult AddressExpr = buildMemberCall(S, E, Loc, "address", std::nullopt);
374 SourceLocation Loc, Expr *E) {
376 OpaqueValueExpr(Loc, E->getType(), VK_LValue, E->getObjectKind(), E);
386 ExprResult Result = buildMemberCall(S, Operand, Loc, Func, Arg);
407 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
415 buildCoroutineHandle(S, CoroPromise->getType(), Loc);
434 maybeTailCall(S, RetType, AwaitSuspend, Loc))
448 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
466 SourceLocation Loc, StringRef Name,
471 Promise, Promise->getType().getNonReferenceType(), VK_LValue, Loc);
475 return buildMemberCall(S, PromiseRef.get(), Loc, Name, Args);
478 VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) {
490 : lookupPromiseType(*this, FD, Loc);
496 Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
511 ExprResult ThisExpr = ActOnCXXThis(Loc);
514 ThisExpr = CreateBuiltinUnaryOp(Loc, UO_Deref, ThisExpr.get());
582 static FunctionScopeInfo *checkCoroutineContext(Sema &S, SourceLocation Loc,
585 if (!isValidCoroutineContext(S, Loc, Keyword))
594 ScopeInfo->setFirstCoroutineStmt(Loc, Keyword);
599 if (!S.buildCoroutineParameterMoves(Loc))
602 ScopeInfo->CoroutinePromise = S.buildCoroutinePromise(Loc);
705 SourceLocation Loc = Fn->getLocation();
709 Loc, Name, std::nullopt);
713 buildOperatorCoawaitCall(*this, SC, Loc, Operand.get());
716 Suspend = BuildResolvedCoawaitExpr(Loc, Operand.get(), Suspend.get(),
720 Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
771 static bool checkSuspensionContext(Sema &S, SourceLocation Loc,
777 S.Diag(Loc, diag::err_coroutine_unevaluated_context) << Keyword;
783 S.Diag(Loc, diag::err_coroutine_within_handler) << Keyword;
790 ExprResult Sema::ActOnCoawaitExpr(Scope *S, SourceLocation Loc, Expr *E) {
791 if (!checkSuspensionContext(*this, Loc, "co_await"))
794 if (!ActOnCoroutineBodyStart(S, Loc, "co_await")) {
804 ExprResult Lookup = BuildOperatorCoawaitLookupExpr(S, Loc);
807 return BuildUnresolvedCoawaitExpr(Loc, E,
811 ExprResult Sema::BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc) {
822 DeclarationNameInfo(OpName, Loc), /*RequiresADL*/ true, Functions.begin(),
831 ExprResult Sema::BuildUnresolvedCoawaitExpr(SourceLocation Loc, Expr *Operand,
833 auto *FSI = checkCoroutineContext(*this, Loc, "co_await");
847 DependentCoawaitExpr(Loc, Context.DependentTy, Operand, Lookup);
853 if (lookupMember(*this, "await_transform", RD, Loc)) {
855 buildPromiseCall(*this, Promise, Loc, "await_transform", Operand);
857 Diag(Loc,
864 ExprResult Awaiter = BuildOperatorCoawaitCall(Loc, Transformed, Lookup);
868 return BuildResolvedCoawaitExpr(Loc, Operand, Awaiter.get());
871 ExprResult Sema::BuildResolvedCoawaitExpr(SourceLocation Loc, Expr *Operand,
873 auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await", IsImplicit);
885 CoawaitExpr(Loc, Context.DependentTy, Operand, Awaiter, IsImplicit);
906 CoawaitExpr(Loc, Operand, Awaiter, RSS.Results[0], RSS.Results[1],
912 ExprResult Sema::ActOnCoyieldExpr(Scope *S, SourceLocation Loc, Expr *E) {
913 if (!checkSuspensionContext(*this, Loc, "co_yield"))
916 if (!ActOnCoroutineBodyStart(S, Loc, "co_yield")) {
923 *this, getCurFunction()->CoroutinePromise, Loc, "yield_value", E);
928 Awaitable = buildOperatorCoawaitCall(*this, S, Loc, Awaitable.get());
932 return BuildCoyieldExpr(Loc, Awaitable.get());
934 ExprResult Sema::BuildCoyieldExpr(SourceLocation Loc, Expr *E) {
935 auto *Coroutine = checkCoroutineContext(*this, Loc, "co_yield");
948 Expr *Res = new (Context) CoyieldExpr(Loc, Context.DependentTy, Operand, E);
959 *this, Coroutine->CoroutinePromise, Loc, E);
964 new (Context) CoyieldExpr(Loc, Operand, E, RSS.Results[0], RSS.Results[1],
970 StmtResult Sema::ActOnCoreturnStmt(Scope *S, SourceLocation Loc, Expr *E) {
971 if (!ActOnCoroutineBodyStart(S, Loc, "co_return")) {
975 return BuildCoreturnStmt(Loc, E);
978 StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E,
980 auto *FSI = checkCoroutineContext(*this, Loc, "co_return", IsImplicit);
995 PC = buildPromiseCall(*this, Promise, Loc, "return_value", E);
998 PC = buildPromiseCall(*this, Promise, Loc, "return_void", std::nullopt);
1005 Stmt *Res = new (Context) CoreturnStmt(Loc, E, PCE, IsImplicit);
1010 static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) {
1014 LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc,
1019 S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
1032 ExprResult DR = S.BuildDeclRefExpr(VD, VD->getType(), VK_LValue, Loc);
1040 SourceLocation Loc) {
1047 static bool findDeleteForPromise(Sema &S, SourceLocation Loc, QualType PromiseType,
1061 if (S.FindDeallocationFunction(Loc, PointeeRD, DeleteName, OperatorDelete,
1079 OperatorDelete = S.FindUsualDeallocationFunction(Loc, CanProvideSize,
1086 S.MarkFunctionReferenced(Loc, OperatorDelete);
1160 : S(S), FD(FD), Fn(Fn), Loc(FD.getLocation()),
1199 S.ActOnDeclStmt(S.ConvertDeclToDeclGroup(Fn.CoroutinePromise), Loc, Loc);
1218 auto Loc = E->getExprLoc();
1225 Loc = Decl->getLocation();
1230 Loc,
1253 LookupResult Found(S, DN, Loc, Sema::LookupMemberName);
1267 S.BuildCallExpr(nullptr, DeclNameExpr.get(), Loc, {}, Loc);
1272 S.BuildReturnStmt(Loc, ReturnObjectOnAllocationFailure.get());
1288 static bool collectPlacementArgs(Sema &S, FunctionDecl &FD, SourceLocation Loc,
1292 ExprResult ThisExpr = S.ActOnCXXThis(Loc);
1295 ThisExpr = S.CreateBuiltinUnaryOp(Loc, UO_Deref, ThisExpr.get());
1326 if (S.RequireCompleteType(Loc, PromiseType, diag::err_incomplete_type))
1370 LookupResult R(S, NewName, Loc, Sema::LookupOrdinaryName);
1396 S.FindAllocationFunctions(Loc, SourceRange(), NewScope,
1407 if (PromiseContainsNew && !collectPlacementArgs(S, FD, Loc, PlacementArgs))
1470 auto *StdNoThrow = buildStdNoThrowDeclRef(S, Loc);
1489 S.Diag(Loc, diag::err_coroutine_unusable_new) << PromiseType << &FD;
1491 S.Diag(Loc, diag::err_coroutine_unfound_nothrow_new)
1503 S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
1510 if (!findDeleteForPromise(S, Loc, PromiseType, OperatorDelete)) {
1518 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_frame, {});
1521 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_size, {});
1527 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_align, {});
1529 TypeSourceInfo *AlignValTy = getTypeSourceInfoForStdAlignValT(S, Loc);
1533 FrameAlignment = S.BuildCXXNamedCast(Loc, tok::kw_static_cast, AlignValTy,
1534 FrameAlignment, SourceRange(Loc, Loc),
1535 SourceRange(Loc, Loc))
1541 S.BuildDeclRefExpr(OperatorNew, OperatorNew->getType(), VK_LValue, Loc);
1553 S.BuildCallExpr(S.getCurScope(), NewRef.get(), Loc, NewArgs, Loc);
1563 S.BuildDeclRefExpr(OperatorDelete, OpDeleteQualType, VK_LValue, Loc);
1568 S.BuildBuiltinCallExpr(Loc, Builtin::BI__builtin_coro_free, {FramePtr});
1603 S.BuildCallExpr(S.getCurScope(), DeleteRef.get(), Loc, DeleteArgs, Loc);
1628 lookupMember(S, "return_void", PromiseRecordDecl, Loc, HasRVoid);
1630 lookupMember(S, "return_value", PromiseRecordDecl, Loc, HasRValue);
1678 if (!lookupMember(S, "unhandled_exception", PromiseRecordDecl, Loc)) {
1684 S.Diag(Loc, DiagID) << PromiseRecordDecl;
1695 S, Fn.CoroutinePromise, Loc, "unhandled_exception", std::nullopt);
1696 UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc,
1718 ExprResult ReturnObject = buildPromiseCall(S, Fn.CoroutinePromise, Loc,
1760 S.ActOnFinishFullExpr(this->ReturnValue, Loc, /*DiscardedValue*/ false);
1772 InitializedEntity::InitializeResult(Loc, FnRetType);
1781 ReturnStmt = S.BuildReturnStmt(Loc, ReturnValue);
1786 S.Context.getTrivialTypeSourceInfo(GroType, Loc), SC_None);
1811 S.ActOnDeclStmt(S.ConvertDeclToDeclGroup(GroDecl), Loc, Loc);
1817 ExprResult declRef = S.BuildDeclRefExpr(GroDecl, GroType, VK_LValue, Loc);
1821 ReturnStmt = S.BuildReturnStmt(Loc, declRef.get());
1854 static VarDecl *buildVarDecl(Sema &S, SourceLocation Loc, QualType Type,
1856 TypeSourceInfo *TInfo = S.Context.getTrivialTypeSourceInfo(Type, Loc);
1857 VarDecl *Decl = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, II, Type,
1865 bool Sema::buildCoroutineParameterMoves(SourceLocation Loc) {
1888 ExprValueKind::VK_LValue, Loc); // FIXME: scope?
1904 auto *D = buildVarDecl(*this, Loc, PD->getType(), PD->getIdentifier());
1908 StmtResult Stmt = ActOnDeclStmt(ConvertDeclToDeclGroup(D), Loc, Loc);