[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 06:43:13 PDT 2024
================
@@ -1669,25 +1640,43 @@ namespace {
ExprResult RebuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
LambdaScopeInfo *LSI) {
+#if 1
CXXMethodDecl *MD = LSI->CallOperator;
- for (ParmVarDecl *PVD : MD->parameters()) {
- assert(PVD && "null in a parameter list");
- if (!PVD->hasDefaultArg())
- continue;
- Expr *UninstExpr = PVD->getUninstantiatedDefaultArg();
- // FIXME: Obtain the source location for the '=' token.
- SourceLocation EqualLoc = UninstExpr->getBeginLoc();
- if (SemaRef.SubstDefaultArgument(EqualLoc, PVD, TemplateArgs)) {
- // If substitution fails, the default argument is set to a
- // RecoveryExpr that wraps the uninstantiated default argument so
- // that downstream diagnostics are omitted.
- ExprResult ErrorResult = SemaRef.CreateRecoveryExpr(
- UninstExpr->getBeginLoc(), UninstExpr->getEndLoc(),
- { UninstExpr }, UninstExpr->getType());
- if (ErrorResult.isUsable())
- PVD->setDefaultArg(ErrorResult.get());
+ // if (MD->getParentFunctionOrMethod()) {
+ if (true) {
+#if 0
+ NamedDecl *Pattern = MD;
+ std::optional<ArrayRef<TemplateArgument>> Innermost;
+ if (FunctionTemplateDecl *FTD = MD->getDescribedFunctionTemplate()) {
+ Pattern = FTD;
+ Innermost = FTD->getInjectedTemplateArgs();
+ }
+ MultiLevelTemplateArgumentList MLTAL =
+ SemaRef.getTemplateInstantiationArgs(Pattern, Pattern->getLexicalDeclContext(),
+ /*Final=*/false, Innermost,
+ /*RelativeToPrimary=*/true);
+#endif
+ ;
----------------
sdkrystian wrote:
This is leftover from when I was experimenting with correctly substituting lambda default arguments. It proved to be too much work, so I abandoned that effort.
https://github.com/llvm/llvm-project/pull/106585
More information about the cfe-commits
mailing list