This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Add test for AlignAfterOpenBracket = AlwaysBreak in C++.
ClosedPublic

Authored by jeanphilippeD on Nov 29 2015, 5:22 PM.

Details

Reviewers
djasper
Summary

Revision 251405 added AlwaysBreak to support Google's JavaScript style.
This changeset complete existing AlignsAfterOpenBracket tests to exercise AlwaysBreak for C++.

I thought this would be worthwhile.
With this option we can support request from http://lists.llvm.org/pipermail/cfe-dev/2015-May/042942.html, that had been requested a few times.
This also partially solve related Bug 23422 and is probably sufficient for most people.

AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
BinPackArguments = false;
BinPackParameters = false;

With these setting we obtain this formatting:

void fooWithAVeryLongParamList(
    int firstParameter,
    int secondParameter
    int lastParameter)
{
    object.alsoThisDoenstFitSoIBreakImmidiatly(
        firstParameter,
        secondParameter,
        lastParameter);
}

Diff Detail

Event Timeline

jeanphilippeD retitled this revision from to [clang-format] Add test for AlignAfterOpenBracket = AlwaysBreak in C++..
jeanphilippeD updated this object.
jeanphilippeD added a subscriber: cfe-commits.

Hi Daniel,
Realized that I should have added you when I submitted it.
Not sure if this review slipped through, or you were too busy, or if this change is not desired since the code was added to support JS.
Kind Regards,
Jean-Philippe.

djasper accepted this revision.Dec 6 2015, 9:08 AM
djasper edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Dec 6 2015, 9:08 AM

Thanks a lot, I do not have commit access.
I'm happy for you to commit it when you have time.

djasper closed this revision.Dec 14 2015, 12:46 AM

Submitted in r255486. Thank you.