Page MenuHomePhabricator

Clang-format: Add Whitesmiths indentation style
ClosedPublic

Authored by timwoj on Sep 16 2019, 10:49 AM.

Details

Summary

This patch adds support for the Whitesmiths indentation style to clang-format. It’s an update to a patch submitted in 2015 (D6833), but reworks it to use the newer API.

There are still some issues with this patch, primarily around switch and case support. The added unit test won’t currently pass because of the remaining issues.

Diff Detail

Repository
rL LLVM

Event Timeline

timwoj created this revision.Sep 16 2019, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 10:49 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
echristo added a subscriber: echristo.

Martin should know who should look at this... maybe Krasimir?

Martin should know who should look at this... maybe Krasimir?

Yes, I think he'd be a good person to look at this.

Thank you for this patch

This LGTM, ensure you comment out the failing unit tests and add a FIXME to the test as to why they don't currently work (or fix them if possible), the tests need to keep passing or others will not know they haven't broken things.

Normally there always would be a comment saying please state a public style guide that uses a new style, but as Whitesmiths style is mentioned on the Wikipedia page about Indentation style so I would think you were good to add it!

MyDeveloperDay accepted this revision.Sep 17 2019, 4:25 AM
This revision is now accepted and ready to land.Sep 17 2019, 4:25 AM
krasimir edited reviewers, added: djasper; removed: krasimir.Sep 17 2019, 4:48 AM

Adding @djasper as this is really a re-implementation of https://reviews.llvm.org/D6833.
Agree with @MyDeveloperDay that in general we should aim to document all the known cases where a style doesn't work (with FIXMEs etc.), but not submit failing tests. We can have tests that demonstrate the current (bad) behavior together with a FIXME comment about what is the expected good outcome instead.

timwoj updated this revision to Diff 220610.Sep 17 2019, 9:41 PM

Marked failing tests as FIXME

I don't have push access for master. Can someone merge this?

Closed by commit rL372497: Clang-format: Add Whitesmiths indentation style (authored by paulhoad, committed by ). · Explain WhySep 22 2019, 4:58 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2019, 4:58 AM