[clang] [clang-tools-extra] [Clang] Add builtins that deduplicate and sort types (PR #106730)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Wed May 14 08:28:33 PDT 2025
================
@@ -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:
@mizvekov thoughts?
https://github.com/llvm/llvm-project/pull/106730
More information about the cfe-commits
mailing list