#include "clang/Sema/SemaLambda.h"
#include "TypeLocBuilder.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/MangleNumberingContext.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/STLExtras.h"
#include <optional>
usingnamespaceclang;
usingnamespacesema;
static inline std::optional<unsigned>
getStackIndexOfNearestEnclosingCaptureReadyLambda(
ArrayRef<const clang::sema::FunctionScopeInfo *> FunctionScopes,
ValueDecl *VarToCapture) { … }
std::optional<unsigned>
clang::getStackIndexOfNearestEnclosingCaptureCapableLambda(
ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
ValueDecl *VarToCapture, Sema &S) { … }
static inline TemplateParameterList *
getGenericLambdaTemplateParameterList(LambdaScopeInfo *LSI, Sema &SemaRef) { … }
CXXRecordDecl *
Sema::createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info,
unsigned LambdaDependencyKind,
LambdaCaptureDefault CaptureDefault) { … }
static bool isInInlineFunction(const DeclContext *DC) { … }
std::tuple<MangleNumberingContext *, Decl *>
Sema::getCurrentMangleNumberContext(const DeclContext *DC) { … }
static QualType
buildTypeForLambdaCallOperator(Sema &S, clang::CXXRecordDecl *Class,
TemplateParameterList *TemplateParams,
TypeSourceInfo *MethodTypeInfo) { … }
bool Sema::DiagnoseInvalidExplicitObjectParameterInLambda(
CXXMethodDecl *Method, SourceLocation CallLoc) { … }
void Sema::handleLambdaNumbering(
CXXRecordDecl *Class, CXXMethodDecl *Method,
std::optional<CXXRecordDecl::LambdaNumbering> NumberingOverride) { … }
static void buildLambdaScopeReturnType(Sema &S, LambdaScopeInfo *LSI,
CXXMethodDecl *CallOperator,
bool ExplicitResultType) { … }
void Sema::buildLambdaScope(LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
SourceRange IntroducerRange,
LambdaCaptureDefault CaptureDefault,
SourceLocation CaptureDefaultLoc,
bool ExplicitParams, bool Mutable) { … }
void Sema::finishLambdaExplicitCaptures(LambdaScopeInfo *LSI) { … }
void Sema::ActOnLambdaExplicitTemplateParameterList(
LambdaIntroducer &Intro, SourceLocation LAngleLoc,
ArrayRef<NamedDecl *> TParams, SourceLocation RAngleLoc,
ExprResult RequiresClause) { … }
static EnumDecl *findEnumForBlockReturn(Expr *E) { … }
static EnumDecl *findEnumForBlockReturn(ReturnStmt *ret) { … }
static EnumDecl *findCommonEnumForBlockReturns(ArrayRef<ReturnStmt*> returns) { … }
static void adjustBlockReturnsToEnum(Sema &S, ArrayRef<ReturnStmt*> returns,
QualType returnType) { … }
void Sema::deduceClosureReturnType(CapturingScopeInfo &CSI) { … }
QualType Sema::buildLambdaInitCaptureInitialization(
SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
std::optional<unsigned> NumExpansions, IdentifierInfo *Id,
bool IsDirectInit, Expr *&Init) { … }
VarDecl *Sema::createLambdaInitCaptureVarDecl(
SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx) { … }
void Sema::addInitCapture(LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef) { … }
static LambdaScopeInfo *getCurrentLambdaScopeUnsafe(Sema &S) { … }
static TypeSourceInfo *
getDummyLambdaType(Sema &S, SourceLocation Loc = SourceLocation()) { … }
static TypeSourceInfo *getLambdaType(Sema &S, LambdaIntroducer &Intro,
Declarator &ParamInfo, Scope *CurScope,
SourceLocation Loc,
bool &ExplicitResultType) { … }
CXXMethodDecl *Sema::CreateLambdaCallOperator(SourceRange IntroducerRange,
CXXRecordDecl *Class) { … }
void Sema::AddTemplateParametersToLambdaCallOperator(
CXXMethodDecl *CallOperator, CXXRecordDecl *Class,
TemplateParameterList *TemplateParams) { … }
void Sema::CompleteLambdaCallOperator(
CXXMethodDecl *Method, SourceLocation LambdaLoc,
SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
StorageClass SC, ArrayRef<ParmVarDecl *> Params,
bool HasExplicitResultType) { … }
void Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
Scope *CurrentScope) { … }
void Sema::ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro,
SourceLocation MutableLoc) { … }
void Sema::ActOnLambdaClosureParameters(
Scope *LambdaScope, MutableArrayRef<DeclaratorChunk::ParamInfo> Params) { … }
void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
Declarator &ParamInfo,
const DeclSpec &DS) { … }
void Sema::ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
bool IsInstantiation) { … }
template <typename Func>
static void repeatForLambdaConversionFunctionCallingConvs(
Sema &S, const FunctionProtoType &CallOpProto, Func F) { … }
static CallingConv
getLambdaConversionFunctionCallConv(Sema &S,
const FunctionProtoType *CallOpProto) { … }
QualType Sema::getLambdaConversionFunctionResultType(
const FunctionProtoType *CallOpProto, CallingConv CC) { … }
static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange,
CXXRecordDecl *Class,
CXXMethodDecl *CallOperator,
QualType InvokerFunctionTy) { … }
static void addFunctionPointerConversions(Sema &S, SourceRange IntroducerRange,
CXXRecordDecl *Class,
CXXMethodDecl *CallOperator) { … }
static void addBlockPointerConversion(Sema &S,
SourceRange IntroducerRange,
CXXRecordDecl *Class,
CXXMethodDecl *CallOperator) { … }
ExprResult Sema::BuildCaptureInit(const Capture &Cap,
SourceLocation ImplicitCaptureLoc,
bool IsOpenMPMapping) { … }
ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body) { … }
static LambdaCaptureDefault
mapImplicitCaptureStyle(CapturingScopeInfo::ImplicitCaptureStyle ICS) { … }
bool Sema::CaptureHasSideEffects(const Capture &From) { … }
bool Sema::DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
const Capture &From) { … }
FieldDecl *Sema::BuildCaptureField(RecordDecl *RD,
const sema::Capture &Capture) { … }
ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
LambdaScopeInfo *LSI) { … }
ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
SourceLocation ConvLocation,
CXXConversionDecl *Conv,
Expr *Src) { … }
static FunctionDecl *getPatternFunctionDecl(FunctionDecl *FD) { … }
Sema::LambdaScopeForCallOperatorInstantiationRAII::
LambdaScopeForCallOperatorInstantiationRAII(
Sema &SemaRef, FunctionDecl *FD, MultiLevelTemplateArgumentList MLTAL,
LocalInstantiationScope &Scope, bool ShouldAddDeclsFromParentScope)
: … { … }