[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 19:56:12 PST 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 db88071a8b24ad9302659ee88383eea69a732f11 19bc40e7d824804ebcd9839cb2155a704d368e36 --extensions cpp,h -- clang/include/clang/Format/Format.h clang/lib/Format/ContinuationIndenter.cpp clang/lib/Format/ContinuationIndenter.h clang/lib/Format/Format.cpp clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/ConfigParseTest.cpp clang/unittests/Format/FormatTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index cd968fc719..03581fde1c 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -11118,9 +11118,11 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) {
 
 TEST_F(FormatTest, BreakBeforeTemplateClose) {
   FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp);
-  // Begin with tests covering the case where there is no constraint on the column limit.
+  // Begin with tests covering the case where there is no constraint on the
+  // column limit.
   Style.ColumnLimit = 0;
-  // When BreakBeforeTemplateClose is turned off, the line break that it adds shall be removed:
+  // When BreakBeforeTemplateClose is turned off, the line break that it adds
+  // shall be removed:
   verifyFormat("template <\n"
                "    typename Foo,\n"
                "    typename Bar>\n"
@@ -11132,8 +11134,8 @@ TEST_F(FormatTest, BreakBeforeTemplateClose) {
                "void foo() {}",
                Style);
   Style.BreakBeforeTemplateClose = true;
-  // BreakBeforeTemplateClose should NOT force template declarations onto multiple lines.
-  // Use verifyNoChange since ColumnLimit = 0.
+  // BreakBeforeTemplateClose should NOT force template declarations onto
+  // multiple lines. Use verifyNoChange since ColumnLimit = 0.
   verifyNoChange("template <typename Foo>\n"
                  "void foo() {}",
                  Style);

``````````

</details>


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


More information about the cfe-commits mailing list