This is an archive of the discontinued LLVM Phabricator instance.

[clang][Diagnostics] Don't expand label fixit to the next line
ClosedPublic

Authored by tbaeder on Jun 9 2023, 5:19 AM.

Details

Summary
Now that we print >1 line of code snippet, we printed another line of
code for now reason, because the source range we created for the fixit
expanded to the next line, if the next token was there. Don't do that.

Diff Detail

Event Timeline

tbaeder created this revision.Jun 9 2023, 5:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 5:19 AM
tbaeder requested review of this revision.Jun 9 2023, 5:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 5:19 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

As far as the fixit goes, I guess the previous version was better, since it didn't leave an empty line behind?

aaron.ballman accepted this revision.Jun 13 2023, 7:34 AM

As far as the fixit goes, I guess the previous version was better, since it didn't leave an empty line behind?

Yes, but that's a formatting-related concern with the output, and we traditionally leave that to another tool like clang-format to address.

LGTM, but add a release note since there technically is a change in behavior with the fix-it?

This revision is now accepted and ready to land.Jun 13 2023, 7:34 AM
cjdb accepted this revision.Jun 13 2023, 11:53 AM

Thanks for fixing this, it'll hopefully cause less frustration for devs :)