This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix break being added to macro define with ColumnLimit: 0
ClosedPublic

Authored by futuarmo on Jan 8 2022, 5:31 AM.

Diff Detail

Event Timeline

futuarmo requested review of this revision.Jan 8 2022, 5:31 AM
futuarmo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2022, 5:31 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
futuarmo edited the summary of this revision. (Show Details)Jan 8 2022, 5:31 AM
MyDeveloperDay added a project: Restricted Project.
MyDeveloperDay added inline comments.
clang/unittests/Format/FormatTest.cpp
4811

Can you fix this first

MyDeveloperDay requested changes to this revision.Jan 10 2022, 12:20 AM
This revision now requires changes to proceed.Jan 10 2022, 12:20 AM
curdeius added inline comments.Jan 10 2022, 12:33 AM
clang/unittests/Format/FormatTest.cpp
4810–4811

Please test with something simpler.

futuarmo updated this revision to Diff 398695.Jan 10 2022, 10:42 AM
futuarmo edited the summary of this revision. (Show Details)
clang/unittests/Format/FormatTest.cpp
4810–4811

Did this show the bugged behavior without the patch?

Regarding the // clang-format off there is the question what do we want in the tests? Show the long lines as the long lines, then we need to turn it off some times. Or do we want to keep the limit and break the strings, thus making it harder to read for the human?

curdeius added inline comments.Jan 10 2022, 12:55 PM
clang/unittests/Format/FormatTest.cpp
4810–4811

Did this show the bugged behavior without the patch?

Yes. I checked with a pretty fresh master.

Regarding the // clang-format off there is the question what do we want in the tests? Show the long lines as the long lines, then we need to turn it off some times. Or do we want to keep the limit and break the strings, thus making it harder to read for the human?

I'm pretty much against adding // clang-format off too, it hurts more than it helps IMO.

futuarmo updated this revision to Diff 399394.Jan 12 2022, 11:27 AM

If the pre merge checks pass.

Yes. Looks like I understood wrong how pre-merge clang-format check works, thanks everyone for help

futuarmo edited the summary of this revision. (Show Details)Jan 12 2022, 12:36 PM
curdeius retitled this revision from Fix for: clang-format: break added to macro define with ColumnLimit: 0 to [clang-format] Fix break being added to macro define with ColumnLimit: 0.Jan 12 2022, 12:37 PM
curdeius edited the summary of this revision. (Show Details)
curdeius edited the summary of this revision. (Show Details)
curdeius accepted this revision.Jan 12 2022, 12:43 PM

LGTM. Thanks for working on this!
But before landing, please retest the original misformatted code from the bug report with a freshly built clang-format.

Also, do you have commit rights? If not, do you want someone to land it on your behalf? If so, please send your name and email address to be used for the contribution.

I will build fresh main branch tomorrow (it tooks 1+ hour) and will comment here about test results
I don't have commit rights, so it will be great if someone commit it with user "Armen Khachkinaev" and email "armen114@yandex.ru"
Thanks

@MyDeveloperDay, do you have any more objections?

MyDeveloperDay accepted this revision.Jan 13 2022, 10:15 AM

Assuming all other tests pass, I'm ok

This revision is now accepted and ready to land.Jan 13 2022, 10:15 AM
futuarmo added a comment.EditedJan 13 2022, 12:31 PM

@curdeius, all format tests pass on freshly built version

owenpan accepted this revision.Jan 13 2022, 4:28 PM
owenpan added inline comments.
clang/unittests/Format/FormatTest.cpp
4810

Please remove the newline and re-run FormatTests.

4810–4811

Regarding the // clang-format off there is the question what do we want in the tests? Show the long lines as the long lines, then we need to turn it off some times. Or do we want to keep the limit and break the strings, thus making it harder to read for the human?

I prefer the latter.

futuarmo added inline comments.Jan 13 2022, 11:40 PM
clang/unittests/Format/FormatTest.cpp
4810

FormatTests pass again

curdeius added inline comments.Jan 13 2022, 11:42 PM
clang/unittests/Format/FormatTest.cpp
4810

Done when landing.

curdeius added inline comments.Jan 13 2022, 11:44 PM
clang/unittests/Format/FormatTest.cpp
19610

Oops. Fixed post-commit.