llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-modules

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

This reverts commits 85043c1c146fd5658ad4c5b5138e58994333e645 and
65de318d186c815f43b892aa20b98c50f22ab6fe.

The first commit above triggers the following warnings:

clang/lib/Sema/SemaTemplateVariadic.cpp:1069:22: error: variable
'TST' set but not used [-Werror,-Wunused-but-set-variable]

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4148:11:
error: enumeration value 'SubstBuiltinTemplatePack' not handled in
switch [-Werror,-Wswitch]
4148 |   switch (qual_type-&gt;getTypeClass()) {
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4852:11:
error: enumeration value 'SubstBuiltinTemplatePack' not handled in
switch [-Werror,-Wswitch]
4852 |   switch (qual_type-&gt;getTypeClass()) {
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:5153:11:
error: enumeration value 'SubstBuiltinTemplatePack' not handled in
switch [-Werror,-Wswitch]
5153 |   switch (qual_type-&gt;getTypeClass()) {
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~


---

Patch is 111.38 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/154606.diff


40 Files Affected:

- (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (-6) 
- (modified) clang/docs/LanguageExtensions.rst (-31) 
- (modified) clang/docs/ReleaseNotes.rst (-16) 
- (modified) clang/include/clang/AST/ASTContext.h (-3) 
- (modified) clang/include/clang/AST/DeclTemplate.h (-3) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+5-25) 
- (modified) clang/include/clang/AST/Type.h (+16-64) 
- (modified) clang/include/clang/AST/TypeLoc.h (+6-16) 
- (modified) clang/include/clang/AST/TypeProperties.td (+6-13) 
- (modified) clang/include/clang/Basic/BuiltinTemplates.td (-4) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (-7) 
- (modified) clang/include/clang/Basic/TypeNodes.td (+1-3) 
- (modified) clang/include/clang/Sema/Sema.h (+4-14) 
- (modified) clang/include/clang/Sema/SemaInternal.h (+3-8) 
- (modified) clang/include/clang/Serialization/TypeBitCodes.def (-1) 
- (modified) clang/lib/AST/ASTContext.cpp (+1-30) 
- (modified) clang/lib/AST/ASTImporter.cpp (-8) 
- (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (-8) 
- (modified) clang/lib/AST/DeclTemplate.cpp (+1-12) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (-15) 
- (modified) clang/lib/AST/MicrosoftMangle.cpp (-5) 
- (modified) clang/lib/AST/Type.cpp (+22-65) 
- (modified) clang/lib/AST/TypePrinter.cpp (-10) 
- (modified) clang/lib/Parse/ParseTemplate.cpp (-2) 
- (modified) clang/lib/Sema/SemaConcept.cpp (+5-8) 
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+1-2) 
- (modified) clang/lib/Sema/SemaTemplate.cpp (-57) 
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+3-15) 
- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+35-142) 
- (modified) clang/lib/Sema/SemaTemplateInstantiateDecl.cpp (+27-25) 
- (modified) clang/lib/Sema/SemaTemplateVariadic.cpp (+4-118) 
- (modified) clang/lib/Sema/TreeTransform.h (+95-224) 
- (modified) clang/lib/Serialization/ASTReader.cpp (-5) 
- (modified) clang/lib/Serialization/ASTWriter.cpp (-6) 
- (modified) clang/test/Import/builtin-template/Inputs/S.cpp (-10) 
- (modified) clang/test/Import/builtin-template/test.cpp (+1-11) 
- (removed) clang/test/PCH/dedup_types.cpp (-20) 
- (modified) clang/test/SemaCXX/pr100095.cpp (+1) 
- (removed) clang/test/SemaTemplate/dedup-types-builtin.cpp (-226) 
- (modified) clang/tools/libclang/CIndex.cpp (-1) 


``````````diff
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index f369e1b0341e8..20fd23ed4fcdc 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -731,12 +731,6 @@ TEST_F(TargetDeclTest, BuiltinTemplates) {
     using type_pack_element = [[__type_pack_element]]<N, Pack...>;
   )cpp";
   EXPECT_DECLS("TemplateSpecializationTypeLoc", );
-
-  Code = R"cpp(
-    template <template <class...> class Templ, class... Types>
-    using dedup_types = Templ<[[__builtin_dedup_pack]]<Types...>...>;
-  )cpp";
-  EXPECT_DECLS("TemplateSpecializationTypeLoc", );
 }
 
 TEST_F(TargetDeclTest, MemberOfTemplate) {
diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 1b749ead355c7..3f7b7bb270325 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1829,37 +1829,6 @@ __make_integer_seq
 
 This alias returns ``IntSeq`` instantiated with ``IntSeqT = T``and ``Ints`` 
being the pack ``0, ..., N - 1``.
 
-__builtin_dedup_pack
---------------------
-
-.. code-block:: c++
-
-  template <class... Ts>
-  using __builtin_dedup_pack = ...;
-
-This alias takes a template parameter pack ``Ts`` and produces a new 
unexpanded pack containing the unique types
-from ``Ts``, with the order of the first occurrence of each type preserved.
-It is useful in template metaprogramming to normalize type lists.
-
-The resulting pack can be expanded in contexts like template argument lists or 
base specifiers.
-
-**Example of Use**:
-
-.. code-block:: c++
-
-  template <typename...> struct TypeList;
-
-  // The resulting type is TypeList<int, double, char>
-  template <typename ...ExtraTypes>
-  using MyTypeList = TypeList<__builtin_dedup_pack<int, double, int, char, 
double, ExtraTypes...>...>;
-
-**Limitations**:
-
-* This builtin can only be used inside a template.
-* The resulting pack is currently only supported for expansion in template 
argument lists and base specifiers.
-* This builtin cannot be assigned to a template template parameter.
-
-
 Type Trait Primitives
 =====================
 
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d577192d2791f..338627904e7f9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -148,22 +148,6 @@ Non-comprehensive list of changes in this release
   correct method to check for these features is to test for the ``__PTRAUTH__``
   macro.
 
-- Added a new builtin, ``__builtin_dedup_pack``, to remove duplicate types 
from a parameter pack.
-  This feature is particularly useful in template metaprogramming for 
normalizing type lists.
-  The builtin produces a new, unexpanded parameter pack that can be used in 
contexts like template
-  argument lists or base specifiers.
-
-  .. code-block:: c++
-
-    template <typename...> struct TypeList;
-
-    // The resulting type is TypeList<int, double, char>
-    using MyTypeList = TypeList<__builtin_dedup_pack<int, double, int, char, 
double>...>;
-
-  Currently, the use of ``__builtin_dedup_pack`` is limited to template 
arguments and base
-  specifiers, it also must be used within a template context.
-
-
 New Compiler Flags
 ------------------
 - New option ``-fno-sanitize-annotate-debug-info-traps`` added to disable 
emitting trap reasons into the debug info when compiling with trapping UBSan 
(e.g. ``-fsanitize-trap=undefined``).
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 07f4935e06555..7c2566a09665d 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -230,8 +230,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
     SubstTemplateTypeParmTypes;
   mutable llvm::FoldingSet<SubstTemplateTypeParmPackType>
     SubstTemplateTypeParmPackTypes;
-  mutable llvm::FoldingSet<SubstBuiltinTemplatePackType>
-      SubstBuiltinTemplatePackTypes;
   mutable llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
     TemplateSpecializationTypes;
   mutable llvm::FoldingSet<ParenType> ParenTypes{GeneralTypesLog2InitSize};
@@ -1897,7 +1895,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
   QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl,
                                             unsigned Index, bool Final,
                                             const TemplateArgument &ArgPack);
