File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 13
13
#include < type_traits>
14
14
#include < utility>
15
15
16
+ #include " llvm/ADT/STLForwardCompat.h"
16
17
#include " llvm/Support/MathExtras.h"
17
18
18
19
// / LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can
@@ -125,7 +126,7 @@ template <typename E> constexpr std::underlying_type_t<E> Mask() {
125
126
// / Check that Val is in range for E, and return Val cast to E's underlying
126
127
// / type.
127
128
template <typename E> constexpr std::underlying_type_t <E> Underlying (E Val) {
128
- auto U = static_cast <std:: underlying_type_t <E>> (Val);
129
+ auto U = llvm::to_underlying (Val);
129
130
assert (U >= 0 && " Negative enum values are not allowed." );
130
131
assert (U <= Mask<E>() && " Enum value too large (or largest val too small?)" );
131
132
return U;
@@ -181,9 +182,8 @@ E &operator^=(E &LHS, E RHS) {
181
182
// Enable bitmask enums in namespace ::llvm and all nested namespaces.
182
183
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE ();
183
184
template <typename E, typename = std::enable_if_t <is_bitmask_enum<E>::value>>
184
- constexpr unsigned BitWidth = BitmaskEnumDetail::bitWidth(uint64_t {
185
- static_cast <std::underlying_type_t <E>>(
186
- E::LLVM_BITMASK_LARGEST_ENUMERATOR)});
185
+ constexpr unsigned BitWidth = BitmaskEnumDetail::bitWidth(
186
+ uint64_t {llvm::to_underlying (E::LLVM_BITMASK_LARGEST_ENUMERATOR)});
187
187
188
188
} // namespace llvm
189
189
Original file line number Diff line number Diff line change 17
17
#define LLVM_ADT_FOLDINGSET_H
18
18
19
19
#include " llvm/ADT/Hashing.h"
20
+ #include " llvm/ADT/STLForwardCompat.h"
20
21
#include " llvm/ADT/SmallVector.h"
21
22
#include " llvm/ADT/iterator.h"
22
23
#include " llvm/Support/Allocator.h"
@@ -832,7 +833,7 @@ struct FoldingSetTrait<std::pair<T1, T2>> {
832
833
template <typename T>
833
834
struct FoldingSetTrait <T, std::enable_if_t <std::is_enum<T>::value>> {
834
835
static void Profile (const T &X, FoldingSetNodeID &ID) {
835
- ID.AddInteger (static_cast <std:: underlying_type_t <T>> (X));
836
+ ID.AddInteger (llvm::to_underlying (X));
836
837
}
837
838
};
838
839
You can’t perform that action at this time.
0 commit comments