This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Join spaceRequiredBefore and spaceRequiredBetween
AbandonedPublic

Authored by sstwcw on Mar 15 2022, 4:27 PM.

Details

Summary

After all these years, having the two functions now serves to confuse
people.

Diff Detail

Event Timeline

sstwcw created this revision.Mar 15 2022, 4:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 4:27 PM
sstwcw requested review of this revision.Mar 15 2022, 4:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 4:27 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sstwcw added a project: Restricted Project.Mar 15 2022, 4:27 PM

No objections here, but I need to see other patches to understand where it takes us before accepting.

HazardyKnusperkeks added inline comments.
clang/lib/Format/TokenAnnotator.cpp
3073–3473

I'd kept the name spaceRequiredBetween.

HazardyKnusperkeks edited reviewers, added: MyDeveloperDay, curdeius, owenpan, HazardyKnusperkeks; removed: Restricted Project.Mar 16 2022, 1:32 PM
sstwcw updated this revision to Diff 416025.Mar 16 2022, 4:55 PM

Use the name spaceRequiredBetween.

sstwcw marked an inline comment as done.Mar 16 2022, 4:55 PM
This revision is now accepted and ready to land.Mar 17 2022, 12:55 PM
MyDeveloperDay requested changes to this revision.Mar 18 2022, 1:43 AM

This just made a 300 lines function and a 500 line function with minimal comments into a 800 line function.. For no real benefit?

Because from what I can tell you haven't worked on small clang-format issues you won't know that I often put a breakpoint in the spaceRequiredBetween, if it calls out into that function I now know where its covered.

I think if you had fixed a miriade of issues like "I want a space between @ and {" then you would have understood why breaking the 800 lines at least in 2 can be helpful even a little.

I know its not idea, but I'm not sure that the first step I'd make is to join 2 functions to make one massive function, for me my greatest frustration is the lack of comments and the if statements that have about 8 different clauses..

A better developer than me once said "Deal with the case you want and get out"...

This revision now requires changes to proceed.Mar 18 2022, 1:43 AM

This just made a 300 lines function and a 500 line function with minimal comments into a 800 line function.. For no real benefit?

Because from what I can tell you haven't worked on small clang-format issues you won't know that I often put a breakpoint in the spaceRequiredBetween, if it calls out into that function I now know where its covered.

I think if you had fixed a miriade of issues like "I want a space between @ and {" then you would have understood why breaking the 800 lines at least in 2 can be helpful even a little.

I know its not idea, but I'm not sure that the first step I'd make is to join 2 functions to make one massive function, for me my greatest frustration is the lack of comments and the if statements that have about 8 different clauses..

A better developer than me once said "Deal with the case you want and get out"...

+1.

sstwcw abandoned this revision.Mar 18 2022, 4:41 AM

By the way, last time I used a breakpoint on spaceRequiredBefore and stepped until return.

I think you can spin it any number of ways, but bottom line its a massive truth table and I sort of feel however you change it, it will just become a different equally incomprehensible pattern.

For me I'd prefer to stick with the devil I know, unless its broken, but as there are no unit tests my assumption is its not broken.