@@ -7103,15 +7103,21 @@ class Sema final {
7103
7103
std::nullopt);
7104
7104
7105
7105
/// Endow the lambda scope info with the relevant properties.
7106
- void buildLambdaScope(sema::LambdaScopeInfo *LSI,
7107
- CXXMethodDecl *CallOperator,
7106
+ void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
7108
7107
SourceRange IntroducerRange,
7109
7108
LambdaCaptureDefault CaptureDefault,
7110
- SourceLocation CaptureDefaultLoc,
7111
- bool ExplicitParams,
7112
- bool ExplicitResultType,
7109
+ SourceLocation CaptureDefaultLoc, bool ExplicitParams,
7113
7110
bool Mutable);
7114
7111
7112
+ CXXMethodDecl *CreateLambdaCallOperator(SourceRange IntroducerRange,
7113
+ CXXRecordDecl *Class);
7114
+ void CompleteLambdaCallOperator(
7115
+ CXXMethodDecl *Method, SourceLocation LambdaLoc,
7116
+ SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
7117
+ TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
7118
+ StorageClass SC, ArrayRef<ParmVarDecl *> Params,
7119
+ bool HasExplicitResultType);
7120
+
7115
7121
/// Perform initialization analysis of the init-capture and perform
7116
7122
/// any implicit conversions such as an lvalue-to-rvalue conversion if
7117
7123
/// not being used to initialize a reference.
@@ -7132,11 +7138,9 @@ class Sema final {
7132
7138
///
7133
7139
/// CodeGen handles emission of lambda captures, ignoring these dummy
7134
7140
/// variables appropriately.
7135
- VarDecl *createLambdaInitCaptureVarDecl(SourceLocation Loc,
7136
- QualType InitCaptureType,
7137
- SourceLocation EllipsisLoc,
7138
- IdentifierInfo *Id,
7139
- unsigned InitStyle, Expr *Init);
7141
+ VarDecl *createLambdaInitCaptureVarDecl(
7142
+ SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
7143
+ IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx);
7140
7144
7141
7145
/// Add an init-capture to a lambda scope.
7142
7146
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var,
@@ -7146,28 +7150,38 @@ class Sema final {
7146
7150
/// given lambda.
7147
7151
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI);
7148
7152
7149
- /// \brief This is called after parsing the explicit template parameter list
7153
+ /// Deduce a block or lambda's return type based on the return
7154
+ /// statements present in the body.
7155
+ void deduceClosureReturnType(sema::CapturingScopeInfo &CSI);
7156
+
7157
+ /// Once the Lambdas capture are known, we can start to create the closure,
7158
+ /// call operator method, and keep track of the captures.
7159
+ /// We do the capture lookup here, but they are not actually captured until
7160
+ /// after we know what the qualifiers of the call operator are.
7161
+ void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
7162
+ Scope *CurContext);
7163
+
7164
+ /// This is called after parsing the explicit template parameter list
7150
7165
/// on a lambda (if it exists) in C++2a.
7151
- void ActOnLambdaExplicitTemplateParameterList(SourceLocation LAngleLoc,
7166
+ void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro,
7167
+ SourceLocation LAngleLoc,
7152
7168
ArrayRef<NamedDecl *> TParams,
7153
7169
SourceLocation RAngleLoc,
7154
7170
ExprResult RequiresClause);
7155
7171
7156
- /// Introduce the lambda parameters into scope.
7157
- void addLambdaParameters(
7158
- ArrayRef<LambdaIntroducer::LambdaCapture> Captures,
7159
- CXXMethodDecl *CallOperator, Scope *CurScope);
7172
+ void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro,
7173
+ SourceLocation MutableLoc);
7160
7174
7161
- /// Deduce a block or lambda's return type based on the return
7162
- /// statements present in the body.
7163
- void deduceClosureReturnType(sema::CapturingScopeInfo &CSI );
7175
+ void ActOnLambdaClosureParameters(
7176
+ Scope *LambdaScope,
7177
+ MutableArrayRef<DeclaratorChunk::ParamInfo> ParamInfo );
7164
7178
7165
7179
/// ActOnStartOfLambdaDefinition - This is called just before we start
7166
7180
/// parsing the body of a lambda; it analyzes the explicit captures and
7167
7181
/// arguments, and sets up various data-structures for the body of the
7168
7182
/// lambda.
7169
7183
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
7170
- Declarator &ParamInfo, Scope *CurScope );
7184
+ Declarator &ParamInfo, const DeclSpec &DS );
7171
7185
7172
7186
/// ActOnLambdaError - If there is an error parsing a lambda, this callback
7173
7187
/// is invoked to pop the information about the lambda.
@@ -7262,6 +7276,13 @@ class Sema final {
7262
7276
LocalInstantiationScope &Scope,
7263
7277
const MultiLevelTemplateArgumentList &TemplateArgs);
7264
7278
7279
+ /// Introduce the instantiated captures of the lambda into the local
7280
+ /// instantiation scope.
7281
+ bool addInstantiatedCapturesToScope(
7282
+ FunctionDecl *Function, const FunctionDecl *PatternDecl,
7283
+ LocalInstantiationScope &Scope,
7284
+ const MultiLevelTemplateArgumentList &TemplateArgs);
7285
+
7265
7286
/// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
7266
7287
/// the case of lambdas) set up the LocalInstantiationScope of the current
7267
7288
/// function.
0 commit comments