[PATCH] D22279: [ADT] Add FlagsEnum, used to enable bitwise operations on enums without static_cast.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 18:49:32 PDT 2016


jlebar added inline comments.

================
Comment at: include/llvm/ADT/FlagsEnum.h:23
@@ +22,3 @@
+/// perform bitwise operations on it without putting static_cast everywhere.
+///
+/// \code
----------------
BitwiseEnum, BitwiseEnabledEnum?

Really the only name that's part of the API is that of the macro.  `ENABLE_BITWISE_OPS_ON_ENUM`?

================
Comment at: include/llvm/ADT/FlagsEnum.h:70
@@ +69,3 @@
+// Get a bitmask with 1s in all places up to the high-order bit of E's largest
+// value.
+template <typename E> typename std::underlying_type<E>::type Mask() {
----------------
sgtm.  If we do it this way we can also inherit from false_type in the base case, which is nice.


http://reviews.llvm.org/D22279





More information about the llvm-commits mailing list