[clang] a1fffda - [Clang][NFC] Remove unused constructor of ASTTemplateArgumentListInfo (#217200)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 02:21:04 PDT 2026


Author: Younan Zhang
Date: 2026-08-19T17:20:59+08:00
New Revision: a1fffdac1ebb6c1950ebe923f433d28e5e2664aa

URL: https://github.com/llvm/llvm-project/commit/a1fffdac1ebb6c1950ebe923f433d28e5e2664aa
DIFF: https://github.com/llvm/llvm-project/commit/a1fffdac1ebb6c1950ebe923f433d28e5e2664aa.diff

LOG: [Clang][NFC] Remove unused constructor of ASTTemplateArgumentListInfo (#217200)

It turns out that its only client VarTemplateSpecializationDecl has
stopped copying template arguments since 2024, see
12028373020739b388eb2b8141742509f1764e3c

Added: 
    

Modified: 
    clang/include/clang/AST/TemplateBase.h
    clang/lib/AST/TemplateBase.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h
index b9a787ed1b626..4d1e8beeea18d 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -734,9 +734,6 @@ struct ASTTemplateArgumentListInfo final
 
   ASTTemplateArgumentListInfo(const TemplateArgumentListInfo &List);
 
-  // FIXME: Is it ever necessary to copy to another context?
-  ASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *List);
-
 public:
   /// The source location of the left angle bracket ('<').
   SourceLocation LAngleLoc;
@@ -766,10 +763,6 @@ struct ASTTemplateArgumentListInfo final
 
   static const ASTTemplateArgumentListInfo *
   Create(const ASTContext &C, const TemplateArgumentListInfo &List);
-
-  // FIXME: Is it ever necessary to copy to another context?
-  static const ASTTemplateArgumentListInfo *
-  Create(const ASTContext &C, const ASTTemplateArgumentListInfo *List);
 };
 
 /// Represents an explicit template argument list in C++, e.g.,

diff  --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index d64d3bd5dcc30..961b6acd022ef 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -790,17 +790,6 @@ ASTTemplateArgumentListInfo::Create(const ASTContext &C,
   return new (Mem) ASTTemplateArgumentListInfo(List);
 }
 
-const ASTTemplateArgumentListInfo *
-ASTTemplateArgumentListInfo::Create(const ASTContext &C,
-                                    const ASTTemplateArgumentListInfo *List) {
-  if (!List)
-    return nullptr;
-  std::size_t size =
-      totalSizeToAlloc<TemplateArgumentLoc>(List->getNumTemplateArgs());
-  void *Mem = C.Allocate(size, alignof(ASTTemplateArgumentListInfo));
-  return new (Mem) ASTTemplateArgumentListInfo(List);
-}
-
 ASTTemplateArgumentListInfo::ASTTemplateArgumentListInfo(
     const TemplateArgumentListInfo &Info) {
   LAngleLoc = Info.getLAngleLoc();
@@ -812,17 +801,6 @@ ASTTemplateArgumentListInfo::ASTTemplateArgumentListInfo(
     new (&ArgBuffer[i]) TemplateArgumentLoc(Info[i]);
 }
 
-ASTTemplateArgumentListInfo::ASTTemplateArgumentListInfo(
-    const ASTTemplateArgumentListInfo *Info) {
-  LAngleLoc = Info->getLAngleLoc();
-  RAngleLoc = Info->getRAngleLoc();
-  NumTemplateArgs = Info->getNumTemplateArgs();
-
-  TemplateArgumentLoc *ArgBuffer = getTrailingObjects();
-  for (unsigned i = 0; i != NumTemplateArgs; ++i)
-    new (&ArgBuffer[i]) TemplateArgumentLoc((*Info)[i]);
-}
-
 void ASTTemplateKWAndArgsInfo::initializeFrom(
     SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info,
     TemplateArgumentLoc *OutArgArray) {


        


More information about the cfe-commits mailing list