Fixes https://github.com/llvm/llvm-project/issues/53758.
Braces in loops and in if statements with leading (block) comments were formatted according to BraceWrapping.AfterFunction and not AllowShortBlocksOnASingleLine/AllowShortLoopsOnASingleLine/AllowShortIfStatementsOnASingleLine.
Previously, the code:
while (true) { f(); } /*comment*/ while (true) { f(); }
was incorrectly formatted to:
while (true) { f(); } /*comment*/ while (true) { f(); }
when using config:
BasedOnStyle: LLVM BreakBeforeBraces: Custom BraceWrapping: AfterFunction: false AllowShortBlocksOnASingleLine: false AllowShortLoopsOnASingleLine: false
and it was (correctly but by chance) formatted to:
while (true) { f(); } /*comment*/ while (true) { f(); }
when using enabling brace wrapping after functions:
BasedOnStyle: LLVM BreakBeforeBraces: Custom BraceWrapping: AfterFunction: true AllowShortBlocksOnASingleLine: false AllowShortLoopsOnASingleLine: false
Why not use FirstNonComment instead of TheLine->First down here?