This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.
ClosedPublic

Authored by curdeius on Jan 28 2022, 7:49 AM.

Details

Summary

Fixes https://github.com/llvm/llvm-project/issues/53441.

Expected code:

/**/   //
int a; //

was before misformatted to:

/**/     //
int a; //

Because the "remaining length" (after the starting /*) of an empty block comment /**/ was computed to be 0 instead of 2.

Diff Detail

Event Timeline

curdeius requested review of this revision.Jan 28 2022, 7:49 AM
curdeius created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 7:49 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay accepted this revision.Jan 28 2022, 8:02 AM
This revision is now accepted and ready to land.Jan 28 2022, 8:02 AM
MyDeveloperDay added a project: Restricted Project.Jan 28 2022, 8:03 AM
owenpan accepted this revision.Jan 28 2022, 1:19 PM
This revision was landed with ongoing or failed builds.Jan 28 2022, 1:28 PM
This revision was automatically updated to reflect the committed changes.