================
@@ -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:
I think you can fix the regressions by adding
`AllowShortBlocksOnASingleLine.Attached` configuration option. This still
requires a style file change by users.
An alternative would be to introduce `AllowShortBlocksOnASingleLine.Detached`
(or `NotAttached`, or similar), and clarifying that `Always` is only when the
block is attached to the same line preceding the block compound statement.
Limiting `Always` in this way is a bit non-intuitive, but it matches the
documentation and possibly the test cases better.
Personally, I would try adding the `NotAttached` option, and documenting the
constraint on `Always`, assuming that it doesn't require modifying tests.
https://github.com/llvm/llvm-project/pull/196021
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits