<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76396>76396</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] member functions are not processed as functions while using SpaceBeforeParensOptions::AfterFunctionDefinitionName
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pohaha
</td>
</tr>
</table>
<pre>
While trying to create a clang-format for our section, I have met with some difficulities, we usually add space after function definition names and after function declaration names (before parens), for both member functions and free functions, while not putting space after function name in function call
I have tried this clang-format configuration
[clang-format.txt](https://github.com/llvm/llvm-project/files/13771924/clang-format.txt)
the needed parameters are the following
```
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: true
AfterFunctionDeclarationName: true
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: true
AfterRequiresInExpression: true
BeforeNonEmptyParentheses: false
```
exactly:
```
AfterFunctionDefinitionName: true
AfterFunctionDeclarationName: true
```
preferred output is:
```cpp
struct my_struct {
int some_field = 0;
void some_member_function ();
} test_obj;
void my_struct::some_member_function () {
printf("hello from member function");
}
void some_free_function () {
printf("hello from free function");
}
void do_stuff () {
// use member function
test_obj.some_member_function();
// use free function
some_free_function();
}
```
output i have (using clang-15, ubuntu-22.04)
```cpp
struct my_struct {
int some_field = 0;
void some_member_function ();
} test_obj;
void my_struct::some_member_function() {
printf("hello from member function");
}
void some_free_function () {
printf("hello from free function");
}
void do_stuff () {
// use member function
test_obj.some_member_function();
// use free function
some_free_function();
}
```
note line 6:
>```cpp
>void my_struct::some_member_function() {
>```
which has no space after member function definition name
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVk1v4zYQ_TX0ZRBDovx58CGJYyCHboruoceAIocWFxSpksMk_veFJH_KbpDuqQUWMGSZfJx5fBy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