https://github.com/hokein updated 
https://github.com/llvm/llvm-project/pull/142983

>From 61be4bfea92d52cfc3e48a3cabb1bc80cbebb7fa Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein...@gmail.com>
Date: Thu, 5 Jun 2025 15:38:58 +0200
Subject: [PATCH 1/2] [clang] Reduce TemplateDeclInstantiator size.

---
 clang/include/clang/Sema/Template.h            | 4 ++--
 clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Sema/Template.h 
b/clang/include/clang/Sema/Template.h
index af0c1e8506cf3..0c68ad9b9d90a 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -587,7 +587,7 @@ enum class TemplateSubstitutionKind : char {
     /// specializations that will need to be instantiated after the
     /// enclosing class's instantiation is complete.
     SmallVector<std::pair<ClassTemplateDecl *,
-                                ClassTemplatePartialSpecializationDecl *>, 4>
+                                ClassTemplatePartialSpecializationDecl *>, 1>
       OutOfLinePartialSpecs;
 
     /// A list of out-of-line variable template partial
@@ -595,7 +595,7 @@ enum class TemplateSubstitutionKind : char {
     /// enclosing variable's instantiation is complete.
     /// FIXME: Verify that this is needed.
     SmallVector<
-        std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 
4>
+        std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 
1>
     OutOfLineVarPartialSpecs;
 
   public:
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index bcad815e1587f..7da09b149446a 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2394,7 +2394,7 @@ Decl 
*TemplateDeclInstantiator::VisitVarTemplateDecl(VarTemplateDecl *D) {
     // Queue up any out-of-line partial specializations of this member
     // variable template; the client will force their instantiation once
     // the enclosing class has been instantiated.
-    SmallVector<VarTemplatePartialSpecializationDecl *, 4> PartialSpecs;
+    SmallVector<VarTemplatePartialSpecializationDecl *, 1> PartialSpecs;
     D->getPartialSpecializations(PartialSpecs);
     for (unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
       if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())

>From 77ecc3b6362ab9b844f4b4393b839e9b3e57175b Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein...@gmail.com>
Date: Fri, 6 Jun 2025 09:10:08 +0200
Subject: [PATCH 2/2] clang-format

---
 clang/include/clang/Sema/Template.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Sema/Template.h 
b/clang/include/clang/Sema/Template.h
index 0c68ad9b9d90a..fe907078af275 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -587,8 +587,9 @@ enum class TemplateSubstitutionKind : char {
     /// specializations that will need to be instantiated after the
     /// enclosing class's instantiation is complete.
     SmallVector<std::pair<ClassTemplateDecl *,
-                                ClassTemplatePartialSpecializationDecl *>, 1>
-      OutOfLinePartialSpecs;
+                          ClassTemplatePartialSpecializationDecl *>,
+                1>
+        OutOfLinePartialSpecs;
 
     /// A list of out-of-line variable template partial
     /// specializations that will need to be instantiated after the
@@ -596,7 +597,7 @@ enum class TemplateSubstitutionKind : char {
     /// FIXME: Verify that this is needed.
     SmallVector<
         std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 
1>
-    OutOfLineVarPartialSpecs;
+        OutOfLineVarPartialSpecs;
 
   public:
     TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner,

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to