This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add isa/dyn_cast support for dialect interfaces
ClosedPublic

Authored by rriddle on Jan 21 2022, 12:38 AM.

Details

Summary

This matches the same API usage as attributes/ops/types. For example:

c++
Dialect *dialect = ...;

// Instead of this:
if (auto *interface = dialect->getRegisteredInterface<DialectInlinerInterface>())

// You can do this:
if (auto *interface = dyn_cast<DialectInlinerInterface>(dialect))

Diff Detail

Event Timeline

rriddle created this revision.Jan 21 2022, 12:38 AM
rriddle requested review of this revision.Jan 21 2022, 12:38 AM
mehdi_amini accepted this revision.Jan 21 2022, 12:39 AM

Thanks! I lost so much time debugging this :)

This revision is now accepted and ready to land.Jan 21 2022, 12:39 AM
This revision was automatically updated to reflect the committed changes.