================ @@ -6484,6 +6499,57 @@ class SubstTemplateTypeParmType final } }; +/// Represents the result of substituting a set of types as a template argument +/// that needs to be expanded later. +/// +/// These types are always dependent and produced depending on the situations: +/// - SubstTemplateTypeParmPack represents a pack expansion that had to be +/// delayed, +/// - TODO: represents a pack expansion represented by a builtin. +class SubstPackType : public Type, public llvm::FoldingSetNode { + friend class ASTContext; + + /// A pointer to the set of template arguments that this + /// parameter pack is instantiated with. + const TemplateArgument *Arguments; + +protected: + SubstPackType(TypeClass Derived, QualType Canon, + const TemplateArgument &ArgPack); + +public: + unsigned getNumArgs() const { return SubstPackTypeBits.NumArgs; } + + TemplateArgument getArgumentPack() const; + + void Profile(llvm::FoldingSetNodeID &ID); + static void Profile(llvm::FoldingSetNodeID &ID, + const TemplateArgument &ArgPack); + + static bool classof(const Type *T) { + return T->getTypeClass() == SubstTemplateTypeParmPack || + T->getTypeClass() == SubstBuiltinTemplatePack; + } +}; + +/// Represents the result of substituting a builtin template as a pack. +class SubstBuiltinTemplatePackType : public SubstPackType { + friend class ASTContext; + + SubstBuiltinTemplatePackType(QualType Canon, const TemplateArgument &ArgPack); ---------------- zyn0217 wrote:
> So what happened, is this trying to go for more performance than what that > simpler implementation would have provided? As far as I can understand (@cor3ntin told me some contexts, thanks!), this builtin isn't just only used to deduplicate types, `dedup<T...>` also introduces a new form of pack and can be used anywhere like a regular parameter pack. https://github.com/llvm/llvm-project/pull/106730 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits