Page MenuHomePhabricator

[clang-format] Do not indent C# array initialisers as continuations
ClosedPublic

Authored by jbcoe on Mar 6 2020, 9:57 AM.

Details

Summary

Flag '= {' as a braced init list when parsing C# code.

Diff Detail

Event Timeline

jbcoe created this revision.Mar 6 2020, 9:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2020, 9:57 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krasimir requested changes to this revision.Mar 9 2020, 10:17 AM
krasimir added inline comments.
clang/lib/Format/UnwrappedLineParser.cpp
1467

A more general approach might be to adapt parseBracedList() itself to mark the block kind BK_BracedInit:
https://github.com/llvm/llvm-project/blob/7d2fdd3f6639731284dd8b6b274f01f04fd19215/clang/lib/Format/UnwrappedLineParser.cpp#L1628

Could you try to see if it will be easy/possible to get the same effect by adapting that?
If that's hard or has unintended side effects, we can reconsider.

This revision now requires changes to proceed.Mar 9 2020, 10:17 AM
jbcoe marked an inline comment as done.Mar 13 2020, 7:57 AM
jbcoe added inline comments.
clang/lib/Format/UnwrappedLineParser.cpp
1467

Setting block kind inside parseBracedList() caused test failures outside of C# tests.

I was hoping to make this surgical for now, hence the comment.

krasimir accepted this revision.Mar 23 2020, 7:12 AM

This is OK with the comment in the code. Thank you!

This revision is now accepted and ready to land.Mar 23 2020, 7:12 AM
jbcoe updated this revision to Diff 252028.Mar 23 2020, 7:22 AM

Rebase and update patch.

This revision was automatically updated to reflect the committed changes.