[flang-commits] [flang] f625f52 - [mlir] Remove the default template parameters from AttrBase and TypeBase.

River Riddle via flang-commits flang-commits at lists.llvm.org
Tue Jun 30 22:02:05 PDT 2020


Author: River Riddle
Date: 2020-06-30T21:55:32-07:00
New Revision: f625f5231ab8e76b1367f70aeed56b6389d83471

URL: https://github.com/llvm/llvm-project/commit/f625f5231ab8e76b1367f70aeed56b6389d83471
DIFF: https://github.com/llvm/llvm-project/commit/f625f5231ab8e76b1367f70aeed56b6389d83471.diff

LOG: [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.

Added: 
    

Modified: 
    flang/include/flang/Optimizer/Dialect/FIRAttr.h
    mlir/docs/Tutorials/DefiningAttributesAndTypes.md
    mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h
    mlir/include/mlir/Dialect/Shape/IR/Shape.h
    mlir/include/mlir/IR/Attributes.h
    mlir/include/mlir/IR/Location.h
    mlir/include/mlir/IR/StandardTypes.h
    mlir/include/mlir/IR/Types.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.h b/flang/include/flang/Optimizer/Dialect/FIRAttr.h
index 57ce5f13bf65..0b22bc21224c 100644
--- a/flang/include/flang/Optimizer/Dialect/FIRAttr.h
+++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.h
@@ -75,7 +75,8 @@ class SubclassAttr
 /// 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 @@ class ClosedIntervalAttr
 /// 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 @@ class UpperBoundAttr : public mlir::Attribute::AttrBase<UpperBoundAttr> {
 /// 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 @@ class LowerBoundAttr : public mlir::Attribute::AttrBase<LowerBoundAttr> {
 /// 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;
 

diff  --git a/mlir/docs/Tutorials/DefiningAttributesAndTypes.md b/mlir/docs/Tutorials/DefiningAttributesAndTypes.md
index b3597f48e659..cab2441b3320 100644
--- a/mlir/docs/Tutorials/DefiningAttributesAndTypes.md
+++ b/mlir/docs/Tutorials/DefiningAttributesAndTypes.md
@@ -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;

diff  --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h b/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h
index 6f93d2184709..9f23e64e7c5d 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h
@@ -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;

diff  --git a/mlir/include/mlir/Dialect/Shape/IR/Shape.h b/mlir/include/mlir/Dialect/Shape/IR/Shape.h
index b78b7304592d..62e4e0c4511f 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/Shape.h
+++ b/mlir/include/mlir/Dialect/Shape/IR/Shape.h
@@ -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 @@ class ComponentType : public Type::TypeBase<ComponentType, Type> {
 };
 
 /// 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 @@ class ElementType : public Type::TypeBase<ElementType, Type> {
 };
 
 /// 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 @@ class ShapeType : public Type::TypeBase<ShapeType, Type> {
 };
 
 /// 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 @@ class SizeType : public Type::TypeBase<SizeType, Type> {
 };
 
 /// 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 @@ class ValueShapeType : public Type::TypeBase<ValueShapeType, Type> {
 
 /// 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;
 

diff  --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h
index e9d82493ac35..f01937fd9794 100644
--- a/mlir/include/mlir/IR/Attributes.h
+++ b/mlir/include/mlir/IR/Attributes.h
@@ -63,8 +63,7 @@ class Attribute {
   };
 
   /// 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 @@ class TypeAttr : public Attribute::AttrBase<TypeAttr, Attribute,
 
 /// 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;
 

diff  --git a/mlir/include/mlir/IR/Location.h b/mlir/include/mlir/IR/Location.h
index ea6c954f9aac..c1b6dd016db7 100644
--- a/mlir/include/mlir/IR/Location.h
+++ b/mlir/include/mlir/IR/Location.h
@@ -208,7 +208,8 @@ class NameLoc : public Attribute::AttrBase<NameLoc, LocationAttr,
 
 /// 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;
 

diff  --git a/mlir/include/mlir/IR/StandardTypes.h b/mlir/include/mlir/IR/StandardTypes.h
index cde43843e8b5..85ac33bcf1ff 100644
--- a/mlir/include/mlir/IR/StandardTypes.h
+++ b/mlir/include/mlir/IR/StandardTypes.h
@@ -102,7 +102,7 @@ class ComplexType
 
 /// 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 @@ class IntegerType
 // FloatType
 //===----------------------------------------------------------------------===//
 
-class FloatType : public Type::TypeBase<FloatType, Type> {
+class FloatType : public Type::TypeBase<FloatType, Type, TypeStorage> {
 public:
   using Base::Base;
 
@@ -227,7 +227,7 @@ class FloatType : public Type::TypeBase<FloatType, Type> {
 
 /// 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;
 

diff  --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 9f77dede12d3..c14f8558d850 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -100,8 +100,7 @@ class Type {
   };
 
   /// 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...>;


        


More information about the flang-commits mailing list