[clang] [Clang][AST] Store injected template arguments in TemplateParameterList (PR #113579)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 08:14:15 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff a18826d75cb0d0d13fc1aef620e04d2901e9bced 69f9da551992f565ca8d839aa499aed278df55a8 --extensions h,cpp -- clang/include/clang/AST/ASTContext.h clang/include/clang/AST/DeclTemplate.h clang/lib/AST/ASTContext.cpp clang/lib/AST/DeclTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7b602955e8..57ffee0408 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -5666,7 +5666,8 @@ TemplateArgument ASTContext::getInjectedTemplateArg(NamedDecl *Param) const {
   }
 
   if (Param->isTemplateParameterPack())
-    Arg = TemplateArgument::CreatePackCopy(const_cast<ASTContext &>(*this), Arg);
+    Arg =
+        TemplateArgument::CreatePackCopy(const_cast<ASTContext &>(*this), Arg);
 
   return Arg;
 }
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 34e7bdf630..b295e2dd5d 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -51,14 +51,15 @@ DefaultTemplateArgumentContainsUnexpandedPack(const TemplateParam &P) {
          P.getDefaultArgument().getArgument().containsUnexpandedParameterPack();
 }
 
-TemplateParameterList::TemplateParameterList(const ASTContext& C,
+TemplateParameterList::TemplateParameterList(const ASTContext &C,
                                              SourceLocation TemplateLoc,
                                              SourceLocation LAngleLoc,
                                              ArrayRef<NamedDecl *> Params,
                                              SourceLocation RAngleLoc,
                                              Expr *RequiresClause)
-    : InjectedArgs(&C), TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
-      NumParams(Params.size()), ContainsUnexpandedParameterPack(false),
+    : InjectedArgs(&C), TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc),
+      RAngleLoc(RAngleLoc), NumParams(Params.size()),
+      ContainsUnexpandedParameterPack(false),
       HasRequiresClause(RequiresClause != nullptr),
       HasConstrainedParameters(false) {
   for (unsigned Idx = 0; Idx < NumParams; ++Idx) {
@@ -628,8 +629,8 @@ ClassTemplateDecl::getInjectedClassNameSpecialization() {
   ASTContext &Context = getASTContext();
   TemplateName Name = Context.getQualifiedTemplateName(
       /*NNS=*/nullptr, /*TemplateKeyword=*/false, TemplateName(this));
-  CommonPtr->InjectedClassNameType =
-      Context.getTemplateSpecializationType(Name, getTemplateParameters()->getInjectedTemplateArgs());
+  CommonPtr->InjectedClassNameType = Context.getTemplateSpecializationType(
+      Name, getTemplateParameters()->getInjectedTemplateArgs());
   return CommonPtr->InjectedClassNameType;
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/113579


More information about the cfe-commits mailing list