There a some external libraries that use a unique coding style. One example would be Qt's signal/slot-connect syntax.
connect(sender.data(), &Sender::valueChanged,
receiver, &Receiver::updateValue);
clang-format using a slightly modified llvm formatting reorders this statement to
connect(sender.dataa(), &Sender::valueChanged, receiver, &Receiver::updateValue);
or
connect(sender.dataa(),
&Sender::valueChanged,
receiver,
&Receiver::updateValue);
if it exceeds the 80-character limit.
Is there a possibility to create custom rules for special commands like this, so that it gets formatted as in the first example?
I don't know of a way to create custom rules, but a workaround could be to tell clang-format to skip the relevant sections with // clang-format off and // clang-format on.
(See How to make clang-format skip sections of c++ code)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With