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

Gedare Bloom via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 08:02:45 PDT 2026


================
@@ -895,6 +889,11 @@ class LineJoiner {
         Line.startsWithExportBlock()) {
       if (IsSplitBlock)
         return 0;
+      // The construct-specific options AllowShortIfStatementsOnASingleLine and
+      // AllowShortLoopsOnASingleLine take precedence over
+      // AllowShortBlocksOnASingleLine: a statement whose specific option
+      // disallows merging is not put on a single line even when short blocks
+      // are always allowed.
----------------
gedare wrote:

This is only one direction of precedence. It appears the other direction is not supported, but it would probably be expected based on the wording here. What happens for example with
`AllowShortIfStatementsOnASingleLine: True` and `AllowShortBlocksOnASingleLine: False`?

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


More information about the cfe-commits mailing list