================
@@ -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 don't know that this entirely makes sense. As it currently works:
`$ echo "while (foo > 0) { --foo; }" | clang-format --style="{BasedOnStyle:
LLVM, BreakBeforeBraces: Custom, BraceWrapping: {AfterControlStatement: true},
AllowShortLoopsOnASingleLine: false, AllowShortBlocksOnASingleLine: true,
ColumnLimit: 20}"`
```
while (foo > 0)
{ --foo; }
```
I think this is intended, and the changes here will cause more regressions. I
don't currently have an older clang-format to check with, but it seems (based
on the test case changes) that there are going to be a lot of changes here and
it's not clear how to support users through a transition.
https://github.com/llvm/llvm-project/pull/196021
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits