<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94184>94184</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Struct/class declaration with export macro treated as initialization in clang-format 19
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rmarker
</td>
</tr>
</table>
<pre>
In our codebase, we use macros when exporting types for dlls.
This enables conditionally enabling exporting the type, as well as supporting different compilers (e.g. `__declspec(dllexport)` vs `__attribute__ ((dllexport))`).
In clang-format 18.1.6 this formats as expected.
E.g. using the default style:
```cpp
struct EXPORT StructName {};
class EXPORT ClassName {
public:
ClassName() {}
};
```
However, testing the latest version of clang-format 19 (f779ec7c13bdfccd29655d13a325f34c60797a76), the formatting has changed.
It appears that it is instead interpreting it as an initialization.
I.e.
```cpp
struct EXPORT StructName{};
class EXPORT ClassName{public : ClassName(){}};
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMFu4zYQ_RrqMohAUbJlHXTYJGs0l7Zo99BbMCJHFltKFDiUvenXF5TsrDfoJYBhgtS8NzPvkYPM9jQRtWL3KHbPGS5x8KENI4Z_KGSdN2_tywR-CaC9oQ6ZhHqCC8HCBCPq4BkuA01A32cfop1OEN9mYuh9AOMc50I-C_nl22AZaMLOEYP2k7HR-gmde9tOE_COYqCVJuVChgs5l1Ze5luEsX1PgaYI2o-zdRQYhDpQfspB7OXrqyHteCYt1ME4t1EL1Yi9hDNvIRhjsN0S6fU1YT9GrsFCNdcOtv-XCbTD6fTQ-zBihOKQF_keYmpvO-JUKX2fSUcyV-zXVNbCt9YM9bi4CBzfHInySp2yrT89z9sJx7DoCF__-v23P77Bn-vuVxwJRP0o6mdRPt6Xph0y34Kf0uY9dv0-L52z-j0d_IhZm29urBvlPf2tsPtsv_gLnSkkhyLxu2sO0w7OFNj6CXz_Qa4mKd3XdUO61kXZmV5ro5r9bmeKEku168tK72Xd1FjvVxeeVt4Nv6YZkEEPOJ3e5X2JgPNMGBjigBFsBMtgJ46EBuwUKcyBVrCNyR6cwE42WnT2X0wX8UaUU_5ZMz7hhagfNxNAlF8-yn_l-T_dM9OWpikbzKgt6qIuG7mvy2xopUSsdG2MqvvKFKSwJFnWB01V3_e6z2yrpKrkXpay2tW7MsdGkm40dtoUSnZKVJJGtC537jzmPpwyy7xQ21TFococduR4HQ5K3RsplErjIrQJ9tAtJxaVdJYj_yCKNrp1sPwE3D1ftRPquKmUXiqG1Qa42Dhc58A2XSAGwkgmufazZWA_PsUmW4JrhxhnTrdcHYU6nmwcli7XfhTqmEq7Lg9z8H_TWsXaMAt13Ho-t-q_AAAA__8_MpuQ">