This is an archive of the discontinued LLVM Phabricator instance.

[mlir] NFC: make Dialect::getRegisteredInterface const
AbandonedPublic

Authored by math-fehr on Jun 24 2021, 8:23 AM.

Details

Summary

Make Dialect::getRegisteredInterface const. This is just an API change.

Diff Detail

Event Timeline

math-fehr created this revision.Jun 24 2021, 8:23 AM
math-fehr requested review of this revision.Jun 24 2021, 8:23 AM

Where are you encountering a const Dialect?

Where are you encountering a const Dialect?

I have this ExtensibleDialect class that extend Dialect (and that is used by multiple dialects). In order to cast a Dialect to an ExtensibleDialect, I retrieve an interface that is only implemented on ExtensibleDialect.
Since classof requires a const Dialect*, I cannot currently retrieve the interface in this function.

Where are you encountering a const Dialect?

I have this ExtensibleDialect class that extend Dialect (and that is used by multiple dialects). In order to cast a Dialect to an ExtensibleDialect, I retrieve an interface that is only implemented on ExtensibleDialect.
Since classof requires a const Dialect*, I cannot currently retrieve the interface in this function.

I would cast away the const wherever you are encountering it (if it is required there). Technically Dialect shouldn't have any const API(https://mlir.llvm.org/docs/Rationale/UsageOfConst/), but it looks like that is being broken in a few places.

math-fehr abandoned this revision.Jun 24 2021, 10:57 AM

Where are you encountering a const Dialect?

I have this ExtensibleDialect class that extend Dialect (and that is used by multiple dialects). In order to cast a Dialect to an ExtensibleDialect, I retrieve an interface that is only implemented on ExtensibleDialect.
Since classof requires a const Dialect*, I cannot currently retrieve the interface in this function.

I would cast away the const wherever you are encountering it (if it is required there). Technically Dialect shouldn't have any const API(https://mlir.llvm.org/docs/Rationale/UsageOfConst/), but it looks like that is being broken in a few places.

Okay, thanks for the link!
I'm removing this patch then.