[clang] [clang-format] Disable short blocks if brace is on the new line (PR #196021)

Rudolf Lovrenčić via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 13 08:03:31 PDT 2026


================
@@ -2297,7 +2284,7 @@ TEST_F(FormatTestJS, WrapAfterParen) {
                "    });",
                getGoogleJSStyleWithColumns(40));
   verifyFormat("while (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&\n"
-               "       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) {\n}");
+               "       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) {}");
----------------
rudolflovrencic wrote:

I think Google style guide might need changing since it sets   `AllowShortLoopsOnASingleLine: true`. Now, it should be set to `false` since [Google discourages single line loops](https://google.github.io/styleguide/cppguide.html#Formatting_Looping_Branching). Same for `if`s.


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


More information about the cfe-commits mailing list