@@ -7089,15 +7089,21 @@ class Sema final {
70897089 std::nullopt);
70907090
70917091 /// Endow the lambda scope info with the relevant properties.
7092- void buildLambdaScope(sema::LambdaScopeInfo *LSI,
7093- CXXMethodDecl *CallOperator,
7092+ void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
70947093 SourceRange IntroducerRange,
70957094 LambdaCaptureDefault CaptureDefault,
7096- SourceLocation CaptureDefaultLoc,
7097- bool ExplicitParams,
7098- bool ExplicitResultType,
7095+ SourceLocation CaptureDefaultLoc, bool ExplicitParams,
70997096 bool Mutable);
71007097
7098+ CXXMethodDecl *CreateLambdaCallOperator(SourceRange IntroducerRange,
7099+ CXXRecordDecl *Class);
7100+ void CompleteLambdaCallOperator(
7101+ CXXMethodDecl *Method, SourceLocation LambdaLoc,
7102+ SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
7103+ TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
7104+ StorageClass SC, ArrayRef<ParmVarDecl *> Params,
7105+ bool HasExplicitResultType);
7106+
71017107 /// Perform initialization analysis of the init-capture and perform
71027108 /// any implicit conversions such as an lvalue-to-rvalue conversion if
71037109 /// not being used to initialize a reference.
@@ -7118,11 +7124,9 @@ class Sema final {
71187124 ///
71197125 /// CodeGen handles emission of lambda captures, ignoring these dummy
71207126 /// variables appropriately.
7121- VarDecl *createLambdaInitCaptureVarDecl(SourceLocation Loc,
7122- QualType InitCaptureType,
7123- SourceLocation EllipsisLoc,
7124- IdentifierInfo *Id,
7125- unsigned InitStyle, Expr *Init);
7127+ VarDecl *createLambdaInitCaptureVarDecl(
7128+ SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
7129+ IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx);
71267130
71277131 /// Add an init-capture to a lambda scope.
71287132 void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var,
@@ -7132,28 +7136,38 @@ class Sema final {
71327136 /// given lambda.
71337137 void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI);
71347138
7135- /// \brief This is called after parsing the explicit template parameter list
7139+ /// Deduce a block or lambda's return type based on the return
7140+ /// statements present in the body.
7141+ void deduceClosureReturnType(sema::CapturingScopeInfo &CSI);
7142+
7143+ /// Once the Lambdas capture are known, we can start to create the closure,
7144+ /// call operator method, and keep track of the captures.
7145+ /// We do the capture lookup here, but they are not actually captured until
7146+ /// after we know what the qualifiers of the call operator are.
7147+ void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
7148+ Scope *CurContext);
7149+
7150+ /// This is called after parsing the explicit template parameter list
71367151 /// on a lambda (if it exists) in C++2a.
7137- void ActOnLambdaExplicitTemplateParameterList(SourceLocation LAngleLoc,
7152+ void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro,
7153+ SourceLocation LAngleLoc,
71387154 ArrayRef<NamedDecl *> TParams,
71397155 SourceLocation RAngleLoc,
71407156 ExprResult RequiresClause);
71417157
7142- /// Introduce the lambda parameters into scope.
7143- void addLambdaParameters(
7144- ArrayRef<LambdaIntroducer::LambdaCapture> Captures,
7145- CXXMethodDecl *CallOperator, Scope *CurScope);
7158+ void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro,
7159+ SourceLocation MutableLoc);
71467160
7147- /// Deduce a block or lambda's return type based on the return
7148- /// statements present in the body.
7149- void deduceClosureReturnType(sema::CapturingScopeInfo &CSI );
7161+ void ActOnLambdaClosureParameters(
7162+ Scope *LambdaScope,
7163+ MutableArrayRef<DeclaratorChunk::ParamInfo> ParamInfo );
71507164
71517165 /// ActOnStartOfLambdaDefinition - This is called just before we start
71527166 /// parsing the body of a lambda; it analyzes the explicit captures and
71537167 /// arguments, and sets up various data-structures for the body of the
71547168 /// lambda.
71557169 void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
7156- Declarator &ParamInfo, Scope *CurScope );
7170+ Declarator &ParamInfo, const DeclSpec &DS );
71577171
71587172 /// ActOnLambdaError - If there is an error parsing a lambda, this callback
71597173 /// is invoked to pop the information about the lambda.
@@ -7248,6 +7262,13 @@ class Sema final {
72487262 LocalInstantiationScope &Scope,
72497263 const MultiLevelTemplateArgumentList &TemplateArgs);
72507264
7265+ /// Introduce the instantiated captures of the lambda into the local
7266+ /// instantiation scope.
7267+ bool addInstantiatedCapturesToScope(
7268+ FunctionDecl *Function, const FunctionDecl *PatternDecl,
7269+ LocalInstantiationScope &Scope,
7270+ const MultiLevelTemplateArgumentList &TemplateArgs);
7271+
72517272 /// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
72527273 /// the case of lambdas) set up the LocalInstantiationScope of the current
72537274 /// function.
0 commit comments