Issue 123039
Summary Unexpected interaction between ColumnLimit = 0 and BWACS_MultiLine
Labels new issue
Assignees
Reporter semushin-s
    Let's say we have the following config
```
BasedOnStyle: WebKit
ColumnLimit: 0
BreakBeforeBraces: Custom
BraceWrapping:
  AfterControlStatement: MultiLine
```
As a result any of the following snippets do not change after formatting (as if it's ok to either wrap or not wrap the brace regardless of if being multilien):
```cpp
bool f(int b)
{
    if (b)
    {
        return true;
    }
    return false;
}
```
```cpp
bool f(int b)
{
    if (b) {
        return true;
    }
    return false;
}
```

```cpp
bool f(int b)
{
    if (b
        && true) {
        return true;
    }
 return false;
}
```

```cpp
bool f(int b)
{
    if (b
        && true)
    {
        return true;
    }
    return false;
}
```

I think the correct behaviour should be to consider control statement having any line breaks before formatting or not in such case.
If I'm not mistaken [here](https://github.com/llvm/llvm-project/blob/fb13e65acf0b7de3dd0b60b6312df07fdf9da652/clang/lib/Format/UnwrappedLineFormatter.cpp#L318) is the place where we check is statement multi line or not based on column limit only.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to