This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Add penalty for breaking after '('
ClosedPublic

Authored by GPery on Dec 22 2021, 8:16 AM.

Details

Summary

My team has a vendetta against lines ending with an open parenthesis, thought it might be useful for others too 😊

Diff Detail

Event Timeline

GPery requested review of this revision.Dec 22 2021, 8:16 AM
GPery created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2021, 8:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
GPery edited the summary of this revision. (Show Details)Dec 22 2021, 8:19 AM
MyDeveloperDay added a project: Restricted Project.

You need some unit tests to show it working.

And initialize the value.

GPery updated this revision to Diff 396317.Dec 27 2021, 8:50 AM
GPery edited the summary of this revision. (Show Details)

Add a unit test and initialisation in LLVMStyle

MyDeveloperDay added inline comments.Dec 28 2021, 7:22 AM
clang/unittests/Format/FormatTest.cpp
18527
  1. fix the formatting
  2. add a default case which shows how the bracket will be without setting it to 100
  3. show other uses of '(' like casts, declarations etc..
clang/include/clang/Format/Format.h
2904

Please resort.

clang/lib/Format/Format.cpp
1239

O before T, please resort.

GPery updated this revision to Diff 396527.Dec 29 2021, 6:49 AM

Resorted everything and added more tests, thanks for the comments <3

MyDeveloperDay added inline comments.Dec 29 2021, 6:59 AM
clang/unittests/Format/FormatTest.cpp
18531

any reason you are not using verifyFormat here?

Looks good, use the verifyFormat and please mark comments as done.

GPery updated this revision to Diff 396547.Dec 29 2021, 10:00 AM
GPery marked 4 inline comments as done.

Now using verifyFormat!

Fixed and marked :D

This revision is now accepted and ready to land.Dec 29 2021, 10:55 AM

@GPery, do you need help landing this?
If so, please indicate the name and email you'd like to be used for the commit.

GPery added a comment.Jan 3 2022, 5:01 AM

@GPery, do you need help landing this?
If so, please indicate the name and email you'd like to be used for the commit.

Oh, sure, I didn't realise this part wasn't automatic.
It's "gpery" and gpery@pm.me, thanks!

This revision was landed with ongoing or failed builds.Jan 3 2022, 12:06 PM
This revision was automatically updated to reflect the committed changes.