Issue |
140220
|
Summary |
clang-format, Inconsistent formatting with BraceWrapping.AfterControlStatement: MultiLine for single-line and multi-line if conditions
|
Labels |
clang-format
|
Assignees |
|
Reporter |
halcyonx
|
Tested with: clang-format version 20.1.3 (https://github.com/llvm/llvm-project 923a5c4f83d2b3675bb88e9fe441daeaa4d69488)
Using BraceWrapping.AfterControlStatement: MultiLine leads to inconsistent formatting between single-line and multi-line if statements, which creates a visual inconsistency in codebases that use the compact if (cond) {} style.
```yaml
BraceWrapping:
AfterControlStatement: MultiLine
```
```cpp
if (!flag1) {
return;
}
if (flag2)
{
return;
}
```
If a codebase uses AfterControlStatement: Never and all if statements were consistent, it may still be desirable to apply AfterControlStatement: MultiLine for multi-line if conditions only, while keeping AfterControlStatement: Never for all other cases.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs