This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't format already formatted integer literals
ClosedPublic

Authored by owenpan on Mar 21 2023, 12:20 AM.

Details

Summary

Fixes a bug in IntegerLiteralSeparatorFixer::checkSeparator() so that only unformatted integer literals will be formatted.

Diff Detail

Event Timeline

owenpan created this revision.Mar 21 2023, 12:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 12:20 AM
owenpan requested review of this revision.Mar 21 2023, 12:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 12:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Do we have any unit tests for this that we can pump a shed load of examples at?

MyDeveloperDay accepted this revision.Mar 21 2023, 3:11 AM
This revision is now accepted and ready to land.Mar 21 2023, 3:11 AM

Do we have any unit tests for this that we can pump a shed load of examples at?

I would need to make checkSeparator() public to add unit tests for it. Even then, the tests would be redundant to the added assertion (assert(Formatted != Text); on line 146), which would have caught the bug.

owenpan updated this revision to Diff 507622.Mar 22 2023, 11:19 PM

Simplifies the fix.

owenpan accepted this revision.Mar 26 2023, 1:22 PM

This patch is effectively NFC.

This revision was landed with ongoing or failed builds.Mar 26 2023, 1:25 PM
This revision was automatically updated to reflect the committed changes.