-  QualType getSubstBuiltinTemplatePack(const TemplateArgument &ArgPack);
 
   QualType
   getTemplateTypeParmType(unsigned Depth, unsigned Index,
diff --git a/clang/include/clang/AST/DeclTemplate.h 
b/clang/include/clang/AST/DeclTemplate.h
index bba72365089f9..f298ed8b2f640 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -1796,10 +1796,7 @@ class BuiltinTemplateDecl : public TemplateDecl {
   }
 
   BuiltinTemplateKind getBuiltinTemplateKind() const { return BTK; }
-
-  bool isPackProducingBuiltinTemplate() const;
 };
-bool isPackProducingBuiltinTemplateName(TemplateName N);
 
 /// Provides information about an explicit instantiation of a variable or class
 /// template.
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 02581c8e73299..248b89200eace 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -492,8 +492,6 @@ template <typename Derived> class RecursiveASTVisitor {
   bool TraverseTemplateArgumentLocsHelper(const TemplateArgumentLoc *TAL,
                                           unsigned Count);
   bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
-  bool TraverseSubstPackTypeHelper(SubstPackType *T);
-  bool TraverseSubstPackTypeLocHelper(SubstPackTypeLoc TL);
   bool TraverseRecordHelper(RecordDecl *D);
   bool TraverseCXXRecordHelper(CXXRecordDecl *D);
   bool TraverseDeclaratorHelper(DeclaratorDecl *D);
@@ -1140,10 +1138,9 @@ DEF_TRAVERSE_TYPE(TemplateTypeParmType, {})
 DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, {
   TRY_TO(TraverseType(T->getReplacementType()));
 })
-DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType,
-                  { TRY_TO(TraverseSubstPackTypeHelper(T)); })
-DEF_TRAVERSE_TYPE(SubstBuiltinTemplatePackType,
-                  { TRY_TO(TraverseSubstPackTypeHelper(T)); })
+DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, {
+  TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
+})
 
 DEF_TRAVERSE_TYPE(AttributedType,
                   { TRY_TO(TraverseType(T->getModifiedType())); })
@@ -1484,26 +1481,9 @@ DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, {})
 DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, {
   TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
 })
-
-template <typename Derived>
-bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeLocHelper(
-    SubstPackTypeLoc TL) {
+DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, {
   TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
-  return true;
-}
-
-template <typename Derived>
-bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeHelper(
-    SubstPackType *T) {
-  TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
-  return true;
-}
-
-DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType,
-                     { TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
-
-DEF_TRAVERSE_TYPELOC(SubstBuiltinTemplatePackType,
-                     { TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
+})
 
 DEF_TRAVERSE_TYPELOC(ParenType, { TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
 
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index adf5cb0462154..3c32f7c82a3c1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2210,24 +2210,20 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
     unsigned PackIndex : 15;
   };
 
-  class SubstPackTypeBitfields {
-    friend class SubstPackType;
+  class SubstTemplateTypeParmPackTypeBitfields {
     friend class SubstTemplateTypeParmPackType;
 
     LLVM_PREFERRED_TYPE(TypeBitfields)
     unsigned : NumTypeBits;
 
+    // The index of the template parameter this substitution represents.
+    unsigned Index : 16;
+
     /// The number of template arguments in \c Arguments, which is
     /// expected to be able to hold at least 1024 according to [implimits].
     /// However as this limit is somewhat easy to hit with template
     /// metaprogramming we'd prefer to keep it as large as possible.
     unsigned NumArgs : 16;
-
-    // The index of the template parameter this substitution represents.
-    // Only used by SubstTemplateTypeParmPackType. We keep it in the same
-    // class to avoid dealing with complexities of bitfields that go over
-    // the size of `unsigned`.
-    unsigned SubstTemplTypeParmPackIndex : 16;
   };
 
   class TemplateSpecializationTypeBitfields {
@@ -2344,7 +2340,7 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
     VectorTypeBitfields VectorTypeBits;
     TemplateTypeParmTypeBitfields TemplateTypeParmTypeBits;
     SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits;
-    SubstPackTypeBitfields SubstPackTypeBits;
+    SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits;
     TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits;
     DependentTemplateSpecializationTypeBitfields
       DependentTemplateSpecializationTypeBits;
@@ -6996,56 +6992,6 @@ 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 is an expansion that had to be delayed,
-/// - SubstBuiltinTemplatePackType is an expansion from 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);
-
-public:
-  bool isSugared() const { return false; }
-  QualType desugar() const { return QualType(this, 0); }
-
-  /// Mark that we reuse the Profile. We do not introduce new fields.
-  using SubstPackType::Profile;
-
-  static bool classof(const Type *T) {
-    return T->getTypeClass() == SubstBuiltinTemplatePack;
-  }
-};
-
 /// Represents the result of substituting a set of types for a template
 /// type parameter pack.
 ///
@@ -7058,7 +7004,7 @@ class SubstBuiltinTemplatePackType : public SubstPackType 
{
 /// that pack expansion (e.g., when all template parameters have corresponding
 /// arguments), this type will be replaced with the \c 
SubstTemplateTypeParmType
 /// at the current pack substitution index.
-class SubstTemplateTypeParmPackType : public SubstPackType {
+class SubstTemplateTypeParmPackType : public Type, public llvm::FoldingSetNode 
{
   friend class ASTContext;
 
   /// A pointer to the set of template arguments that this
@@ -7084,17 +7030,21 @@ class SubstTemplateTypeParmPackType : public 
SubstPackType {
 
   /// Returns the index of the replaced parameter in the associated 
declaration.
   /// This should match the result of `getReplacedParameter()->getIndex()`.
-  unsigned getIndex() const {
-    return SubstPackTypeBits.SubstTemplTypeParmPackIndex;
-  }
+  unsigned getIndex() const { return SubstTemplateTypeParmPackTypeBits.Index; }
 
   // This substitution will be Final, which means the substitution will be 
fully
   // sugared: it doesn't need to be resugared later.
   bool getFinal() const;
 
+  unsigned getNumArgs() const {
+    return SubstTemplateTypeParmPackTypeBits.NumArgs;
+  }
+
   bool isSugared() const { return false; }
   QualType desugar() const { return QualType(this, 0); }
 
+  TemplateArgument getArgumentPack() const;
+
   void Profile(llvm::FoldingSetNodeID &ID);
   static void Profile(llvm::FoldingSetNodeID &ID, const Decl *AssociatedDecl,
                       unsigned Index, bool Final,
@@ -7329,7 +7279,9 @@ class TemplateSpecializationType : public TypeWithKeyword,
             TemplateSpecializationTypeBits.NumArgs};
   }
 
-  bool isSugared() const;
+  bool isSugared() const {
+    return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
+  }
 
   QualType desugar() const {
     return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
diff --git a/clang/include/clang/AST/TypeLoc.h 
b/clang/include/clang/AST/TypeLoc.h
index 00835f1490eda..6389bdea6d122 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -989,22 +989,12 @@ class SubstTemplateTypeParmTypeLoc :
                                      SubstTemplateTypeParmType> {
 };
 
-/// Abstract type representing delayed type pack expansions.
-class SubstPackTypeLoc
-    : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, SubstPackTypeLoc,
-                                       SubstPackType> {};
-
-/// Wrapper for substituted template type parameters.
-class SubstTemplateTypeParmPackTypeLoc
-    : public InheritingConcreteTypeLoc<SubstPackTypeLoc,
-                                       SubstTemplateTypeParmPackTypeLoc,
-                                       SubstTemplateTypeParmPackType> {};
-
-/// Wrapper for substituted template type parameters.
-class SubstBuiltinTemplatePackTypeLoc
-    : public InheritingConcreteTypeLoc<SubstPackTypeLoc,
-                                       SubstBuiltinTemplatePackTypeLoc,
-                                       SubstBuiltinTemplatePackType> {};
+  /// Wrapper for substituted template type parameters.
+class SubstTemplateTypeParmPackTypeLoc :
+    public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
+                                     SubstTemplateTypeParmPackTypeLoc,
+                                     SubstTemplateTypeParmPackType> {
+};
 
 struct AttributedLocInfo {
   const Attr *TypeAttr;
diff --git a/clang/include/clang/AST/TypeProperties.td 
b/clang/include/clang/AST/TypeProperties.td
index 185a968217f97..388f6dda4a6f0 100644
--- a/clang/include/clang/AST/TypeProperties.td
+++ b/clang/include/clang/AST/TypeProperties.td
@@ -820,12 +820,6 @@ let Class = PackExpansionType in {
   }]>;
 }
 
-let Class = SubstPackType in {
-  def : Property<"replacementPack", TemplateArgument> {
-    let Read = [{ node->getArgumentPack() }];
-  }
-}
-
 let Class = SubstTemplateTypeParmPackType in {
   def : Property<"associatedDecl", DeclRef> {
     let Read = [{ node->getAssociatedDecl() }];
@@ -833,7 +827,12 @@ let Class = SubstTemplateTypeParmPackType in {
   def : Property<"Index", UInt32> {
     let Read = [{ node->getIndex() }];
   }
-  def : Property<"Final", Bool> { let Read = [{ node->getFinal() }]; }
+  def : Property<"Final", Bool> {
+    let Read = [{ node->getFinal() }];
+  }
+  def : Property<"replacementPack", TemplateArgument> {
+    let Read = [{ node->getArgumentPack() }];
+  }
 
   def : Creator<[{
     return ctx.getSubstTemplateTypeParmPackType(
@@ -841,12 +840,6 @@ let Class = SubstTemplateTypeParmPackType in {
   }]>;
 }
 
-let Class = SubstBuiltinTemplatePackType in {
-  def : Creator<[{
-    return ctx.getSubstBuiltinTemplatePack(replacementPack);
-  }]>;
-}
-
 let Class = BuiltinType in {
   def : Property<"kind", BuiltinTypeKind> {
     let Read = [{ node->getKind() }];
diff --git a/clang/include/clang/Basic/BuiltinTemplates.td 
b/clang/include/clang/Basic/BuiltinTemplates.td
index 504405acbdc78..5b9672b395955 100644
--- a/clang/include/clang/Basic/BuiltinTemplates.td
+++ b/clang/include/clang/Basic/BuiltinTemplates.td
@@ -62,7 +62,3 @@ def __builtin_common_type : CPlusPlusBuiltinTemplate<
 //           typename ...Operands>
 def __hlsl_spirv_type : HLSLBuiltinTemplate<
 [Uint32T, Uint32T, Uint32T, Class<"Operands", /*is_variadic=*/1>]>;
-
-// template <class ...Args>
-def __builtin_dedup_pack
-    : CPlusPlusBuiltinTemplate<[Class<"Args", /*is_variadic=*/1>]>;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f40cac865ade0..24723573cc861 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6074,13 +6074,6 @@ def warn_cxx23_pack_indexing : Warning<
 def err_pack_outside_template : Error<
   "pack declaration outside of template">;
 
-def err_builtin_pack_outside_template
-    : Error<"%0 cannot be used outside of template">;
-
-def err_unsupported_builtin_template_pack_expansion
-    : Error<"expansions of %0 are not supported here. Only expansions in "
-            "template arguments and class bases are supported">;
-
 def err_fold_expression_packs_both_sides : Error<
   "binary fold expression has unexpanded parameter packs in both operands">;
 def err_fold_expression_empty : Error<
diff --git a/clang/include/clang/Basic/TypeNodes.td 
b/clang/include/clang/Basic/TypeNodes.td
index c8d45dec78816..e4960ec660b90 100644
--- a/clang/include/clang/Basic/TypeNodes.td
+++ b/clang/include/clang/Basic/TypeNodes.td
@@ -97,9 +97,7 @@ def HLSLAttributedResourceType : TypeNode<Type>;
 def HLSLInlineSpirvType : TypeNode<Type>;
 def TemplateTypeParmType : TypeNode<Type>, AlwaysDependent, LeafType;
 def SubstTemplateTypeParmType : TypeNode<Type>, NeverCanonical;
-def SubstPackType : TypeNode<Type, 1>;
-def SubstTemplateTypeParmPackType : TypeNode<SubstPackType>, AlwaysDependent;
-def SubstBuiltinTemplatePackType : TypeNode<SubstPackType>, AlwaysDependent;
+def SubstTemplateTypeParmPackType : TypeNode<Type>, AlwaysDependent;
 def TemplateSpecializationType : TypeNode<Type>, NeverCanonicalUnlessDependent;
 def DeducedType : TypeNode<Type, 1>;
 def AutoType : TypeNode<DeducedType>;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 12112eb1ad225..89d3f61380db1 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -228,9 +228,7 @@ void threadSafetyCleanup(BeforeSet *Cache);
 
 // FIXME: No way to easily map from TemplateTypeParmTypes to
 // TemplateTypeParmDecls, so we have this horrible PointerUnion.
-typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType *, NamedDecl *,
-                                     const TemplateSpecializationType *,
-                                     const SubstBuiltinTemplatePackType *>,
+typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType *, NamedDecl 
*>,
                   SourceLocation>
     UnexpandedParameterPack;
 
@@ -13499,6 +13497,8 @@ class Sema final : public SemaBase {
     ~ArgPackSubstIndexRAII() { Self.ArgPackSubstIndex = OldSubstIndex; }
   };
 
+  friend class ArgumentPackSubstitutionRAII;
+
   void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
   void popCodeSynthesisContext();
 
@@ -14428,15 +14428,6 @@ class Sema final : public SemaBase {
   static void collectUnexpandedParameterPacks(
       Expr *E, SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
 
-  /// Invoked when parsing a template argument.
-  ///
-  /// \param Arg the template argument, which may already be invalid.
-  ///
-  /// If it is followed by ellipsis, this function is called before
-  /// `ActOnPackExpansion`.
-  ParsedTemplateArgument
-  ActOnTemplateTemplateArgument(const ParsedTemplateArgument &Arg);
-
   /// Invoked when parsing a template argument followed by an
   /// ellipsis, which creates a pack expansion.
   ///
@@ -14524,8 +14515,7 @@ class Sema final : public SemaBase {
   bool CheckParameterPacksForExpansion(
       SourceLocation EllipsisL...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/154606
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to