Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/include/mlir/IR/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class AttributeInterface
Attribute, AttributeTrait::TraitBase>;
using InterfaceBase::InterfaceBase;

private:
protected:
/// Returns the impl interface instance for the given type.
static typename InterfaceBase::Concept *getInterfaceFor(Attribute attr) {
#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/IR/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class TypeInterface : public detail::Interface<ConcreteType, Type, Traits, Type,
detail::Interface<ConcreteType, Type, Traits, Type, TypeTrait::TraitBase>;
using InterfaceBase::InterfaceBase;

private:
protected:
/// Returns the impl interface instance for the given type.
static typename InterfaceBase::Concept *getInterfaceFor(Type type) {
#ifndef NDEBUG
Expand Down
26 changes: 26 additions & 0 deletions mlir/test/lib/Dialect/Test/TestInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,30 @@ def TestOptionallyImplementedOpInterface
}];
}

def TestOptionallyImplementedAttrInterface
: AttrInterface<"TestOptionallyImplementedAttrInterface"> {
let cppNamespace = "::mlir";

let methods = [
InterfaceMethod<"", "bool", "getImplementsInterface", (ins)>,
];

let extraClassOf = [{
return $_attr.getImplementsInterface();
}];
}

def TestOptionallyImplementedTypeInterface
: TypeInterface<"TestOptionallyImplementedTypeInterface"> {
let cppNamespace = "::mlir";

let methods = [
InterfaceMethod<"", "bool", "getImplementsInterface", (ins)>,
];

let extraClassOf = [{
return $_type.getImplementsInterface();
}];
}

#endif // MLIR_TEST_DIALECT_TEST_INTERFACES