This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] `readability-implicit-bool-conversion.AllowIntegerConditions` ignores `DoStmt`s
ClosedPublic

Authored by fwolff on Aug 8 2023, 12:30 PM.

Details

Summary

Fixes a simple oversight which currently causes the AllowIntegerConditions option of the readability-implicit-bool-conversion check to not apply to do-while loop conditions, for no apparent reason.

Diff Detail

Event Timeline

fwolff created this revision.Aug 8 2023, 12:30 PM
Herald added a project: Restricted Project. · View Herald Transcript
fwolff requested review of this revision.Aug 8 2023, 12:30 PM

Missing release notes, except that looks fine.
What about switchStmt ?

fwolff updated this revision to Diff 548334.Aug 8 2023, 1:31 PM

Mention this change in the release notes

PiotrZSL added inline comments.Aug 8 2023, 1:33 PM
clang-tools-extra/docs/ReleaseNotes.rst
199–202 ↗(On Diff #548334)
fwolff updated this revision to Diff 548342.Aug 8 2023, 1:49 PM
fwolff marked an inline comment as done.Aug 8 2023, 1:51 PM

Thanks for reviewing this @PiotrZSL!

What about switchStmt ?

The AllowIntegerConditions and AllowPointerConditions options only apply to int -> bool conversions, whereas switch statements have integral conditions.

PiotrZSL accepted this revision.Aug 8 2023, 1:54 PM

LGTM

This revision is now accepted and ready to land.Aug 8 2023, 1:54 PM
This revision was landed with ongoing or failed builds.Aug 8 2023, 2:23 PM
This revision was automatically updated to reflect the committed changes.