[clang] [Clang][P1061] Consolidate ResolvedUnpexandedPackExpr into FunctionParmPackExpr (PR #125394)
Jason Rice via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 09:24:45 PST 2025
================
@@ -4278,25 +4276,21 @@ class DecompositionDecl final
// Provide a flattened range to visit each binding.
auto flat_bindings() const {
llvm::ArrayRef<BindingDecl *> Bindings = bindings();
- llvm::ArrayRef<Expr *> PackExprs;
+ llvm::ArrayRef<BindingDecl *> PackBindings;
// Split the bindings into subranges split by the pack.
- auto S1 = Bindings.take_until(
+ auto BeforePackBindings = Bindings.take_until(
[](BindingDecl *BD) { return BD->isParameterPack(); });
- Bindings = Bindings.drop_front(S1.size());
+ Bindings = Bindings.drop_front(BeforePackBindings.size());
if (!Bindings.empty()) {
- PackExprs = Bindings.front()->getBindingPackExprs();
+ PackBindings = Bindings.front()->getBindingPackDecls();
Bindings = Bindings.drop_front();
}
- auto S2 = llvm::map_range(PackExprs, [](Expr *E) {
- auto *DRE = cast<DeclRefExpr>(E);
- return cast<BindingDecl>(DRE->getDecl());
- });
-
- return llvm::concat<BindingDecl *>(std::move(S1), std::move(S2),
- std::move(Bindings));
+ return llvm::concat<BindingDecl *const>(std::move(BeforePackBindings),
----------------
ricejasonf wrote:
They add... rvalue don't they? :rofl: . I added them to work around the dangling references.
https://github.com/llvm/llvm-project/pull/125394
More information about the cfe-commits
mailing list