This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Handle C# 9 `init` accessor specifier.
ClosedPublic

Authored by curdeius on Mar 7 2022, 9:33 AM.

Details

Summary

Before, the code:

int Value { get; } = 0;
int Value { init; } = 0;

was formatted incoherently:

int Value { get; } = 0;
int Value { init; }
= 0;

because init was not recognised as an accessor specifier.

Diff Detail

Event Timeline

curdeius created this revision.Mar 7 2022, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 9:33 AM
curdeius requested review of this revision.Mar 7 2022, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 9:33 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
curdeius updated this revision to Diff 413539.Mar 7 2022, 10:04 AM

Handle init in same places as get and set.

curdeius added inline comments.Mar 7 2022, 11:55 AM
clang/lib/Format/TokenAnnotator.cpp
4244

Oops, unrelated change, will revert.

This revision is now accepted and ready to land.Mar 7 2022, 12:25 PM
This revision was automatically updated to reflect the committed changes.