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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] `BreakAfterAttributes` should consider `AttributeMacros`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

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

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

<pre>
    I'm currently working on a CUDA project, and want clang-format to break after CUDA-specific attributes like `__device__`, `__global__`, etc. I attempted the following configuration, but it doesn't seem to work as expected:

```yaml
# in .clang-format
BreakAfterAttributes: Always
AttributeMacros: [__device__, __host__, __global__, __shared__, __constant__, __forceinline__]
```

It turns out that clang-format only apply `BreakAfterAttributes` to standard cpp attributes (`[[...]]`), but not to macros listed in `AttributeMacros`.

```cpp
// currently formatted code
[[maybe_unused]]
void test() {}

__device__ __forceinline__ void test2() {}

// intended
__device__ __forceinline__
void test2() {}
```

Can we make it also consider the macros added in `AttributeMacros`? Thanks in advance.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE1vwjgQ_TXmMmoUHEKaQw6hCKnS7m33jCb2QLw4dmRPYPn3KwdKabeqFAnszMd7b14GYzRHR9SIciPK7QIn7n1o_vDKEDMuOq-vzbuQ1QBqCoEc2ytcfDgZdwTvAOHt720LY_D_kGIh3wCdhgs6BmXRHV8OPgzIwB66QHgCPDCFOekljqTMwShA5mC6iSmCNScCsc73e01no2i_F-s8lZ3vjtZ3aB93xCqD95ROw8ikgXuCg7fWXxI85d3BHKeAbLxL8d3EYBi0p-iErBgi0ZCgJUKAEejfkRSTFkUr8vlZ57fnioNNZ1mAcZA9cxN5u0nU2sSsfVARRQutveA1irx9XP-JKvj5nSg3TyTlG-z3vY_88f9BdT7FHgPpj5PyLjK6R-zBB0XGWeNSqXL7DPzG452Bp-Ai-ImBe_w2He_sFXAc7TXp_CObdZ6ESm01Bg1qHJ_HJuRr6pU8tMmyLGEot_OU6g_hnZ9dMMwCgDUxDcy41PC7Ous8-ya_GsdZ_Z2Quycj3uCnQsprShEzggGvHe0nN0XSdyh5e_ZGA1PkhFXWIKqNqLa3Pp-D-K4mPNLkD3l3QMYxOU3610rPEP5f6-u43tDBhWDAEyXDoo0-uTkaTWE2-V1F1PoXEUWxg796dKeYQlCf0SnKFropdF3UuKBmWRWyXOW1rBd9g1oXlURdUFWUlSzrWla4XlavK_laHVS5MI3M5Wq5lOWykDKvsxRBZSHrV6wQl6VY5TSgsZm15yHz4bgwMU7ULJdVWcqFxY5snDeNlF--ICnT7glNynvppmMUqzw5JH5WYsN23lJfEsvtb4aNvZ-s_lTuR5UWU7BNzzymr_I20KPhfuoy5QchdwnB_eflseZ2M7Eo5O7O7dzI_wIAAP__eXW0mA">