Type getType() const;
/// Get the dialect of this attribute.
- const Dialect &getDialect() const {
+ Dialect &getDialect() const {
assert(dialect && "Malformed attribute storage object.");
- return *dialect;
+ return const_cast<Dialect &>(*dialect);
}
protected:
// Set the dialect for this storage instance. This is used by the
// AttributeUniquer when initializing a newly constructed storage object.
- void initializeDialect(const Dialect &newDialect) { dialect = &newDialect; }
+ void initializeDialect(Dialect &newDialect) { dialect = &newDialect; }
private:
/// The dialect for this attribute.
- const Dialect *dialect;
+ Dialect *dialect;
/// This field is a pair of:
/// - The type of the attribute value.
MLIRContext *getContext() const;
/// Get the dialect this attribute is registered to.
- const Dialect &getDialect() const;
+ Dialect &getDialect() const;
/// Return true if this field is, or contains, a function attribute.
bool isOrContainsFunction() const;
public:
/// Get the dialect that this type is registered to.
- const Dialect &getDialect() const {
+ Dialect &getDialect() {
assert(dialect && "Malformed type storage object.");
return *dialect;
}
private:
// Set the dialect for this storage instance. This is used by the TypeUniquer
// when initializing a newly constructed type storage object.
- void initializeDialect(const Dialect &newDialect) { dialect = &newDialect; }
+ void initializeDialect(Dialect &newDialect) { dialect = &newDialect; }
/// The dialect for this type.
- const Dialect *dialect;
+ Dialect *dialect;
/// Space for subclasses to store data.
unsigned subclassData;
private:
/// Get the dialect that the type 'T' was registered with.
- template <typename T>
- static const Dialect &lookupDialectForType(MLIRContext *ctx) {
+ template <typename T> static Dialect &lookupDialectForType(MLIRContext *ctx) {
return lookupDialectForType(ctx, T::getClassID());
}
/// Get the dialect that registered the type with the provided typeid.
- static const Dialect &lookupDialectForType(MLIRContext *ctx,
- const ClassID *const typeID);
+ static Dialect &lookupDialectForType(MLIRContext *ctx,
+ const ClassID *const typeID);
};
} // namespace detail
MLIRContext *getContext();
/// Get the dialect this type is registered to.
- const Dialect &getDialect();
+ Dialect &getDialect();
// Convenience predicates. This is only for floating point types,
// derived types should use isa/dyn_cast.
MLIRContext *Attribute::getContext() const { return getType().getContext(); }
/// Get the dialect this attribute is registered to.
-const Dialect &Attribute::getDialect() const { return impl->getDialect(); }
+Dialect &Attribute::getDialect() const { return impl->getDialect(); }
bool Attribute::isOrContainsFunction() const {
return impl->isOrContainsFunctionCache();
StorageUniquer &MLIRContext::getTypeUniquer() { return getImpl().typeUniquer; }
/// Get the dialect that registered the type with the provided typeid.
-const Dialect &TypeUniquer::lookupDialectForType(MLIRContext *ctx,
- const ClassID *const typeID) {
+Dialect &TypeUniquer::lookupDialectForType(MLIRContext *ctx,
+ const ClassID *const typeID) {
return lookupDialectForSymbol(ctx, typeID);
}
unsigned Type::getKind() const { return impl->getKind(); }
/// Get the dialect this type is registered to.
-const Dialect &Type::getDialect() { return impl->getDialect(); }
+Dialect &Type::getDialect() { return impl->getDialect(); }
MLIRContext *Type::getContext() { return getDialect().getContext(); }