Want to format my code in this way:
class Foo : public Parent1, protected Parent2
{
};
However clang-format
always breaks inheritance list for multiple inheritance like this:
class Foo
: public Parent1
, protected Parent2
{
};
which is not beautiful and not onvenient. Is there a way to fix this - seems no option for this in Clang-Format Style Options?
The style option you're looking for is BreakInheritanceList
. See the documentation for details.
When this style option is set to BeforeComma
, you get the formatting you show above. You might not be setting it explicitly - if your settings are based on the Mozilla
style then this style option is set to BeforeComma
.
The default is normally BeforeColon
, which would probably satisfy you. You could also try AfterColon
to see if you like it any better.
A good place to experiment with these style options is the configurator.