<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64137>64137</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: function declaration parsing breaks on __attribute__(())
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gedare
</td>
</tr>
</table>
<pre>
Function names are not detected correctly when there is an `__attribute__((x))` preceding the name.
Buggy output example:
```
echo "void __attribute__((naked)) foo(int bar);" | clang-format -style="{BasedOnStyle: llvm, SpaceBeforeParens: Custom, SpaceBeforeParensOptions: {AfterFunctionDeclarationName: true}}"
void __attribute__((naked)) foo(int bar);
```
Expected:
```
echo "void __attribute__((naked)) foo(int bar);" | clang-format -style="{BasedOnStyle: llvm, SpaceBeforeParens: Custom, SpaceBeforeParensOptions: {AfterFunctionDeclarationName: true}}"
void __attribute__((naked)) foo (int bar);
```
This also affects `AfterFunctionDefinitionName` and probably other options too.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVMFuozAQ_RpzGSUyhgA5cGiazXG7UvceDfYA3jo2sk3b_P3K0G6rVS7d80ojAx7sN_PezGAIerBELdsd2O6Y4RxH59uBFHrKOqeu7Wm2MmpnweKFAqAnsC6CokgykgLpvCcZzRVeRrIQR_IEOgBaYBU_nzFGr7s50vnMRMNE88rEPlnFYfIkSWk7pGMLwJbxI-N363qYh-EKbo7THIFe8TIZYsWbk1X8zZZPkqMDJsSz0wpuoFp8IrUiQ-8cE422ETr0aa84MCGA1fcgDdph0zt_wQibEK8J8ciEYPXhgIHUg31cN-_AmOcLE_fwOKGkA_XO0w_0ZENy3s8hutvuhynxufzF6sNdH8m_k3wkadBjev2OlwUl-plYfUwmxGd2_jXTW-yt67fXadH0P8df5Bi-QPLPMTWHCQ6w70nGkNrkrwB7bfWf-CoOaBVM3nXYmSu41GLg1gQhOvfWM5lqC7Uv9phRm1d7XvKq5Hk2tlLVvBdlU-RdU0ue075qOiy7qutUXzdlplvBRcFrUYlccJ5vdwVHUamc98SbfNewktMFtdkmObbOD5kOYaa2KvOizgx2ZMIyQoSw9AKLMzG5O2a-TWc23TwEVnKjQwwft0QdDbWf6yGp0b9PHPWhFEzoQxoUnSd8CuDsLVlWRbLZm3aMcUryM3Fi4jToOM7dVqZqOa01tTw2k3e_SEYmTkvQgYnTktTvAAAA__9ev5l_">