This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't unwrap lines preceded by line comments
ClosedPublic

Authored by owenpan on Mar 14 2022, 12:22 AM.

Diff Detail

Event Timeline

owenpan created this revision.Mar 14 2022, 12:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 12:22 AM
owenpan requested review of this revision.Mar 14 2022, 12:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 12:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Mar 14 2022, 12:42 AM
curdeius accepted this revision.Mar 14 2022, 1:03 AM

LGTM.

owenpan updated this revision to Diff 415031.Mar 14 2022, 2:25 AM

Reset the Spaces of the closing brace only if it can be unwrapped.

MyDeveloperDay accepted this revision.Mar 14 2022, 3:48 AM

I'm wondering if the presence of the comment would impact the CellCount, I might go back and add some more unit tests for the "non rectangular" change I made.

So this fixes the "}" going up onto the comment line, but not the indentation right?

I'm wondering if the presence of the comment would impact the CellCount, I might go back and add some more unit tests for the "non rectangular" change I made.

So this fixes the "}" going up onto the comment line, but not the indentation right?

Right. I think we should have a specification (including when not to align the cells) and re-design the entire thing. It's not maintainable as is. I have some ideas but need to remove/change some of the existing test cases, e.g., those involving concatenated string literals. If you (and @curdeius and @HazardyKnusperkeks) agree, I can give it a shot.

Please do, to be honest I spent enough time on this and I got to the same conclusion, it needs a rethink. Please go ahead, I don't use this feature myself so I'm not likely to see all the issues.

Right. I think we should have a specification (including when not to align the cells) and re-design the entire thing. It's not maintainable as is. I have some ideas but need to remove/change some of the existing test cases, e.g., those involving concatenated string literals. If you (and @curdeius and @HazardyKnusperkeks) agree, I can give it a shot.

It will be appreciated!