1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Interface Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9namespace mlir {
10class TestExternalAttrInterface;
11namespace detail {
12struct TestExternalAttrInterfaceInterfaceTraits {
13 struct Concept {
14 /// The methods defined by the interface.
15 const ::mlir::Dialect *(*getDialectPtr)(const Concept *impl, ::mlir::Attribute );
16 int (*getSomeNumber)();
17 };
18 template<typename ConcreteAttr>
19 class Model : public Concept {
20 public:
21 using Interface = ::mlir::TestExternalAttrInterface;
22 Model() : Concept{.getDialectPtr: getDialectPtr, .getSomeNumber: getSomeNumber} {}
23
24 static inline const ::mlir::Dialect *getDialectPtr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val);
25 static inline int getSomeNumber();
26 };
27 template<typename ConcreteAttr>
28 class FallbackModel : public Concept {
29 public:
30 using Interface = ::mlir::TestExternalAttrInterface;
31 FallbackModel() : Concept{.getDialectPtr: getDialectPtr, .getSomeNumber: getSomeNumber} {}
32
33 static inline const ::mlir::Dialect *getDialectPtr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val);
34 static inline int getSomeNumber();
35 };
36 template<typename ConcreteModel, typename ConcreteAttr>
37 class ExternalModel : public FallbackModel<ConcreteModel> {
38 public:
39 using ConcreteEntity = ConcreteAttr;
40 };
41};
42template <typename ConcreteAttr>
43struct TestExternalAttrInterfaceTrait;
44
45} // namespace detail
46class TestExternalAttrInterface : public ::mlir::AttributeInterface<TestExternalAttrInterface, detail::TestExternalAttrInterfaceInterfaceTraits> {
47public:
48 using ::mlir::AttributeInterface<TestExternalAttrInterface, detail::TestExternalAttrInterfaceInterfaceTraits>::AttributeInterface;
49 template <typename ConcreteAttr>
50 struct Trait : public detail::TestExternalAttrInterfaceTrait<ConcreteAttr> {};
51
52 /// Gets the dialect pointer.
53 const ::mlir::Dialect *getDialectPtr() const;
54
55 /// Returns some number.
56 int getSomeNumber() const;
57};
58namespace detail {
59 template <typename ConcreteAttr>
60 struct TestExternalAttrInterfaceTrait : public ::mlir::AttributeInterface<TestExternalAttrInterface, detail::TestExternalAttrInterfaceInterfaceTraits>::Trait<ConcreteAttr> {
61 };
62}// namespace detail
63} // namespace mlir
64namespace mlir {
65class TestOptionallyImplementedAttrInterface;
66namespace detail {
67struct TestOptionallyImplementedAttrInterfaceInterfaceTraits {
68 struct Concept {
69 /// The methods defined by the interface.
70 bool (*getImplementsInterface)(const Concept *impl, ::mlir::Attribute );
71 };
72 template<typename ConcreteAttr>
73 class Model : public Concept {
74 public:
75 using Interface = ::mlir::TestOptionallyImplementedAttrInterface;
76 Model() : Concept{.getImplementsInterface: getImplementsInterface} {}
77
78 static inline bool getImplementsInterface(const Concept *impl, ::mlir::Attribute tablegen_opaque_val);
79 };
80 template<typename ConcreteAttr>
81 class FallbackModel : public Concept {
82 public:
83 using Interface = ::mlir::TestOptionallyImplementedAttrInterface;
84 FallbackModel() : Concept{.getImplementsInterface: getImplementsInterface} {}
85
86 static inline bool getImplementsInterface(const Concept *impl, ::mlir::Attribute tablegen_opaque_val);
87 };
88 template<typename ConcreteModel, typename ConcreteAttr>
89 class ExternalModel : public FallbackModel<ConcreteModel> {
90 public:
91 using ConcreteEntity = ConcreteAttr;
92 };
93};
94template <typename ConcreteAttr>
95struct TestOptionallyImplementedAttrInterfaceTrait;
96
97} // namespace detail
98class TestOptionallyImplementedAttrInterface : public ::mlir::AttributeInterface<TestOptionallyImplementedAttrInterface, detail::TestOptionallyImplementedAttrInterfaceInterfaceTraits> {
99public:
100 using ::mlir::AttributeInterface<TestOptionallyImplementedAttrInterface, detail::TestOptionallyImplementedAttrInterfaceInterfaceTraits>::AttributeInterface;
101 template <typename ConcreteAttr>
102 struct Trait : public detail::TestOptionallyImplementedAttrInterfaceTrait<ConcreteAttr> {};
103 bool getImplementsInterface() const;
104 static bool classof(::mlir::Attribute base) {
105 auto* interface = getInterfaceFor(attr: base);
106 if (!interface)
107 return false;
108 TestOptionallyImplementedAttrInterface odsInterfaceInstance(base, interface);
109 return odsInterfaceInstance.getImplementsInterface();
110 }
111};
112namespace detail {
113 template <typename ConcreteAttr>
114 struct TestOptionallyImplementedAttrInterfaceTrait : public ::mlir::AttributeInterface<TestOptionallyImplementedAttrInterface, detail::TestOptionallyImplementedAttrInterfaceInterfaceTraits>::Trait<ConcreteAttr> {
115 };
116}// namespace detail
117} // namespace mlir
118namespace mlir {
119template<typename ConcreteAttr>
120const ::mlir::Dialect *detail::TestExternalAttrInterfaceInterfaceTraits::Model<ConcreteAttr>::getDialectPtr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) {
121 return (::llvm::cast<ConcreteAttr>(tablegen_opaque_val)).getDialectPtr();
122}
123template<typename ConcreteAttr>
124int detail::TestExternalAttrInterfaceInterfaceTraits::Model<ConcreteAttr>::getSomeNumber() {
125 return ConcreteAttr::getSomeNumber();
126}
127template<typename ConcreteAttr>
128const ::mlir::Dialect *detail::TestExternalAttrInterfaceInterfaceTraits::FallbackModel<ConcreteAttr>::getDialectPtr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) {
129 return static_cast<const ConcreteAttr *>(impl)->getDialectPtr(tablegen_opaque_val);
130}
131template<typename ConcreteAttr>
132int detail::TestExternalAttrInterfaceInterfaceTraits::FallbackModel<ConcreteAttr>::getSomeNumber() {
133 return ConcreteAttr::getSomeNumber();
134}
135} // namespace mlir
136namespace mlir {
137template<typename ConcreteAttr>
138bool detail::TestOptionallyImplementedAttrInterfaceInterfaceTraits::Model<ConcreteAttr>::getImplementsInterface(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) {
139 return (::llvm::cast<ConcreteAttr>(tablegen_opaque_val)).getImplementsInterface();
140}
141template<typename ConcreteAttr>
142bool detail::TestOptionallyImplementedAttrInterfaceInterfaceTraits::FallbackModel<ConcreteAttr>::getImplementsInterface(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) {
143 return static_cast<const ConcreteAttr *>(impl)->getImplementsInterface(tablegen_opaque_val);
144}
145} // namespace mlir
146

source code of llvm_build/tools/mlir/test/lib/Dialect/Test/TestAttrInterfaces.h.inc