#include "CoroutineStmtBuilder.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtCXX.h"
#include "clang/Basic/Builtins.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/SmallSet.h"
usingnamespaceclang;
usingnamespacesema;
static LookupResult lookupMember(Sema &S, const char *Name, CXXRecordDecl *RD,
SourceLocation Loc, bool &Res) { … }
static bool lookupMember(Sema &S, const char *Name, CXXRecordDecl *RD,
SourceLocation Loc) { … }
static QualType lookupPromiseType(Sema &S, const FunctionDecl *FD,
SourceLocation KwLoc) { … }
static QualType lookupCoroutineHandleType(Sema &S, QualType PromiseType,
SourceLocation Loc) { … }
static bool isValidCoroutineContext(Sema &S, SourceLocation Loc,
StringRef Keyword) { … }
ExprResult Sema::BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E,
UnresolvedLookupExpr *Lookup) { … }
static ExprResult buildOperatorCoawaitCall(Sema &SemaRef, Scope *S,
SourceLocation Loc, Expr *E) { … }
static ExprResult buildCoroutineHandle(Sema &S, QualType PromiseType,
SourceLocation Loc) { … }
struct ReadySuspendResumeResult { … };
static ExprResult buildMemberCall(Sema &S, Expr *Base, SourceLocation Loc,
StringRef Name, MultiExprArg Args) { … }
static Expr *maybeTailCall(Sema &S, QualType RetType, Expr *E,
SourceLocation Loc) { … }
static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise,
SourceLocation Loc, Expr *E) { … }
static ExprResult buildPromiseCall(Sema &S, VarDecl *Promise,
SourceLocation Loc, StringRef Name,
MultiExprArg Args) { … }
VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) { … }
static FunctionScopeInfo *checkCoroutineContext(Sema &S, SourceLocation Loc,
StringRef Keyword,
bool IsImplicit = false) { … }
static void checkNoThrow(Sema &S, const Stmt *E,
llvm::SmallPtrSetImpl<const Decl *> &ThrowingDecls) { … }
bool Sema::checkFinalSuspendNoThrow(const Stmt *FinalSuspend) { … }
static void checkReturnStmtInCoroutine(Sema &S, FunctionScopeInfo *FSI) { … }
bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc,
StringRef Keyword) { … }
static bool isWithinCatchScope(Scope *S) { … }
static bool checkSuspensionContext(Sema &S, SourceLocation Loc,
StringRef Keyword) { … }
ExprResult Sema::ActOnCoawaitExpr(Scope *S, SourceLocation Loc, Expr *E) { … }
ExprResult Sema::BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc) { … }
ExprResult Sema::BuildUnresolvedCoawaitExpr(SourceLocation Loc, Expr *Operand,
UnresolvedLookupExpr *Lookup) { … }
ExprResult Sema::BuildResolvedCoawaitExpr(SourceLocation Loc, Expr *Operand,
Expr *Awaiter, bool IsImplicit) { … }
ExprResult Sema::ActOnCoyieldExpr(Scope *S, SourceLocation Loc, Expr *E) { … }
ExprResult Sema::BuildCoyieldExpr(SourceLocation Loc, Expr *E) { … }
StmtResult Sema::ActOnCoreturnStmt(Scope *S, SourceLocation Loc, Expr *E) { … }
StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E,
bool IsImplicit) { … }
static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) { … }
static TypeSourceInfo *getTypeSourceInfoForStdAlignValT(Sema &S,
SourceLocation Loc) { … }
static bool findDeleteForPromise(Sema &S, SourceLocation Loc, QualType PromiseType,
FunctionDecl *&OperatorDelete) { … }
void Sema::CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body) { … }
static CompoundStmt *buildCoroutineBody(Stmt *Body, ASTContext &Context) { … }
CoroutineStmtBuilder::CoroutineStmtBuilder(Sema &S, FunctionDecl &FD,
sema::FunctionScopeInfo &Fn,
Stmt *Body)
: … { … }
bool CoroutineStmtBuilder::buildStatements() { … }
bool CoroutineStmtBuilder::buildDependentStatements() { … }
bool CoroutineStmtBuilder::makePromiseStmt() { … }
bool CoroutineStmtBuilder::makeInitialAndFinalSuspend() { … }
static bool diagReturnOnAllocFailure(Sema &S, Expr *E,
CXXRecordDecl *PromiseRecordDecl,
FunctionScopeInfo &Fn) { … }
bool CoroutineStmtBuilder::makeReturnOnAllocFailure() { … }
static bool collectPlacementArgs(Sema &S, FunctionDecl &FD, SourceLocation Loc,
SmallVectorImpl<Expr *> &PlacementArgs) { … }
bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { … }
bool CoroutineStmtBuilder::makeOnFallthrough() { … }
bool CoroutineStmtBuilder::makeOnException() { … }
bool CoroutineStmtBuilder::makeReturnObject() { … }
static void noteMemberDeclaredHere(Sema &S, Expr *E, FunctionScopeInfo &Fn) { … }
bool CoroutineStmtBuilder::makeGroDeclAndReturnStmt() { … }
static Expr *castForMoving(Sema &S, Expr *E, QualType T = QualType()) { … }
static VarDecl *buildVarDecl(Sema &S, SourceLocation Loc, QualType Type,
IdentifierInfo *II) { … }
bool Sema::buildCoroutineParameterMoves(SourceLocation Loc) { … }
StmtResult Sema::BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs Args) { … }
ClassTemplateDecl *Sema::lookupCoroutineTraits(SourceLocation KwLoc,
SourceLocation FuncLoc) { … }