Summary:
The purpose of this is to aid in having code behave differently on
Operations based on their Dialect without caring about the specific
Op. Additionally this is consistent with most other types supporting
isa<> and dyn_cast<>.
A Dialect matches isa<> based only on its namespace and relies on each
namespace being unique.
Differential Revision: https://reviews.llvm.org/D79088
} // namespace mlir
+namespace llvm {
+/// Provide isa functionality for Dialects.
+template <typename T>
+struct isa_impl<T, ::mlir::Dialect> {
+ static inline bool doit(const ::mlir::Dialect &dialect) {
+ return T::getDialectNamespace() == dialect.getNamespace();
+ }
+};
+} // namespace llvm
+
#endif