bool operator!() const { return expr == nullptr; }
template <typename U>
- bool isa() const;
+ constexpr bool isa() const;
template <typename U>
U dyn_cast() const;
template <typename U>
raw_ostream &operator<<(raw_ostream &os, AffineExpr expr);
template <typename U>
-bool AffineExpr::isa() const {
- if (std::is_same<U, AffineBinaryOpExpr>::value)
+constexpr bool AffineExpr::isa() const {
+ if constexpr (std::is_same_v<U, AffineBinaryOpExpr>)
return getKind() <= AffineExprKind::LAST_AFFINE_BINARY_OP;
- if (std::is_same<U, AffineDimExpr>::value)
+ if constexpr (std::is_same_v<U, AffineDimExpr>)
return getKind() == AffineExprKind::DimId;
- if (std::is_same<U, AffineSymbolExpr>::value)
+ if constexpr (std::is_same_v<U, AffineSymbolExpr>)
return getKind() == AffineExprKind::SymbolId;
- if (std::is_same<U, AffineConstantExpr>::value)
+ if constexpr (std::is_same_v<U, AffineConstantExpr>)
return getKind() == AffineExprKind::Constant;
}
template <typename U>
void registerParametricStorageType(TypeID id) {
// If the storage is trivially destructible, we don't need a destructor
// function.
- if (std::is_trivially_destructible<Storage>::value)
+ if constexpr (std::is_trivially_destructible_v<Storage>)
return registerParametricStorageTypeImpl(id, nullptr);
registerParametricStorageTypeImpl(id, [](BaseStorage *storage) {
static_cast<Storage *>(storage)->~Storage();