[mlir] Remove the default template parameters from AttrBase and TypeBase.

MSVC 2017 doesn't support the case where a trailing variadic template list comes after template types with default parameters. Until we upgrade to VS 2019, we can't use the simplified definitions.
This commit is contained in:
River Riddle 2020-06-30 21:50:17 -07:00
parent 83fae3f762
commit f625f5231a
8 changed files with 31 additions and 22 deletions

View File

@ -75,7 +75,8 @@ public:
/// A case selector of `CASE (n:m)` corresponds to any value from `n` to `m` and
/// is encoded as `#fir.interval, %n, %m`.
class ClosedIntervalAttr
: public mlir::Attribute::AttrBase<ClosedIntervalAttr> {
: public mlir::Attribute::AttrBase<ClosedIntervalAttr, mlir::Attribute,
mlir::AttributeStorage> {
public:
using Base::Base;
@ -91,7 +92,9 @@ public:
/// an ssa-value.
/// A case selector of `CASE (:m)` corresponds to any value up to and including
/// `m` and is encoded as `#fir.upper, %m`.
class UpperBoundAttr : public mlir::Attribute::AttrBase<UpperBoundAttr> {
class UpperBoundAttr
: public mlir::Attribute::AttrBase<UpperBoundAttr, mlir::Attribute,
mlir::AttributeStorage> {
public:
using Base::Base;
@ -107,7 +110,9 @@ public:
/// an ssa-value.
/// A case selector of `CASE (n:)` corresponds to any value down to and
/// including `n` and is encoded as `#fir.lower, %n`.
class LowerBoundAttr : public mlir::Attribute::AttrBase<LowerBoundAttr> {
class LowerBoundAttr
: public mlir::Attribute::AttrBase<LowerBoundAttr, mlir::Attribute,
mlir::AttributeStorage> {
public:
using Base::Base;
@ -123,7 +128,9 @@ public:
/// interval contains exactly one value.
/// A case selector of `CASE (p)` corresponds to exactly the value `p` and is
/// encoded as `#fir.point, %p`.
class PointIntervalAttr : public mlir::Attribute::AttrBase<PointIntervalAttr> {
class PointIntervalAttr
: public mlir::Attribute::AttrBase<PointIntervalAttr, mlir::Attribute,
mlir::AttributeStorage> {
public:
using Base::Base;

View File

@ -75,10 +75,11 @@ to provide our own storage class.
```c++
/// This class defines a simple parameterless type. All derived types must
/// inherit from the CRTP class 'Type::TypeBase'. It takes as template
/// parameters the concrete type (SimpleType), and the base class to use (Type).
/// parameters the concrete type (SimpleType), the base class to use (Type),
/// using the default storage class (TypeStorage) as the storage type.
/// 'Type::TypeBase' also provides several utility methods to simplify type
/// construction.
class SimpleType : public Type::TypeBase<SimpleType, Type> {
class SimpleType : public Type::TypeBase<SimpleType, Type, TypeStorage> {
public:
/// Inherit some necessary constructors from 'TypeBase'.
using Base::Base;

View File

@ -32,7 +32,7 @@ enum LinalgTypes {
/// %0 = linalg.range %arg0:%arg1:%arg2 : !linalg.range
/// }
/// ```
class RangeType : public Type::TypeBase<RangeType, Type> {
class RangeType : public Type::TypeBase<RangeType, Type, TypeStorage> {
public:
// Used for generic hooks in TypeBase.
using Base::Base;

View File

@ -39,7 +39,7 @@ enum Kind {
} // namespace ShapeTypes
/// The component type corresponding to shape, element type and attribute.
class ComponentType : public Type::TypeBase<ComponentType, Type> {
class ComponentType : public Type::TypeBase<ComponentType, Type, TypeStorage> {
public:
using Base::Base;
@ -54,7 +54,7 @@ public:
};
/// The element type of the shaped type.
class ElementType : public Type::TypeBase<ElementType, Type> {
class ElementType : public Type::TypeBase<ElementType, Type, TypeStorage> {
public:
using Base::Base;
@ -69,7 +69,7 @@ public:
};
/// The shape descriptor type represents rank and dimension sizes.
class ShapeType : public Type::TypeBase<ShapeType, Type> {
class ShapeType : public Type::TypeBase<ShapeType, Type, TypeStorage> {
public:
using Base::Base;
@ -82,7 +82,7 @@ public:
};
/// The type of a single dimension.
class SizeType : public Type::TypeBase<SizeType, Type> {
class SizeType : public Type::TypeBase<SizeType, Type, TypeStorage> {
public:
using Base::Base;
@ -95,7 +95,8 @@ public:
};
/// The ValueShape represents a (potentially unknown) runtime value and shape.
class ValueShapeType : public Type::TypeBase<ValueShapeType, Type> {
class ValueShapeType
: public Type::TypeBase<ValueShapeType, Type, TypeStorage> {
public:
using Base::Base;
@ -111,7 +112,7 @@ public:
/// The Witness represents a runtime constraint, to be used as shape related
/// preconditions on code execution.
class WitnessType : public Type::TypeBase<WitnessType, Type> {
class WitnessType : public Type::TypeBase<WitnessType, Type, TypeStorage> {
public:
using Base::Base;

View File

@ -63,8 +63,7 @@ public:
};
/// Utility class for implementing attributes.
template <typename ConcreteType, typename BaseType = Attribute,
typename StorageType = AttributeStorage,
template <typename ConcreteType, typename BaseType, typename StorageType,
template <typename T> class... Traits>
using AttrBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType,
detail::AttributeUniquer, Traits...>;
@ -636,7 +635,8 @@ public:
/// Unit attributes are attributes that hold no specific value and are given
/// meaning by their existence.
class UnitAttr : public Attribute::AttrBase<UnitAttr> {
class UnitAttr
: public Attribute::AttrBase<UnitAttr, Attribute, AttributeStorage> {
public:
using Base::Base;

View File

@ -208,7 +208,8 @@ public:
/// Represents an unknown location. This is always a singleton for a given
/// MLIRContext.
class UnknownLoc : public Attribute::AttrBase<UnknownLoc, LocationAttr> {
class UnknownLoc
: public Attribute::AttrBase<UnknownLoc, LocationAttr, AttributeStorage> {
public:
using Base::Base;

View File

@ -102,7 +102,7 @@ public:
/// Index is a special integer-like type with unknown platform-dependent bit
/// width.
class IndexType : public Type::TypeBase<IndexType, Type> {
class IndexType : public Type::TypeBase<IndexType, Type, TypeStorage> {
public:
using Base::Base;
@ -188,7 +188,7 @@ public:
// FloatType
//===----------------------------------------------------------------------===//
class FloatType : public Type::TypeBase<FloatType, Type> {
class FloatType : public Type::TypeBase<FloatType, Type, TypeStorage> {
public:
using Base::Base;
@ -227,7 +227,7 @@ public:
/// NoneType is a unit type, i.e. a type with exactly one possible value, where
/// its value does not have a defined dynamic representation.
class NoneType : public Type::TypeBase<NoneType, Type> {
class NoneType : public Type::TypeBase<NoneType, Type, TypeStorage> {
public:
using Base::Base;

View File

@ -100,8 +100,7 @@ public:
};
/// Utility class for implementing types.
template <typename ConcreteType, typename BaseType,
typename StorageType = DefaultTypeStorage,
template <typename ConcreteType, typename BaseType, typename StorageType,
template <typename T> class... Traits>
using TypeBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType,
detail::TypeUniquer, Traits...>;