================ @@ -177,6 +185,11 @@ def CoyieldExpr : StmtNode<CoroutineSuspendExpr>; def ConceptSpecializationExpr : StmtNode<Expr>; def RequiresExpr : StmtNode<Expr>; +// C++26 Expansion statement support expressions +def CXXExpansionInitListExpr : StmtNode<Expr>; +def CXXExpansionInitListSelectExpr : StmtNode<Expr>; +def CXXDestructuringExpansionSelectExpr : StmtNode<Expr>; ---------------- Sirraide wrote:
> I was thinking of refactoring this to be similar to how we do pack expansion > (i.e. have a global index variable somewhere in Sema that’s managed by some > RAII object when we perform expansion). After experimenting with this a bit more, it’s looking like that’s even worse of a hack than `CXXExpansionInitListSelectExpr` because of how many places would have to be aware of the index (and it also gets complicated if we have e.g. nested expansion statements where the outer one is expanded before the inner one), so currently keeping the select exprs is the best approach I can think of. As for merging the two, the main issue is that one selects from a list of expressions, the other from a list of declarations, so unless we create a DREs to each of the BindingDecls ahead of time (which we’d then have to store somewhere else), I don’t think merging the two works too well (short of just storing the `CXXExpansionInitListExpr*`/`DecompositionDecl*` as a `void*` and just adding a `bool IsExpansionInitList` member to it, but that seems a bit horrible). https://github.com/llvm/llvm-project/pull/165195 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
