aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMarek Kurdej <marek.kurdej+llvm.org@gmail.com>2022-02-11 14:53:36 +0100
committerMarek Kurdej <marek.kurdej+llvm.org@gmail.com>2022-02-13 21:22:17 +0100
commit9cb944597907458ce9c2f6bd0ecc9723b674b77f (patch)
tree377ba9dc75d144f11114aaf6872b751c1e30ed08 /clang/lib/Frontend/CompilerInvocation.cpp
parent986afe847951a59cd66783e1377b13cec6412972 (diff)
downloadllvm-9cb944597907458ce9c2f6bd0ecc9723b674b77f.zip
llvm-9cb944597907458ce9c2f6bd0ecc9723b674b77f.tar.gz
llvm-9cb944597907458ce9c2f6bd0ecc9723b674b77f.tar.bz2
[clang-format] Correctly format loops and `if` statements even if preceded with comments.
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 ``` Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan Differential Revision: https://reviews.llvm.org/D119649
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions