.clang-format
:
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
BraceWrapping:
AfterControlStatement: Always
BeforeElse: true
BreakBeforeBraces: Custom
test.cpp
:
int main() {
int x = 1;
if (x > 0)
{
++x;
--x;
}
else
{
--x;
++x;
}
}
Expected result of running clang-format
: no change
Actual result:
int main() {
int x = 1;
if (x > 0)
{
++x;
--x;
}
else {
--x;
++x;
}
}
Note how the brace after the else
on line 8 has not been wrapped despite the block not being "short".
This seems to occur beginning at version 21.1.0. Version 20.1.8 yields the expected result.