<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97818>97818</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] feature request/question: General bracket alignment rule
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SamCoutteauHybrid
</td>
</tr>
</table>
<pre>
In our code base we have a simple rule that any bracket ( `()`, `[]`, `{}`, `<>` ) pair should either be an the same row or the same column.
Thus
```cpp
if(){}
```
or
```cpp
if
(
)
{
}
```
It seems like this can currently be achieved for most cases of `{}` however for the others ( `()`, `<>`, `[]` ) it does not seem possible the enforce this rule. clang format seems to at best produce:
```cpp
if(
)
{
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU9uSozgM_RrzouoUGAjwwENfNrv9vPsDwijB28ZmLDtd-fspTDKdnqq5VaViHbB0pHMQMuuTJepF_STqlwxjmJzv_8X52cUQCOM_l8HrMRvceOlfLbjoQbmRYEAmeCeY8EyAwHpeDIGPhiBMGADtBQaP6o0CCNmC2OdCtkJ2KXhOOHHe4eZJNPe4fBblX2Kfg5AdLKg98OSiGYF0mMjDQIAWwkTAOBN49w7Of2DlTJztTuQvIn_c_v-bIt_jlSX91LJsT_Tx2ubWzOdb96nO_7LQ9ka2t6C7Bs3TLfgZwWsAJpoZjH5bRdUMCi2o6D3ZYC5pfDVpOtMIR-dhdhxAIRODO34SFCb3Tmfy6dqqj1v14x8acxP-e6OSETrA6IjBuq1BWByzHpLxBGSPzqtrv-vnsANl0J5W6hlvIwUHGGAgDrB4N0ZFonz8HWP-UMls7MuxKzvMqC8amRdtXtUym3qsGzns64ZKVVdF21FBBVWykfu664ouz3Qvc1nlTV4XRV0VctfhHhtUZdl1ddWWKKqcZtRmZ8x53jl_yjRzpL5r2qLNDA5kOK2VlEmAh00AIeW6aL5f0x6GeGJR5UZz4I9CQQeTVvJTYv0CR8IQPYGnL5E4CHlIp3ZWlI_wN1nyaL6tHRp9sjPZkHzIojf9FMLCq9TyIOThpMMUh51ys5CHlf16PCze_U9qrZ9mYiEP21jnXn4NAAD__9EeNvQ">