Skip to content

Commit

Permalink
[mlir] Remove redundaunt typename (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Oct 16, 2022
1 parent 765af67 commit de49627
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 43 deletions.
2 changes: 1 addition & 1 deletion mlir/include/mlir/Analysis/DataFlowFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ struct ProgramPoint
ProgramPoint(ParentTy point = nullptr) : ParentTy(point) {}
/// Allow implicit conversions from operation wrappers.
/// TODO: For Windows only. Find a better solution.
template <typename OpT, typename = typename std::enable_if_t<
template <typename OpT, typename = std::enable_if_t<
std::is_convertible<OpT, Operation *>::value &&
!std::is_same<OpT, Operation *>::value>>
ProgramPoint(OpT op) : ParentTy(op) {}
Expand Down
8 changes: 4 additions & 4 deletions mlir/include/mlir/IR/AttributeSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class AttributeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'get<T, Args>(ctx, args)'.
template <typename T, typename... Args>
static typename std::enable_if_t<
static std::enable_if_t<
!std::is_same<typename T::ImplType, AttributeStorage>::value, T>
getWithTypeID(MLIRContext *ctx, TypeID typeID, Args &&...args) {
#ifndef NDEBUG
Expand All @@ -207,7 +207,7 @@ class AttributeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'get<T, Args>(ctx, args)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
std::is_same<typename T::ImplType, AttributeStorage>::value, T>
getWithTypeID(MLIRContext *ctx, TypeID typeID) {
#ifndef NDEBUG
Expand Down Expand Up @@ -239,7 +239,7 @@ class AttributeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'registerAttribute<T>(ctx)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
!std::is_same<typename T::ImplType, AttributeStorage>::value>
registerAttribute(MLIRContext *ctx, TypeID typeID) {
ctx->getAttributeUniquer()
Expand All @@ -249,7 +249,7 @@ class AttributeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'registerAttribute<T>(ctx)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
std::is_same<typename T::ImplType, AttributeStorage>::value>
registerAttribute(MLIRContext *ctx, TypeID typeID) {
ctx->getAttributeUniquer()
Expand Down
5 changes: 2 additions & 3 deletions mlir/include/mlir/IR/BlockSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ class BlockRange final
using RangeBaseT::RangeBaseT;
BlockRange(ArrayRef<Block *> blocks = llvm::None);
BlockRange(SuccessorRange successors);
template <typename Arg,
typename = typename std::enable_if_t<
std::is_constructible<ArrayRef<Block *>, Arg>::value>>
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<Block *>, Arg>::value>>
BlockRange(Arg &&arg)
: BlockRange(ArrayRef<Block *>(std::forward<Arg>(arg))) {}
BlockRange(std::initializer_list<Block *> blocks)
Expand Down
10 changes: 5 additions & 5 deletions mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ def ElementsAttrInterface : AttrInterface<"ElementsAttr"> {

template <typename T>
using DerivedAttrValueCheckT =
typename std::enable_if_t<std::is_base_of<Attribute, T>::value &&
!std::is_same<Attribute, T>::value>;
std::enable_if_t<std::is_base_of<Attribute, T>::value &&
!std::is_same<Attribute, T>::value>;
template <typename T, typename ResultT>
using DefaultValueCheckT =
typename std::enable_if_t<std::is_same<Attribute, T>::value ||
!std::is_base_of<Attribute, T>::value,
ResultT>;
std::enable_if_t<std::is_same<Attribute, T>::value ||
!std::is_base_of<Attribute, T>::value,
ResultT>;

/// Return the splat value for this attribute. This asserts that the
/// attribute corresponds to a splat.
Expand Down
14 changes: 6 additions & 8 deletions mlir/include/mlir/IR/Matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,18 @@ using has_operation_or_value_matcher_t =

/// Statically switch to a Value matcher.
template <typename MatcherClass>
typename std::enable_if_t<
llvm::is_detected<detail::has_operation_or_value_matcher_t, MatcherClass,
Value>::value,
bool>
std::enable_if_t<llvm::is_detected<detail::has_operation_or_value_matcher_t,
MatcherClass, Value>::value,
bool>
matchOperandOrValueAtIndex(Operation *op, unsigned idx, MatcherClass &matcher) {
return matcher.match(op->getOperand(idx));
}

/// Statically switch to an Operation matcher.
template <typename MatcherClass>
typename std::enable_if_t<
llvm::is_detected<detail::has_operation_or_value_matcher_t, MatcherClass,
Operation *>::value,
bool>
std::enable_if_t<llvm::is_detected<detail::has_operation_or_value_matcher_t,
MatcherClass, Operation *>::value,
bool>
matchOperandOrValueAtIndex(Operation *op, unsigned idx, MatcherClass &matcher) {
if (auto *defOp = op->getOperand(idx).getDefiningOp())
return matcher.match(defOp);
Expand Down
4 changes: 2 additions & 2 deletions mlir/include/mlir/IR/OpDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ struct SingleBlock : public TraitBase<ConcreteType, SingleBlock> {
/// can use SFINAE to disable the methods for non-single region operations.
template <typename OpT, typename T = void>
using enable_if_single_region =
typename std::enable_if_t<OpT::template hasTrait<OneRegion>(), T>;
std::enable_if_t<OpT::template hasTrait<OneRegion>(), T>;

template <typename OpT = ConcreteType>
enable_if_single_region<OpT, Block::iterator> begin() {
Expand Down Expand Up @@ -957,7 +957,7 @@ struct SingleBlockImplicitTerminator {

template <typename OpT, typename T = void>
using enable_if_single_region =
typename std::enable_if_t<OpT::template hasTrait<OneRegion>(), T>;
std::enable_if_t<OpT::template hasTrait<OneRegion>(), T>;

/// Insert the operation into the back of the body, before the terminator.
template <typename OpT = ConcreteType>
Expand Down
9 changes: 4 additions & 5 deletions mlir/include/mlir/IR/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,16 @@ class RegionRange

RegionRange(MutableArrayRef<Region> regions = llvm::None);

template <typename Arg,
typename = typename std::enable_if_t<std::is_constructible<
ArrayRef<std::unique_ptr<Region>>, Arg>::value>>
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<std::unique_ptr<Region>>, Arg>::value>>
RegionRange(Arg &&arg)
: RegionRange(ArrayRef<std::unique_ptr<Region>>(std::forward<Arg>(arg))) {
}
template <typename Arg>
RegionRange(
Arg &&arg,
typename std::enable_if_t<
std::is_constructible<ArrayRef<Region *>, Arg>::value> * = nullptr)
std::enable_if_t<std::is_constructible<ArrayRef<Region *>, Arg>::value>
* = nullptr)
: RegionRange(ArrayRef<Region *>(std::forward<Arg>(arg))) {}
RegionRange(ArrayRef<std::unique_ptr<Region>> regions);
RegionRange(ArrayRef<Region *> regions);
Expand Down
5 changes: 2 additions & 3 deletions mlir/include/mlir/IR/TypeRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
TypeRange(ValueTypeRange<ValueRangeT> values)
: TypeRange(ValueRange(ValueRangeT(values.begin().getCurrent(),
values.end().getCurrent()))) {}
template <typename Arg,
typename = typename std::enable_if_t<
std::is_constructible<ArrayRef<Type>, Arg>::value>>
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<Type>, Arg>::value>>
TypeRange(Arg &&arg) : TypeRange(ArrayRef<Type>(std::forward<Arg>(arg))) {}
TypeRange(std::initializer_list<Type> types)
: TypeRange(ArrayRef<Type>(types)) {}
Expand Down
8 changes: 4 additions & 4 deletions mlir/include/mlir/IR/TypeSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct TypeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'get<T, Args>(ctx, args)'.
template <typename T, typename... Args>
static typename std::enable_if_t<
static std::enable_if_t<
!std::is_same<typename T::ImplType, TypeStorage>::value, T>
getWithTypeID(MLIRContext *ctx, TypeID typeID, Args &&...args) {
#ifndef NDEBUG
Expand All @@ -196,7 +196,7 @@ struct TypeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'get<T, Args>(ctx, args)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
std::is_same<typename T::ImplType, TypeStorage>::value, T>
getWithTypeID(MLIRContext *ctx, TypeID typeID) {
#ifndef NDEBUG
Expand Down Expand Up @@ -230,7 +230,7 @@ struct TypeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'registerType<T>(ctx)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
!std::is_same<typename T::ImplType, TypeStorage>::value>
registerType(MLIRContext *ctx, TypeID typeID) {
ctx->getTypeUniquer().registerParametricStorageType<typename T::ImplType>(
Expand All @@ -240,7 +240,7 @@ struct TypeUniquer {
/// The use of this method is in general discouraged in favor of
/// 'registerType<T>(ctx)'.
template <typename T>
static typename std::enable_if_t<
static std::enable_if_t<
std::is_same<typename T::ImplType, TypeStorage>::value>
registerType(MLIRContext *ctx, TypeID typeID) {
ctx->getTypeUniquer().registerSingletonStorageType<TypeStorage>(
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/IR/ValueRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class ValueRange final
using RangeBaseT::RangeBaseT;

template <typename Arg,
typename = typename std::enable_if_t<
typename = std::enable_if_t<
std::is_constructible<ArrayRef<Value>, Arg>::value &&
!std::is_convertible<Arg, Value>::value>>
ValueRange(Arg &&arg) : ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Interfaces/InferTypeOpInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ShapedTypeComponents {
if (ranked)
adaptor.getDims(*this);
}
template <typename Arg, typename = typename std::enable_if_t<
template <typename Arg, typename = std::enable_if_t<
std::is_constructible<ShapeStorageT, Arg>::value>>
ShapedTypeComponents(Arg &&arg, Type elementType = nullptr,
Attribute attr = nullptr)
Expand Down
4 changes: 2 additions & 2 deletions mlir/include/mlir/Support/InterfaceSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class Interface : public BaseType {

/// Construct an interface instance from a type that implements this
/// interface's trait.
template <typename T, typename std::enable_if_t<
std::is_base_of<Trait<T>, T>::value> * = nullptr>
template <typename T,
std::enable_if_t<std::is_base_of<Trait<T>, T>::value> * = nullptr>
Interface(T t)
: BaseType(t), impl(t ? ConcreteType::getInterfaceFor(t) : nullptr) {
assert((!t || impl) && "expected value to provide interface instance");
Expand Down
4 changes: 2 additions & 2 deletions mlir/include/mlir/TableGen/Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ class Class {
/// Create a class with a name, and whether it should be declared as a `class`
/// or `struct`. Also, prevent this from being mistaken as a move constructor
/// candidate.
template <typename NameT, typename = typename std::enable_if_t<
!std::is_same<NameT, Class>::value>>
template <typename NameT,
typename = std::enable_if_t<!std::is_same<NameT, Class>::value>>
Class(NameT &&name, bool isStruct = false)
: className(stringify(std::forward<NameT>(name))), isStruct(isStruct) {}

Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/IR/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ struct SymbolScope {
/// This variant is used when the callback type matches that expected by
/// 'walkSymbolUses'.
template <typename CallbackT,
typename std::enable_if_t<!std::is_same<
std::enable_if_t<!std::is_same<
typename llvm::function_traits<CallbackT>::result_t,
void>::value> * = nullptr>
Optional<WalkResult> walk(CallbackT cback) {
Expand All @@ -607,7 +607,7 @@ struct SymbolScope {
/// This variant is used when the callback type matches a stripped down type:
/// void(SymbolTable::SymbolUse use)
template <typename CallbackT,
typename std::enable_if_t<std::is_same<
std::enable_if_t<std::is_same<
typename llvm::function_traits<CallbackT>::result_t,
void>::value> * = nullptr>
Optional<WalkResult> walk(CallbackT cback) {
Expand Down

0 comments on commit de49627

Please sign in to comment.