<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114666>114666</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: Cannot add a line break between a if-condition clause and its left bracket
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
littlebutt
</td>
</tr>
</table>
<pre>
## 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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1v6zYQ_DXUZWFBomzLOujgjxoNkCKHFM2xoMSVxIYiDXIVPf_7grKcxK4f0AcYNsyPmeHO7ArvVWsQS7basdUhEgN11pVaEWmsBqKosvJcMp4xnsEBfe3UiZQ1LDmwZHv5foJRGAKyIKQEAQZH0MogVEgjogEBqlnU1kgVrkKtxeARhJGgyIPGhqByon5HAq3eEagTxLLtd44dNtbh1-I6mT_TX9UA45tPBsYLYPnusgeMHxk_grTgbY_UKdPOIPnhIdq2IXT_n-oKduUD-BVK-MYJDoVUpgXqEKSthx4NAVvtOnTIVgfGNx3RyQdtE0OthWljrT_62LqW8aO0tWf8uA_rR-t6Qa901vgyeebjjnrNeBaKjaMTp1MQxgvG9_AE5BTK4GJvpWrO0J-BrZN44lg0E1jQOzuk_J1Dd3XaCY_yxUz0LNvC8_Nff8xxMRINvSlJXdhYXlb3Vg-9eVa9CtZDmlxxgta3q9YrJUz12ltDzupXEoShVOHiVo_i7L-suATnN-0nFeQGfCx3IFAEUkkwlmC07j2-zbjQ3t4F_RJyh-IdhLODkZNxqD2Cv2qCaiB4-gRu1Hyqts5hTTCK8w3R3Grfqw4f6Pxdzz3ah3QTp_HmAdrL6_fFN2WkHT2kCXD-O_8Z-09pH_L9KVyLkwM_Nuu_18vFqV6MF6JF7z_q-VQXIh4ShjqcPVmvfkSyzGSRFSLCMs2zZLXK8mIZdWWNDS-SJG34RmAjRJbyKts0-Wpd5bmsZKRKnvBlmiY8zXiWZnEiiibLZY6YyyKvCrZMsBdKf_ZIpLwfsEzT5Xq9jrSoUPtp-HF-E3TOwzh0Zbi3qIbWs2WilSf_hUSKNJY3t7It7IUJPv8nIL8-C6PB6fK231tF3VDFte0ZPwYh88_i5Ow_WBPjx-l9YQbMT_wo-b8BAAD__2vfy70">