<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62905>62905</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format poor indentation with braces initializer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cmcqueen
</td>
</tr>
</table>
<pre>
`test.c` containing:
```
static const CMD_HANDLER_T command_handlers[] =
{
{ "a", HandleA },
{ "bb", HandleBB },
{ "ccc", HandleCCC },
{ NULL, NULL },
};
```
Command:
clang-format -style="{ Cpp11BracedListStyle: true, ColumnLimit: 0 }" test.c > test.out.c
Result:
```
static const CMD_HANDLER_T command_handlers[] =
{
{"a", HandleA},
{"bb", HandleBB},
{"ccc", HandleCCC},
{NULL, NULL},
};
```
* The opening and closing braces are misaligned.
* I was hoping to configure it so the opening brace and inner initializers would have one less level of indentation. But I couldn't figure out how to make that happen. I would hope for it to behave like `BraceWrapping.IndentBraces: false`. I.e. I was hoping the result would be:
```
static const CMD_HANDLER_T command_handlers[] =
{
{"a", HandleA},
{"bb", HandleBB},
{"ccc", HandleCCC},
{NULL, NULL},
};
```
I have tested this with `clang-format` v13.0.1, v15.0.7 and v16.0.0, with the same results.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVGPozYQ_jXmZbSWMQE2Dzwk5KKLlN7D9ao-rowZgnvGptgk2v76ypBdsulW26q9KAJjZuYbf99nI5xTJ4NYkHRL0l0kRt_aoZCd_H1ENFFl6-eCZMyj81SSjIG0xgtllDmRZEPYjrANydj1Pz06L7ySIdB5KH_aPX3efNkdP319-gbSdp0w9VMrTK1xcDMqkGR3rZRv5wEAAMm34cq5IJwTXsLN7_NUYAMk3xFevpNTVX9JmnO229s67-UTzqWU9-lzdlmWH2QDfPnleHyLHGbeBIdxsn2XvflazkQtFL9iSC3M6aGxQyc8PDj_rDHQx3kAL_s-jreDkFgflfM_z2834IcRQ0ul1WNnjqpTPkyzuSkOs7xAkk_z0I5B7Rvkr-hG7e_a-f90v5K3PLxMLOJfFX9D-RzxKvWLwPeyLMUWXV_l_JvgFxGn-79RjvANfGsRbI9hk4AwNUhtXRhXQRkHYkDolBM6bL2aLnkHuAgHre1DsLeBykadxgFBeXAW_E3dqdZUXRmDAyijvBJa_YGDg4sddQ2tOCNYg6DROdB4Rg22AWVqNEErayhsRw8HkCHeEJ57uALa0UNrL6GLTnxH8K3w0Iq-R0NDnzOA7REaO4T2vIUKJ0StviOQjE0-_HUQfVgOPUyo05wL3muEdkgyRuFAkd4tvUUYJsddgSr8YdZbbPex31599KHl_pnd_ovPDrO8YbtiDb5VDi7Kt4H42yMiHNnnOKGMxgHmHKeU0XzyzTnOKKMsTE-ZgXUnuhfqHY3qIqnXyVpEWMTZ42odrxKWR23BslXGcmzSJo-bCrOsXifVIz5mVd4kTVZFquCMJyzlK5avUpZTTDlPcyHyOpWNzNZkxbATSlOtzx21wylSzo1YZHzN0kiLCrWbvkmcG7zA9DJQme6ioQg5D9V4cmTFtHLeLVW88hqLN2dkb4NBF8_Pi71uxZtdE42DLlrv-2BPwveE70_Kt2NFpe0I3weM6-2hH-xvKD3h-6kzR_h-6vzPAAAA__-pqxJF">