[clang] [Clang][P1061] Consolidate ResolvedUnpexandedPackExpr into FunctionParmPackExpr (PR #125394)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 6 08:55:44 PST 2025
================
@@ -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
More information about the cfe-commits
mailing list