<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95418>95418</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Format struct/class-like macros to preserve semicolon at the end
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alexolut
</td>
</tr>
</table>
<pre>
I have macro like this
```
#define STRUCT(TYPE) struct TYPE : public Base
```
that is used as the following:
```
STRUCT(MyName) {
// a lot of members (functions, data)
};
```
I would like to leave the code above as-is after clang-formating.
In particular I have following options in my .clang-format file:
```
BraceWrapping:
AfterControlStatement: Never
# ...
RemoveSemicolon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
# ...
```
The only way I found to preserve semicolon here is to add macro `STRUCT` to the list of `IfMacros` and disable space for them:
```
IfMacros:
- STRUCT
SpaceBeforeParensOptions:
AfterIfMacros: false
```
But to be fair STRUCT is not an IfMacro. It's more likely `TypenameMacros`, but unfortunately I didn't find how to achieve that with `TypenameMacros`. What am I missing? I use LLVM 18.1.7
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2P4zYM_TXKhYghy5nEOfiQzDSAgZ3tYiftokfaomO1smToI2n-fSHHm50tZqYFAgcGab73yEei9-pkiCr2sGcPTwuMobeu2mn62-oYFo2V16qGHs8EA7bOglZ_EYReeWD8ifHd_Fzz-Xd7FYWkThmCl-PX3x6PTJTHP778wsQWfHCxDZBegRU7GGOjVQt79PRmqdBjAOUhepKAHkJP0Fmt7UWZEyt2H7C4Yz9fP-NACZ1t9rcYAAATByYOgKBtANvBQENDzgMTZRdNG5Q1nolHkBiQie2MsXlixf5NvBouNmo5t8iCptS2RLi1kgAbeyZAv1QesAvkoNVoTsvOugGDMqfstZbawIguqDZqdDCP4C4c7DjRA2VguEL2uhJ0StPHndk7bOmbw3F83USAXaL1aE1wVr8EDDSQCWlKn-lM7j5byLKZ61ca7JleaFCt1dak1ODiPMmXEVvaU2cdfUFHxqfwY_TBDu8k_HpT9V-M_M84PzH6txOn57EnsEZf4YJXqKGz0cg0odGRJ3cm8N8VQE-Okt-CBZRyNj1b89lMa54iaaZa-ck1bM3r7jml-RRFI0Eqj40m8EkfdNalD4aPR3Kv8UP78vv2_M9mTb16VQcAOtTv7NVshBiSnoagQ-VmvCTf2ABoYK6WQR2Y2HgYrKPJ3_qahB-vIxkc6C4_rUsTA0TTWReiwZAya5BKGiY2yZtGQm8vU3_bXtG0IRjgokL_ZskMvqU4DlDDoLyfHHuAOl0E-PTp92fIyyzPNjdBC1kVcltscUFVvslLseX5erXoKxKbQmLb5htRrjgXZV4g8qJZI8qyfCgWqhJcrPg6L_LVaitWGefrhrfI5UPJSaJkK04DKp1pfR4y604L5X2kavuwysuFxoa0n-6oEIYuMAWZEOmsuip9s2ziybMVT87xP6oEFTRVh9vu3s4jE4dWo_fL6ZRMHvTv-BXD5EYychGdrvoQxskS0207qdDHJmvtwMQhAc5_y9HZP2nCmWh6Jg43GedK_BMAAP__FdDfKQ">