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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] QualifierOrder and QualifierAlignment don't treat additional attributes well
        </td>
    </tr>

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

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

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

<pre>
    I'm guessing this is going to be the case for any kind of extra attribute, hence the title, but we're witnessing this in function declarations annotated with a `dllexport` macro; with `QualifierAlignment = Left` or with

```
QualifierAlignment: Custom
QualifierOrder:
  - const
  - type
```

```
#include <string>

#define app_dll __declspec( dllexport )

app_dll const std::string& Foo();
```

gets turned into

```
#include <string>

#define app_dll __declspec( dllexport )

const app_dll std::string& Foo();
```

Whereas it would arguably make more sense to leave that as-is because `__declspec` isn't part of the return type which is what it, in my opinion, looks like because of `const app_dll std::string&`.

I'd propose that `QualifierOrder` gets an additional entry like `custom` which can be used to position unknown qualifiers. And perhaps even a `QualifierMacros` which can be used to tell what 'unknown' qualifiers are.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVE1v2zAM_TXOhUjg2I2THHxI2xUYsGHYacdCtmhbqyJ5ktw0_35PdtIlW7cBuywQYn3w45F8ZGXlsXyfZOs9tQN7r0xLoVOesFo7nixVjDumWnimxjoS5khPykiyDfFLcIJECE5VQ-Aku6OOTT1pBBX0eIUnOmC3dkwHFcyVJ0PNYOqgrCHJtRZOxL2HG2ODCCyjSkeCkiKVWvNLb13AnvaidjbJb6d33HwehFaNYrfTqjV7NoGS_J4-cDPKA3qUTNL7JN2d_ov0tMbjrwaSfEd3gw92_5PEJyfZ4XW6JppTDdDhxzEce37TyduXWa5MrQfJgHznkU7TJvm7K40sl9wowyT6_hGZoMfHmDDfc51kG3rNDSXZ9lLxLD4CJB9khJ3vTk6ygh6shYGold_-AXLLwVMYnEFJlAn2P4UzhXFW-vdwvnTsWICA4KYdtCTh2kFU-ghiPTHtLcjq2YD06AHN4jmSWsCzn4O2FddiwBuMXuAGy5Q3IHqgXgA6OiQ2guOYtpESdOhU3cX-OkRjKsT-QA_sj2R7ZcD8eKGtffKkFXCcHcEUzP8teIgsLoOMvS2pd7a3_oT_slEmFgP1WFthSEipYvsJTWC_O04YouOpCSA6BVBDGIMByGTMD8yPejSYJ2MPhr6dXfgF7TArenad6D3xM5upl19BfIx97H9rOjAiHZOFWE7msbvwgMrxVdQzWeZym2_FbBxBZbK6xWAx7Rzjay9Csrqn6xQgdElvjA9pp2IGMCVcJud14qGOwDcbnC67EHof65E9YLUYNUO1qJG07EHr5_NnjmJ85Rp1f1DeY-hisyqWeTHrynSdrptllTb4FZzzSuSrOpdyW2zWRZpuZlpUrH2MJ8kywwcaTWCPkGaqzNIsS4tsma6Xm2yzqGtu8rUsinVebNLtTXKT8l4ovYg4Fta1M1eOkKqh9XjUygf_41FgSreGx_RF-2IInXWlD8pYPxs9lyPy74E8AWc">