[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 00:26:06 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 c557d8520413476221a4f3bf2b7b3fed17681691 ad1fdbb0131b10acf213b7fe49b0421856eadbc8 --extensions cpp,h -- clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/UnwrappedLineFormatter.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/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 6b57f80056..300bd770f9 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -660,8 +660,7 @@ private:
         return 0;
       // Check that the line after the inner result starts with a closing brace
       // which we are permitted to merge into one line.
-      if (I[N]->First->is(tok::r_brace) &&
-          !I[N]->First->MustBreakBefore &&
+      if (I[N]->First->is(tok::r_brace) && !I[N]->First->MustBreakBefore &&
           !I[MergedLines + 1]->Last->is(tok::comment) &&
           nextNLinesFitInto(I, I + N + 1, Limit)) {
         return N;

``````````

</details>


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


More information about the cfe-commits mailing list