Page MenuHomePhabricator

clang-format: Introduce BreakInheritanceList option

Authored by Typz on Feb 7 2018, 4:48 AM.



This option replaces the BreakBeforeInheritanceComma option with an
enum, thus introducing a mode where the colon stays on the same line as
constructor declaration:

// When it fits on line:
class A : public B, public C {

// When it does not fit:
class A :
    public B,
    public C {

This matches the behavior of the BreakConstructorInitializers option,
introduced in

Diff Detail

Event Timeline

Typz created this revision.Feb 7 2018, 4:48 AM
Typz updated this revision to Diff 133204.Feb 7 2018, 5:35 AM

Fix indentation of inheritance list, which is actually based on ConstructorInitializerIndentWidth.

Maybe a new option (InheritanceListIndentWidth) should be used instead?

If both this and are submitted, then we also need more tests for the combination of the two parameters.


Update the docs with docs/tools/

Typz updated this revision to Diff 136300.Feb 28 2018, 8:51 AM
Typz marked an inline comment as done.

Address review comments, and rebase on

Typz updated this revision to Diff 136306.Feb 28 2018, 9:11 AM

Address review comments of

Typz updated this revision to Diff 147011.May 16 2018, 1:55 AM

Rebase on latest master

djasper accepted this revision.Jun 11 2018, 2:21 AM

Looks good. Sorry for the delay.

This revision is now accepted and ready to land.Jun 11 2018, 2:21 AM
This revision was automatically updated to reflect the committed changes.


It seems that the changes done to ClangFormatStyleOptions.rst @334408 are causing the generation of the documentation to fail, with the following error:

Warning, treated as error:
/llvm/tools/clang/docs/ClangFormatStyleOptions.rst:1060: WARNING: Definition list ends without a blank line; unexpected unindent.

by reverting to change @332436 the build is fine and no errors are generated.