diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-06-29 18:38:17 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-06-29 18:38:17 +0000 |
commit | 183646254547720c947b804585db8ceaa13e6c97 (patch) | |
tree | 5dc55606c351e8f9f04a9c33340be2966a4208a0 /libcxx/include/future | |
parent | eb8c4463c22ee5931d227bb1a140755e72dc387d (diff) | |
download | bcm5719-llvm-183646254547720c947b804585db8ceaa13e6c97.tar.gz bcm5719-llvm-183646254547720c947b804585db8ceaa13e6c97.zip |
Add operators to make launch a bitmask type. Searched all of the standard, and libc++ to see if this error occurred elsewhere and didn't see any other place. This fixes http://llvm.org/bugs/show_bug.cgi?id=16207
llvm-svn: 185265
Diffstat (limited to 'libcxx/include/future')
-rw-r--r-- | libcxx/include/future | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libcxx/include/future b/libcxx/include/future index 3d7bb6c9d04..160114e5901 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -403,6 +403,72 @@ _LIBCPP_DECLARE_STRONG_ENUM(launch) }; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) +#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS + +#ifdef _LIBCXX_UNDERLYING_TYPE +typedef underlying_type<launch>::type __launch_underlying_type; +#else +typedef int __launch_underlying_type; +#endif + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator&(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) & + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator|(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) | + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator^(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^ + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator~(launch __x) +{ + return static_cast<launch>(~static_cast<__launch_underlying_type>(__x)); +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator&=(launch& __x, launch __y) +{ + __x = __x & __y; return __x; +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator|=(launch& __x, launch __y) +{ + __x = __x | __y; return __x; +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator^=(launch& __x, launch __y) +{ + __x = __x ^ __y; return __x; +} + +#endif // !_LIBCPP_HAS_NO_STRONG_ENUMS + //enum class future_status _LIBCPP_DECLARE_STRONG_ENUM(future_status) { |