[clang] [Sema]Substitue parameter packs when deduced from function parameter (PR #79371)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 13:26:07 PST 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 604a6c409e8473b212952b8633d92bbdb22a45c9 d4ca5c2fcb87f424be23efc4513df491403c3811 -- clang/lib/Sema/SemaTemplateDeduction.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 46fa9eece3..13b5bcf2d0 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -869,18 +869,19 @@ public:
       return {};
     unsigned PackSize = Packs[0].Saved.pack_size();
 
-    if (std::all_of(Packs.begin() + 1, Packs.end(),
-                    [&PackSize](auto P) {
-                      return P.Saved.getKind() == TemplateArgument::Pack &&
-                             P.Saved.pack_size() == PackSize;
-                    }))
+    if (std::all_of(Packs.begin() + 1, Packs.end(), [&PackSize](auto P) {
+          return P.Saved.getKind() == TemplateArgument::Pack &&
+                 P.Saved.pack_size() == PackSize;
+        }))
       return PackSize;
     return {};
   }
 
   /// Determine whether this pack has already been deduced from a previous
   /// argument.
-  bool isDeducedFromEarlierParameter() const {return DeducedFromEarlierParameter;}
+  bool isDeducedFromEarlierParameter() const {
+    return DeducedFromEarlierParameter;
+  }
 
   /// Determine whether this pack has already been partially expanded into a
   /// sequence of (prior) function parameters / template arguments.
@@ -1031,7 +1032,6 @@ private:
   /// The number of expansions, if we have a fully-expanded pack in this scope.
   std::optional<unsigned> FixedNumExpansions;
 
-
   SmallVector<DeducedPack, 2> Packs;
 };
 
@@ -4406,12 +4406,12 @@ Sema::TemplateDeductionResult Sema::DeduceTemplateArguments(
         // parameters in the template parameter list of the template are
         // replaced with the corresponding deduced or default argument values
         //
-        // If we have a trailing parameter pack, that has been deduced perviously
-        // we substitute the pack here in a similar fashion as seen above with
-        // the trailing parameter packs. The main difference here is that, in
-        // this case we are not processing all of the remaining arguments. We
-        // are only process as many arguments as much we have in the already
-        // deduced parameter.
+        // If we have a trailing parameter pack, that has been deduced
+        // perviously we substitute the pack here in a similar fashion as seen
+        // above with the trailing parameter packs. The main difference here is
+        // that, in this case we are not processing all of the remaining
+        // arguments. We are only process as many arguments as much we have in
+        // the already deduced parameter.
         SmallVector<UnexpandedParameterPack, 2> Unexpanded;
         collectUnexpandedParameterPacks(ParamPattern, Unexpanded);
         if (Unexpanded.size() == 0)

``````````

</details>


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


More information about the cfe-commits mailing list