@@ -7089,15 +7089,21 @@ class Sema final {
7089
7089
std::nullopt);
7090
7090
7091
7091
/// 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,
7094
7093
SourceRange IntroducerRange,
7095
7094
LambdaCaptureDefault CaptureDefault,
7096
- SourceLocation CaptureDefaultLoc,
7097
- bool ExplicitParams,
7098
- bool ExplicitResultType,
7095
+ SourceLocation CaptureDefaultLoc, bool ExplicitParams,
7099
7096
bool Mutable);
7100
7097
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
+
7101
7107
/// Perform initialization analysis of the init-capture and perform
7102
7108
/// any implicit conversions such as an lvalue-to-rvalue conversion if
7103
7109
/// not being used to initialize a reference.
@@ -7118,11 +7124,9 @@ class Sema final {
7118
7124
///
7119
7125
/// CodeGen handles emission of lambda captures, ignoring these dummy
7120
7126
/// 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);
7126
7130
7127
7131
/// Add an init-capture to a lambda scope.
7128
7132
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var,
@@ -7132,28 +7136,38 @@ class Sema final {
7132
7136
/// given lambda.
7133
7137
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI);
7134
7138
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
7136
7151
/// on a lambda (if it exists) in C++2a.
7137
- void ActOnLambdaExplicitTemplateParameterList(SourceLocation LAngleLoc,
7152
+ void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro,
7153
+ SourceLocation LAngleLoc,
7138
7154
ArrayRef<NamedDecl *> TParams,
7139
7155
SourceLocation RAngleLoc,
7140
7156
ExprResult RequiresClause);
7141
7157
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);
7146
7160
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 );
7150
7164
7151
7165
/// ActOnStartOfLambdaDefinition - This is called just before we start
7152
7166
/// parsing the body of a lambda; it analyzes the explicit captures and
7153
7167
/// arguments, and sets up various data-structures for the body of the
7154
7168
/// lambda.
7155
7169
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
7156
- Declarator &ParamInfo, Scope *CurScope );
7170
+ Declarator &ParamInfo, const DeclSpec &DS );
7157
7171
7158
7172
/// ActOnLambdaError - If there is an error parsing a lambda, this callback
7159
7173
/// is invoked to pop the information about the lambda.
@@ -7248,6 +7262,13 @@ class Sema final {
7248
7262
LocalInstantiationScope &Scope,
7249
7263
const MultiLevelTemplateArgumentList &TemplateArgs);
7250
7264
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
+
7251
7272
/// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
7252
7273
/// the case of lambdas) set up the LocalInstantiationScope of the current
7253
7274
/// function.
0 commit comments