<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58527>58527</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-format not correctly formatting braces in function declaration
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RustyClanker
      </td>
    </tr>
</table>

<pre>
    clang-format version 15.0.1, LLVM on Windows 10.

Using separate custom BreakBeforeBraces rule in .clang-format causes clang-format to handle function definitions incorrectly for struct and enum, if the brace rules for those keywords differ from a function.

```
BreakBeforeBraces: Custom
BraceWrapping:
  AfterEnum: true
  AfterStruct: true
  AfterFunction: false
```

Example after format:

```
int some_int_func(void) {
    return 0;
}

struct FooStruct return_a_struct(void)
{
    return (struct FooStruct){0};
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU01zmzAQ_TXishNGCAPmwCG241N6aafN0SPQYqvBkkcSSf3vuwI7iZPMMGLZj7dvV4_WqnPTDdLs73rrjjLACzqvrYGsSHmaMbGGx8c_P4A8T9oo--oh4ynjG8bv5_O312YPHk_SyYDQjT7YI6wcyucVEiiunOzQgxsHBG0gvWnXydFT8MYXLBykUZTej6YLkY3CXhsdTU8YnXUOuzCcgSrABzd2AagC0IzHSFn3EA4Ibew8NfZTZjhYj_CM51frlAel-x4d9I74yrdeN8Oxkl-e6fPLVCy_h_U08TWBvE9Onk60FArOXoD7PqB7iOyogPjiTeDXNMG3oe2FVQz2cvD4La_5fPgnjyfamoyFMC_zjcO3ddoE8PaIOzJ2cQFMLF-sVkzUwKrVlQmAwzA6A5zlFyerNh9xL3ewtXae5VKwk7s58o57Lf8KTjmfYWJ-teKx2dfG11ESbLKyLPOiqqsyUU2u6ryWSdBhwFttG0uC-6gdcoao3naWKKnzg-KolBRNdjK6oTmEcIrXzcSWnr0Oh7FNO7p3sR2Gl-vr7uTsX4zEt9r7kQQitsWyEFVyaESWyZbXvSjqOlNdprhc5H25XApVILaYDLLFwTesWDEhDL7CBEE2KzaJbgQXIuOEkmeiKNIu66uCL0u1rBeLQlVswfEo9ZBGHql1-8Q1E6V23HsKDtoH_x6U3uu9QZzaEb4c6e9wzU8S83lNS3tGl0z9m4n_f9hmUX8">