Closed
Description
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