File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -6077,7 +6077,24 @@ bool Compiler<Emitter>::emitLambdaStaticInvokerBody(const CXXMethodDecl *MD) {
6077
6077
assert (cast<CompoundStmt>(MD->getBody ())->body_empty ());
6078
6078
6079
6079
const CXXRecordDecl *ClosureClass = MD->getParent ();
6080
- const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator ();
6080
+ const FunctionDecl *LambdaCallOp;
6081
+ assert (ClosureClass->captures ().empty ());
6082
+ if (ClosureClass->isGenericLambda ()) {
6083
+ LambdaCallOp = ClosureClass->getLambdaCallOperator ();
6084
+ assert (MD->isFunctionTemplateSpecialization () &&
6085
+ " A generic lambda's static-invoker function must be a "
6086
+ " template specialization" );
6087
+ const TemplateArgumentList *TAL = MD->getTemplateSpecializationArgs ();
6088
+ FunctionTemplateDecl *CallOpTemplate =
6089
+ LambdaCallOp->getDescribedFunctionTemplate ();
6090
+ void *InsertPos = nullptr ;
6091
+ const FunctionDecl *CorrespondingCallOpSpecialization =
6092
+ CallOpTemplate->findSpecialization (TAL->asArray (), InsertPos);
6093
+ assert (CorrespondingCallOpSpecialization);
6094
+ LambdaCallOp = CorrespondingCallOpSpecialization;
6095
+ } else {
6096
+ LambdaCallOp = ClosureClass->getLambdaCallOperator ();
6097
+ }
6081
6098
assert (ClosureClass->captures ().empty ());
6082
6099
const Function *Func = this ->getFunction (LambdaCallOp);
6083
6100
if (!Func)
Original file line number Diff line number Diff line change @@ -465,23 +465,6 @@ const Function *Context::getOrCreateFunction(const FunctionDecl *FuncDecl) {
465
465
// be a non-static member function, this (usually) requiring an
466
466
// instance pointer. We suppress that later in this function.
467
467
IsLambdaStaticInvoker = true ;
468
-
469
- const CXXRecordDecl *ClosureClass = MD->getParent ();
470
- assert (ClosureClass->captures ().empty ());
471
- if (ClosureClass->isGenericLambda ()) {
472
- const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator ();
473
- assert (MD->isFunctionTemplateSpecialization () &&
474
- " A generic lambda's static-invoker function must be a "
475
- " template specialization" );
476
- const TemplateArgumentList *TAL = MD->getTemplateSpecializationArgs ();
477
- FunctionTemplateDecl *CallOpTemplate =
478
- LambdaCallOp->getDescribedFunctionTemplate ();
479
- void *InsertPos = nullptr ;
480
- const FunctionDecl *CorrespondingCallOpSpecialization =
481
- CallOpTemplate->findSpecialization (TAL->asArray (), InsertPos);
482
- assert (CorrespondingCallOpSpecialization);
483
- FuncDecl = CorrespondingCallOpSpecialization;
484
- }
485
468
}
486
469
// Set up argument indices.
487
470
unsigned ParamOffset = 0 ;
You can’t perform that action at this time.
0 commit comments