================ @@ -1665,6 +1665,43 @@ NonTypeTemplateParmDecl *SubstNonTypeTemplateParmExpr::getParameter() const { getReplacedTemplateParameterList(getAssociatedDecl())->asArray()[Index]); } +PackIndexingExpr *PackIndexingExpr::Create(ASTContext &Context, + SourceLocation EllipsisLoc, + SourceLocation RSquareLoc, + Expr *PackIdExpr, Expr *IndexExpr, + std::optional<int64_t> Index, + ArrayRef<Expr *> SubstitutedExprs) { + QualType Type; + if (Index && !SubstitutedExprs.empty()) + Type = SubstitutedExprs[*Index]->getType(); + else + Type = Context.DependentTy; + + void *Storage = + Context.Allocate(totalSizeToAlloc<Expr *>(SubstitutedExprs.size())); + return new (Storage) + PackIndexingExpr(Type, EllipsisLoc, RSquareLoc, PackIdExpr, IndexExpr, + Index, SubstitutedExprs); +} + +NamedDecl *PackIndexingExpr::getPackDecl() const { + if (auto *D = dyn_cast<DeclRefExpr>(getPackIdExpression()); D) { + NamedDecl *ND = dyn_cast<NamedDecl>(D->getDecl()); + assert(ND && "exected a named decl"); + return ND; + } + assert(false && "Non variables packs not supported"); ---------------- erichkeane wrote:
Is this 'not supported' or 'not valid'? https://github.com/llvm/llvm-project/pull/72644 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits