This is an archive of the discontinued LLVM Phabricator instance.

Make `mlir::OpState::operator bool` explicit
ClosedPublic

Authored by tkoeppe on May 6 2021, 5:49 AM.

Details

Summary

This change makes the conversion of an mlir::OpState to bool explicit. Idiomatic boolean uses continue to work as before, but questionable implicit uses (e.g. accumulating over a range of OpStates to count "true" states) become ill-formed. This makes the class interface a lilttle less error-prone.

I tested this change on our internal (fairly large) codebase, and only one fix was needed, which was ultimately an improvement of the affected code.

Diff Detail

Event Timeline

tkoeppe created this revision.May 6 2021, 5:49 AM
tkoeppe requested review of this revision.May 6 2021, 5:49 AM
mehdi_amini accepted this revision.May 6 2021, 8:42 AM
This revision is now accepted and ready to land.May 6 2021, 8:42 AM
rriddle accepted this revision.May 7 2021, 6:13 PM

I should say that I don't have commit access, so I would welcome any help with committing. Thank you!

This revision was automatically updated to reflect the committed changes.