This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't eat two semicolons after namespace
ClosedPublic

Authored by HazardyKnusperkeks on Nov 19 2022, 8:23 PM.

Details

Summary

Remove the double check, move the comment.

This changes behavior, but I think for the better. Despite the comment my personal opinion would be to not even gracefully handle the one semicolon, it shouldn't be there.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 8:23 PM
HazardyKnusperkeks requested review of this revision.Nov 19 2022, 8:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 8:23 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay accepted this revision.Dec 12 2022, 6:50 AM

Feels like this would only show if someone did

namespace A {
};;

Which seems odd

This revision is now accepted and ready to land.Dec 12 2022, 6:50 AM
MyDeveloperDay added inline comments.Dec 12 2022, 6:50 AM
clang/lib/Format/UnwrappedLineParser.cpp
2977

This comment was wrong I guess, because of /*MunchSemi=*/true

NOTE: Clang-Format Team Automated Review Comment

It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an NFC or refactoring, adding documentation etc..)

Add your unit tests in clang/unittests/Format and you can build with ninja FormatTests. We recommend using the verifyFormat(xxx) format of unit tests rather than EXPECT_EQ as this will ensure you change is tolerant to random whitespace changes (see FormatTest.cpp as an example)

For situations where your change is altering the TokenAnnotator.cpp which can happen if you are trying to improve the annotation phase to ensure we are correctly identifying the type of a token, please add a token annotator test in TokenAnnotatorTest.cpp

This revision was landed with ongoing or failed builds.Jul 12 2023, 3:23 AM
This revision was automatically updated to reflect the committed changes.
HazardyKnusperkeks marked an inline comment as done.