This is an archive of the discontinued LLVM Phabricator instance.

Fix extraneous whitespace addition in line comments on clang-format directives
ClosedPublic

Authored by penagos on Feb 19 2022, 10:40 AM.

Diff Detail

Event Timeline

penagos requested review of this revision.Feb 19 2022, 10:40 AM
penagos created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 19 2022, 10:40 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
penagos edited the summary of this revision. (Show Details)Feb 19 2022, 10:44 AM
penagos added reviewers: Restricted Project, HazardyKnusperkeks, MyDeveloperDay, curdeius, krasimir, klimek.
clang/lib/Format/BreakableToken.cpp
817–825

This slowly gets hard to read. Could you maybe split it up? Either in giving the multiple parts their own name. Or to keep the short circuiting have something like:

auto AllowsSpaceChange = ...;
AllowsSpaceChange = AllowsSpaceChange || ...;
AllowsSpaceChange = AllowsSpaceChange || ...;
clang/unittests/Format/FormatTestComments.cpp
98

Why the limit?

HazardyKnusperkeks removed a reviewer: Restricted Project.Feb 19 2022, 12:57 PM
HazardyKnusperkeks added a project: Restricted Project.

Thanks for working on it.

curdeius added inline comments.Feb 19 2022, 2:59 PM
clang/lib/Format/BreakableToken.cpp
817–818

While here, please change auto to bool.

817–825

Or use a lambda (with a series of ifs for instance) to initialize it.

curdeius edited the summary of this revision. (Show Details)Feb 19 2022, 2:59 PM
penagos updated this revision to Diff 410115.Feb 19 2022, 4:22 PM
  • Split AllowsSpaceChange conditional over multiple variables to enhance readability.
  • Remove unnecessary column limit from unittest.
penagos marked 3 inline comments as done.Feb 19 2022, 4:24 PM
penagos added inline comments.
clang/lib/Format/BreakableToken.cpp
817–825

I've split the conditional over a couple of smaller boolean conditionals with the intent of enhancing readability.

clang/unittests/Format/FormatTestComments.cpp
98

This was a copy-paste artifact and wasn't intended to be included in the original diff; the column limit has no bearing on this specific test addition.

penagos marked an inline comment as done.Feb 19 2022, 4:25 PM

Thanks for working on it.

Happy to help!

curdeius accepted this revision.Feb 20 2022, 2:04 AM

Great! Thanks a lot!
Do you have commit rights or you want someone to land it for you?
For the latter, we'll need your name and email for the commit attribution.

This revision is now accepted and ready to land.Feb 20 2022, 2:04 AM

I don’t have commit rights; if someone could commit on my behalf that’d be great.

  • Luis Penagos
  • luis@penagos.co

Thanks!