This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix dropped 'else' in 398cddf6acec
ClosedPublic

Authored by jaredgrubb on Mar 17 2023, 10:34 AM.

Details

Summary

A patch (398cddf6acec) appears to have inadvertently removed an else.

Diff Detail

Event Timeline

jaredgrubb created this revision.Mar 17 2023, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2023, 10:34 AM
jaredgrubb requested review of this revision.Mar 17 2023, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2023, 10:34 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

The difference doesn't appear to affect any unit tests (which is unfortunate), but I think you didn't mean to remove this else, based both on the logic of the original commit and the format of the patched line.

Thanks, yes, I did not intend to delete the else. This only triggers with fuzzing with rather involved inputs, thus I wasn't able to create a nice enough unit test.

klimek accepted this revision.Mar 23 2023, 1:24 PM
This revision is now accepted and ready to land.Mar 23 2023, 1:24 PM

Yeh, I considered trying to craft one as courtesy but this seemed like a very far edge case and didn't seem really worth it. So glad you agree :)

Manuel, if you're happy with the change, do you mind committing it? I don't have commit access (at least I've never requested it, so I assume I can't, I've never tried)

This revision was landed with ongoing or failed builds.Apr 21 2023, 5:00 AM
This revision was automatically updated to reflect the committed changes.
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