================
@@ -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:

To me it makes sense to make these options operate as independently from each 
other as possible. The block option should control the behavior of `{ ... }`, 
the Loop/If option should control the behavior everything up to the first `{`, 
and the `BraceWrapping` should control the behavior of that first `{`.

Somehow the initial options for the Loop/If appeared to assume these were just 
for braceless one-liners, which makes some sense. However, as the scope has 
expanded to include braces, the need to treat the cases of bracless, with 
braces, braces on same/next line, and ability to fit entire braced expression 
on one line, have all become necessary to handle simultaneously.

The current direction of this PR is moving away from fixing a regression and 
toward introducing new regressions. The modification of the test cases shows 
this. You should instead show how the test case `Style` options need to be 
changed in order to maintain the tests, and add new test cases (as you have) 
for any uncovered behavior.

NB: I do not have a style that is no longer possible to achieve, I'm looking at 
this solely as a reviewer and developer of clang-format.

https://github.com/llvm/llvm-project/pull/196021
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to