[clang] [Clang][P1061] Consolidate ResolvedUnpexandedPackExpr into FunctionParmPackExpr (PR #125394)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 06:29:48 PST 2025
================
@@ -1197,25 +1197,17 @@ Decl *TemplateDeclInstantiator::VisitDecompositionDecl(DecompositionDecl *D) {
for (auto *NewBD : NewBindings)
NewBD->setInvalidDecl();
- if (OldResolvedPack) {
- // Mark the holding vars (if any) in the pack as instantiated since
- // they are created implicitly.
+ if (OldBindingPack) {
+ // Mark the bindings in the pack as instantiated.
auto Bindings = NewDD->bindings();
- auto BPack = llvm::find_if(
+ auto NewBindingPack = *llvm::find_if(
Bindings, [](BindingDecl *D) -> bool { return D->isParameterPack(); });
- auto *NewResolvedPack =
- cast<ResolvedUnexpandedPackExpr>((*BPack)->getBinding());
- auto OldExprs = OldResolvedPack->getExprs();
- auto NewExprs = NewResolvedPack->getExprs();
- assert(OldExprs.size() == NewExprs.size());
- for (unsigned I = 0; I < OldResolvedPack->getNumExprs(); I++) {
- DeclRefExpr *OldDRE = cast<DeclRefExpr>(OldExprs[I]);
- BindingDecl *OldNestedBD = cast<BindingDecl>(OldDRE->getDecl());
- DeclRefExpr *NewDRE = cast<DeclRefExpr>(NewExprs[I]);
- BindingDecl *NewNestedBD = cast<BindingDecl>(NewDRE->getDecl());
- SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldNestedBD,
- NewNestedBD);
- }
+ auto OldDecls = OldBindingPack->getBindingPackDecls();
----------------
erichkeane wrote:
We shouldn't be using 'auto' on either of these. I realize they already were, but please change them anyway.,
https://github.com/llvm/llvm-project/pull/125394
More information about the cfe-commits
mailing list