<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98812>98812</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] no space in cdtor declaration with SpaceBeforeParensOptions: AfterFunctionDeclarationName: true
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
urnathan
</td>
</tr>
</table>
<pre>
It seems that cdtors (as they pedantically have no name?) do not pay attention to `AfterFunctionDeclarationName: true` or `AfterFunctionDefinitionName: true` with `SpaceBeforeParens: custom` style options. Aesthetically this is undesired -- the space in the declaration/definition makes the name stand out more.
```
/*
.clang-format contents:
BasedOnStyle: LLVM
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterFunctionDeclarationName: true
AfterFunctionDefinitionName: true
*/
struct A {
// space before (, as expected
void frob(); // void frob ();
// no space before (, unexpected
A (int); // A(int);
A (int) {} // A(int) {}
~A (); // ~A();
~A (); // ~A() {}
};
void fn (A &a)
{
// no space before (, expected
(void)A (); // (void)A();
a.frob (); // a.frob();
a.~A (); // a.~A();
}
```
Perhaps the type should be considered the name in these cases? or a new cdtor-specific spacing option?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVU2PozgQ_TXmUkpETALhwIFMhLTS7M5II-3d4ErwLtjILno2l_7tKxuaTtPsRxQRQz0_-z1TL8I5ddeIBTtd2OkaiZFaY4vRakGt0FFt5KP4hcAh9g6oFQSNJGMdMH4W_gk-YEApNKlGdN0DWvGCoA1o0SNLKsZzkAa0IRjEAwQRalJGAxlgaVzeCG016sY_u2LTCSv88LcwuwSyI7I0BmM30Del1Rb4p6IWPP7HIBq84M1Y_C4saudRzejI9B7n6NEhmMFzuD2U6KjFNx3UKgfKwaglOmVRwm7n5YLzpKB0uJHvW2a8ksuWoBd_YrAnGAGOhJZgRoLeWNyz-MrikqXx_J1uecV4OY33TSf0fXcztveWG-1t89ufyhfhUH7TP7wAr-nr199_nSqbkr9MkrcB3yb9Czf8rzOZoGvs5onM4oK-aRyujuzYEJTAsssbXbCgmi2uwyb9i8b4FxAO8K8BG0L5hn4xSsLNmjpAcpZcwH9mkqUKS_l5-QWnzeZ6o14vV_qS0rQsNROUz483wEFgdv0MnwtvU15L2BTyWq4E_CfyA7EffJQ-OaM9hydKRZgyg9dn8Q_2rM1h_OxpGc-f9zZzPBXXUkDsP57RsvBU2MCv1S_4T0a9e7DqtHD9jrYVw9Sk9BgQXGvGTkKNvuGckui7fmnhqeMdQiMcOpZUPpQEaPw5ReLODdiom2qCX0rf52RhSRXJIpF5kosIi0PG4zzlPM2ituC8jg_xTWCS1PW5bvB0POVZcrqJLM6PhyRSBY_5Mc4Ox0MSH3m2z894TrNUyibOMEslO8bYC9Xtu-6l3xt7j5RzIxb5-XzgUSdq7FwId86fI4Vx7uPeFn7arh7vjh3jTjly70SkqAt_DB8mnq7vr4TSk_TnGJzS919SBj6lxmbCRKPtipZoCMkUjviuqB3rfWN6xiu_zflnN1jzBzbEeBXEO8arSf9Lwf8OAAD__6U7EDE">