This is an archive of the discontinued LLVM Phabricator instance.

clang-format: Introduce BreakInheritanceList option
ClosedPublic

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

Details

Summary

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 https://reviews.llvm.org/D32479.

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 https://reviews.llvm.org/D32525 are submitted, then we also need more tests for the combination of the two parameters.

include/clang/Format/Format.h
897

Update the docs with docs/tools/dump_format_style.py.

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 https://reviews.llvm.org/D32525

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

Address review comments of https://reviews.llvm.org/D32525

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.

@Typz,

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.

Thanks