<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115617>115617</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Additional flag of SpaceBeforeParensOptions for C variable declaration required.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
adong660
</td>
</tr>
</table>
<pre>
At present, SpaceBeforeParens and its associated SpaceBeforeParensOptions options have limited support on C variable declaration.
If we have a line of C code like
`int (*ptr)[4];`
It turns out that, if I want to reserve the space between `int` and `(*ptr)`, I have no choice but to set SpaceBeforeParens to be `Always`, which prevents me from control the existence of spaces at other places more better. Therefore, I hope there would be a flag called `AfterBaseType` for SpaceBeforeParensOptions.
I believe that a space at that place is a desired feature among many people, because the exsiting PointerAlignment and ReferenceAlignment options both add at least one space after the type, such as `int *ptr`, `int* ptr`, or `int * ptr`. Generally speaking, a space between the type name and "something following it" should be desired (although some people like to put `int` and `*` together, in which case the space comes a bit later, after the `*`).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2TozYQ_TXypWsoEMYfBw62p5yaU7aS_QONaEBZIRGpseN_n5LAO7PJzMUYqvX03uvXjSHo3hLVojqL6nWDMw_O19g62-92-aZx7aM-MUyeAlkW8gJ_TqjoTJ3z9A092QBoW9AcAENwSiNT-_-i3yfWzgZw63PAG4HRo47VYZ4m5xmchQvc0GtsDEFLyqDHWJ-ByF9Fflp-3zq404KAYLQlcB1cQLk2Qv6gtXaXa8sg5EHI08ReyKOozltRvYryLHb5isXAs4_EZgYeMEnUHbzBHS0DO4jK_Y2AB4IQZUFDfCeysNwgdnlyIEJ-vCu-XuBt4WkdqMHpeHhOqIH4EyfZQUMR6WTu-Agrxn3QaogtuJHlACNB590Iyln2ziRi9I8OTFYlKxLLAMjgeCAPk0nvo_OJO5PP4PtAPt28knRTUugJ7m42ba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