Page MenuHomePhabricator

Allow Dialects to be initialized via nullptr.
ClosedPublic

Authored by fedelebron on Aug 28 2020, 12:57 PM.

Details

Summary

This allows Dialect to follow the MLIR style of nullable objects, and in fact is expected by Dialect::operator bool() const which already tests whether def == nullptr. This just wasn't a reachable situation, because the constructor was dereferencing the pointer unconditionally.

Diff Detail

Event Timeline

fedelebron created this revision.Aug 28 2020, 12:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
fedelebron requested review of this revision.Aug 28 2020, 12:57 PM

Please add justification in the description for why. Seems like this could be handled wherever Dialect is being constructed.

rriddle accepted this revision.Aug 28 2020, 1:05 PM

Ah, I see that it already has an operator bool. Please still add the justification though. It's just as important to know why a change is happening as it is to know what is changing.

This revision is now accepted and ready to land.Aug 28 2020, 1:05 PM
fedelebron edited the summary of this revision. (Show Details)Aug 28 2020, 1:51 PM

Done. Could you submit the commit please? Thanks!

This revision was automatically updated to reflect the committed changes.