[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in Nested Object Construction (PR #131969)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 23 22:00:23 PDT 2025


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 5ac680c5bffdc216d131fd260d2b1c9435b15571 fa0f1079587e6e26279c293fe4467ff0388f6a43 --extensions cpp -- clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
index 277994bbb6..ea449944bb 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
@@ -225,12 +225,11 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) {
 
   // allow for T{} to be replaced, even if no CTOR is declared
   auto HasConstructInitListExpr = has(initListExpr(
-      initCountLeq(1),
-      anyOf(allOf(has(SoughtConstructExpr),
-                  has(cxxConstructExpr(argumentCountIs(0)))),
-            has(cxxBindTemporaryExpr(has(SoughtConstructExpr),
-                                     has(cxxConstructExpr(argumentCountIs(0)))
-                                         )))));
+      initCountLeq(1), anyOf(allOf(has(SoughtConstructExpr),
+                                   has(cxxConstructExpr(argumentCountIs(0)))),
+                             has(cxxBindTemporaryExpr(
+                                 has(SoughtConstructExpr),
+                                 has(cxxConstructExpr(argumentCountIs(0))))))));
   auto HasBracedInitListExpr =
       anyOf(has(cxxBindTemporaryExpr(HasConstructInitListExpr)),
             HasConstructInitListExpr);

``````````

</details>


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


More information about the cfe-commits mailing list