================
@@ -980,24 +980,24 @@ static bool CheckBindingsCount(Sema &S, DecompositionDecl 
*DD,
   if (IsValid && HasPack) {
     // Create the pack expr and assign it to the binding.
     unsigned PackSize = MemberCount - Bindings.size() + 1;
-    QualType PackType = S.Context.getPackExpansionType(
-        S.Context.DependentTy, std::nullopt, /*ExpectsPackInType=*/false);
-    BindingDecl *BD = (*BindingWithPackItr);
-    auto *RP = ResolvedUnexpandedPackExpr::Create(S.Context, DD->getBeginLoc(),
-                                                  DecompType, PackSize);
-    BD->setDecomposedDecl(DD);
-    BD->setBinding(PackType, RP);
 
     BindingDecl *BPack = *BindingWithPackItr;
+    BPack->setDecomposedDecl(DD);
+    SmallVector<ValueDecl *, 8> NestedBDs(PackSize);
     // Create the nested BindingDecls.
-    for (Expr *&E : RP->getExprs()) {
-      auto *NestedBD = BindingDecl::Create(S.Context, BPack->getDeclContext(),
-                                           BPack->getLocation(),
-                                           BPack->getIdentifier(), QualType());
+    for (ValueDecl *&VD : NestedBDs) {
----------------
zyn0217 wrote:

Maybe we can make it more straightforward like
```cpp
for (unsigned I = 0; I < PackSize; ++I) {
  ...
  NestedBDs[I] = ...
}
```
I feel like `*&` makes it a little visually awkward :)

https://github.com/llvm/llvm-project/pull/125394
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to