| 1496 | //----------------------------------------------------------------------------- |
| 1497 | |
| 1498 | bool CodeGenerator::InsertLambdaStaticInvoker(const CXXMethodDecl* cxxMethodDecl) |
| 1499 | { |
| 1500 | if(not(cxxMethodDecl and cxxMethodDecl->isLambdaStaticInvoker())) { |
| 1501 | return false; |
| 1502 | } |
| 1503 | |
| 1504 | // A special case for a lambda with a static invoker. The standard says, that in such a case invoking the call |
| 1505 | // operator gives the same result as invoking the function pointer (see [expr.prim.lambda.closure] p9). When it |
| 1506 | // comes to block local statics having a body for both functions reveals a difference. This special code |
| 1507 | // generates a forwarding call from the call operator to the static invoker. However, the compiler does better |
| 1508 | // here. As this way we end up with copies of the parameters which is hard to avoid. |
| 1509 | |
| 1510 | mOutputFormatHelper.AppendNewLine(); |
| 1511 | mOutputFormatHelper.OpenScope(); |
| 1512 | |
| 1513 | if(not cxxMethodDecl->getReturnType()->isVoidType()) { |
| 1514 | mOutputFormatHelper.Append(kwReturn, " "sv); |
| 1515 | } |
| 1516 | |
| 1517 | mOutputFormatHelper.Append(GetName(*cxxMethodDecl->getParent()), "{}.operator()"sv); |
| 1518 | |
| 1519 | if(cxxMethodDecl->isFunctionTemplateSpecialization()) { |
| 1520 | InsertTemplateArgs(*dyn_cast_or_null<FunctionDecl>(cxxMethodDecl)); |
| 1521 | } |
| 1522 | |
| 1523 | if(cxxMethodDecl->isTemplated()) { |
| 1524 | if(cxxMethodDecl->getDescribedTemplate()) { |
| 1525 | InsertTemplateParameters(*cxxMethodDecl->getDescribedTemplate()->getTemplateParameters(), |
| 1526 | TemplateParamsOnly::Yes); |
| 1527 | } |
| 1528 | /*else if(decl.isFunctionTemplateSpecialization()) { |
| 1529 | InsertTemplateSpecializationHeader(); |
| 1530 | }*/ |
| 1531 | } |
| 1532 | |
| 1533 | WrapInParens([&] { |
| 1534 | mOutputFormatHelper.AppendParameterList(cxxMethodDecl->parameters(), |
| 1535 | OutputFormatHelper::NameOnly::Yes, |
| 1536 | OutputFormatHelper::GenMissingParamName::Yes); |
| 1537 | }); |
| 1538 | |
| 1539 | mOutputFormatHelper.AppendSemiNewLine(); |
| 1540 | mOutputFormatHelper.CloseScope(OutputFormatHelper::NoNewLineBefore::Yes); |
| 1541 | mOutputFormatHelper.AppendNewLine(); |
| 1542 | |
| 1543 | return true; |
| 1544 | } |
| 1545 | //----------------------------------------------------------------------------- |
| 1546 | |
| 1547 | /// \brief Inserts the instantiation point of a template. |
nothing calls this directly
no test coverage detected