Issue 181293
Summary [clang-format] BreakAfterOpenBracketIf has no effect when ContinuationIndentWidth >=4
Labels clang-format
Assignees
Reporter l-inc
    `BreakAfterOpenBracketIf` has no effect when `ContinuationIndentWidth >=4`. That is, the following line:
```
    if (first_very_very_very_very_long_condition && second_very_very_very_very_long_condition) {
```
is formatted as follows (or alike depending on other options):
```
    if (first_very_very_very_very_long_condition &&
 second_very_very_very_very_long_condition) {
```
Although the desired formatting would be as follows:
```
    if (
 first_very_very_very_very_long_condition &&
 second_very_very_very_very_long_condition
    ) {
```
My understanding is that this is due to the logic described in [this comment](https://github.com/llvm/llvm-project/blob/708d1c1b8c2468a366f6914b88eaa3f3a4c932b0/clang/lib/Format/ContinuationIndenter.cpp#L875C43-L876C14). I'm not sure what the target scenario for this logic is, but with `ContinuationIndentWidth >=4`, it effectively defeats the purpose of `BreakAfterOpenBracketIf`. Would removing the respective "conservation" check break anything?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to