| Issue |
161380
|
| Summary |
[clang-format] A combination of AllowShortBlocksOnASingleLine, AllowShortIfStatementsOnASingleLine and BreakBeforeBraces does not break after 'else' with braces
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
DPD85
|
- clang-format version used 21.1.2
- Operating System: Windows 11
In case of if-else statement with braces surranding the else content should be placed on a new line, instead the open brace is placed on the same line of the else keyword.
Input
```cpp
if(massimo < 1)
return;
if(massimo < 1)
return;
else
massimo *= 2;
if(massimo < 1) return;
else { massimo *= 2; }
if(massimo < 1) { return; }
else { massimo *= 2; }
```
Output
```cpp
if (massimo < 1) return;
if (massimo < 1) return;
else massimo *= 2;
if (massimo < 1) return;
else {
massimo *= 2;
}
if (massimo < 1)
{
return;
}
else {
massimo *= 2;
}
```
Aspected
```cpp
if (massimo < 1) return;
if (massimo < 1) return;
else massimo *= 2;
if (massimo < 1) return;
else
{
massimo *= 2;
}
if (massimo < 1)
{
return;
}
else
{
massimo *= 2;
}
```
Here the shorted configuration that trigger the issue:
```
---
AllowShortBlocksOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
BreakBeforeBraces: Allman
...
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs