Issue 114666
Summary clang-format: Cannot add a line break between a if-condition clause and its left bracket
Labels clang-format
Assignees
Reporter littlebutt
    ## Description

I want to add a new line between a if-condition clause and its left bracket like that:

Before:
```
if (condition) {
 // do something
}
```
After:
```
if (condition)
{
    // do something
}
``` 
After reading the document [here](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#bracewrapping), I tried to modify my `.clang-format` like this:

```
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 100
BraceWrapping:
 AfterControlStatement: Always
    BeforeElse: true
```
But it did not work.

I also want to add a line break around the else statement but I did not find the correct way.

## clang-format version

clang-format version 18.1.8

## OS

Windows 10 22H2

## clang version

clang version 18.1.8
Target: x86_64-pc-windows-msvc
Thread model: posix
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to