Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions llvm/include/llvm/ADT/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ using TypeAtIndex = std::tuple_element_t<I, std::tuple<Ts...>>;
/// Helper which adds two underlying types of enumeration type.
/// Implicit conversion to a common type is accepted.
template <typename EnumTy1, typename EnumTy2,
typename UT1 = std::enable_if_t<std::is_enum<EnumTy1>::value,
std::underlying_type_t<EnumTy1>>,
typename UT2 = std::enable_if_t<std::is_enum<EnumTy2>::value,
std::underlying_type_t<EnumTy2>>>
typename = std::enable_if_t<std::is_enum_v<EnumTy1> &&
std::is_enum_v<EnumTy2>>>
constexpr auto addEnumValues(EnumTy1 LHS, EnumTy2 RHS) {
return static_cast<UT1>(LHS) + static_cast<UT2>(RHS);
return llvm::to_underlying(LHS) + llvm::to_underlying(RHS);
}

//===----------------------------------------------------------------------===//
Expand Down