================
@@ -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.
----------------
rudolflovrencic wrote:

Seems like a good suggestion but I do not think I can achieve the following 
with that approach:

```c++
void f() {} // Empty function blocks are formatted on a single line.

void g(int x)
{
    if (x == 42) { throw "error"; } // Short loop/if blocks are formatted on a 
single line.
}
```

This formatting was possible in `v21`.

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