[clang] [clang] CTAD: Generate deduction guides for alias templates from non-template explicit deduction guides (PR #96686)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 05:25:53 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 8ac6b415e4e5e631410d9cf6a10f15668f663441 240a56717440df2f857b5aa2fc556ffc3ce4adca -- clang/lib/Sema/SemaTemplate.cpp clang/test/SemaCXX/cxx20-ctad-type-alias.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 55ecddcfa4..b2a654ec78 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3217,11 +3217,12 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
 
       // Clone the parameters.
       for (unsigned I = 0, N = DG->getNumParams(); I != N; ++I) {
-        const auto* P = DG->getParamDecl(I);
+        const auto *P = DG->getParamDecl(I);
         auto *TSI = SemaRef.Context.getTrivialTypeSourceInfo(P->getType());
         ParmVarDecl *NewParam = ParmVarDecl::Create(
-            SemaRef.Context, G->getDeclContext(), DG->getParamDecl(I)->getBeginLoc(),
-            P->getLocation(), nullptr, TSI->getType(), TSI, SC_None, nullptr);
+            SemaRef.Context, G->getDeclContext(),
+            DG->getParamDecl(I)->getBeginLoc(), P->getLocation(), nullptr,
+            TSI->getType(), TSI, SC_None, nullptr);
         NewParam->setScopeInfo(0, I);
         FPTL.setParam(I, NewParam);
       }
@@ -3231,9 +3232,9 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
           AliasTemplate->getBeginLoc(), AliasTemplate->getLocation(),
           AliasTemplate->getEndLoc(), DG->isImplicit()));
 
-      // FIXME: Here the synthesized deduction guide is not a templated function.
-      // Per [dcl.decl]p4, the requires-clause shall be present only if the
-      // declarator declares a templated function, a bug in standard?
+      // FIXME: Here the synthesized deduction guide is not a templated
+      // function. Per [dcl.decl]p4, the requires-clause shall be present only
+      // if the declarator declares a templated function, a bug in standard?
       auto *Constraint = buildIsDeducibleConstraint(
           SemaRef, AliasTemplate, Transformed->getReturnType(), {});
       if (auto *RC = DG->getTrailingRequiresClause()) {

``````````

</details>


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


More information about the cfe-commits mailing list