<div dir="ltr">This brakes some bots<div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/22441">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/22441</a><br></div><div><pre style="font-family:"Courier New",courier,monotype,monospace;color:rgb(0,0,0);font-size:medium"><span class="gmail-stdout">/b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/algorithm:648:10: fatal error: 'bit' file not found
#include <bit>
^~~~~
1 error generated.</span></pre></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 16, 2018 at 2:36 PM Marshall Clow via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: marshall<br>
Date: Thu Aug 16 14:35:38 2018<br>
New Revision: 339943<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=339943&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=339943&view=rev</a><br>
Log:<br>
Establish the <bit> header. NFC yet. Reviewed as <a href="https://reviews.llvm.org/D50815" rel="noreferrer" target="_blank">https://reviews.llvm.org/D50815</a><br>
<br>
Added:<br>
libcxx/trunk/include/bit<br>
Modified:<br>
libcxx/trunk/include/algorithm<br>
libcxx/trunk/include/module.modulemap<br>
libcxx/trunk/test/libcxx/double_include.sh.cpp<br>
<br>
Modified: libcxx/trunk/include/algorithm<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=339943&r1=339942&r2=339943&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=339943&r1=339942&r2=339943&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/algorithm (original)<br>
+++ libcxx/trunk/include/algorithm Thu Aug 16 14:35:38 2018<br>
@@ -645,13 +645,7 @@ template <class BidirectionalIterator, c<br>
#include <functional><br>
#include <iterator><br>
#include <cstddef><br>
-<br>
-#if defined(__IBMCPP__)<br>
-#include "support/ibm/support.h"<br>
-#endif<br>
-#if defined(_LIBCPP_COMPILER_MSVC)<br>
-#include <intrin.h><br>
-#endif<br>
+#include <bit><br>
<br>
#include <__debug><br>
<br>
@@ -788,135 +782,6 @@ struct __debug_less<br>
<br>
#endif // _LIBCPP_DEBUG<br>
<br>
-// Precondition: __x != 0<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned __ctz(unsigned __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned>(__builtin_ctz(__x));<br>
-#else<br>
- static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
- static_assert(sizeof(unsigned long) == 4, "");<br>
- unsigned long where;<br>
- // Search from LSB to MSB for first set bit.<br>
- // Returns zero if no set bit is found.<br>
- if (_BitScanForward(&where, __x))<br>
- return where;<br>
- return 32;<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned long __ctz(unsigned long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned long>(__builtin_ctzl(__x));<br>
-#else<br>
- static_assert(sizeof(unsigned long) == sizeof(unsigned), "");<br>
- return __ctz(static_cast<unsigned>(__x));<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned long long __ctz(unsigned long long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned long long>(__builtin_ctzll(__x));<br>
-#else<br>
- unsigned long where;<br>
-// Search from LSB to MSB for first set bit.<br>
-// Returns zero if no set bit is found.<br>
-#if defined(_LIBCPP_HAS_BITSCAN64)<br>
- (defined(_M_AMD64) || defined(__x86_64__))<br>
- if (_BitScanForward64(&where, __x))<br>
- return static_cast<int>(where);<br>
-#else<br>
- // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.<br>
- // Scan the Low Word.<br>
- if (_BitScanForward(&where, static_cast<unsigned long>(__x)))<br>
- return where;<br>
- // Scan the High Word.<br>
- if (_BitScanForward(&where, static_cast<unsigned long>(__x >> 32)))<br>
- return where + 32; // Create a bit offset from the LSB.<br>
-#endif<br>
- return 64;<br>
-#endif // _LIBCPP_COMPILER_MSVC<br>
-}<br>
-<br>
-// Precondition: __x != 0<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned __clz(unsigned __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned>(__builtin_clz(__x));<br>
-#else<br>
- static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
- static_assert(sizeof(unsigned long) == 4, "");<br>
- unsigned long where;<br>
- // Search from LSB to MSB for first set bit.<br>
- // Returns zero if no set bit is found.<br>
- if (_BitScanReverse(&where, __x))<br>
- return 31 - where;<br>
- return 32; // Undefined Behavior.<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned long __clz(unsigned long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned long>(__builtin_clzl (__x));<br>
-#else<br>
- static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
- return __clz(static_cast<unsigned>(__x));<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-unsigned long long __clz(unsigned long long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return static_cast<unsigned long long>(__builtin_clzll(__x));<br>
-#else<br>
- unsigned long where;<br>
-// BitScanReverse scans from MSB to LSB for first set bit.<br>
-// Returns 0 if no set bit is found.<br>
-#if defined(_LIBCPP_HAS_BITSCAN64)<br>
- if (_BitScanReverse64(&where, __x))<br>
- return static_cast<int>(63 - where);<br>
-#else<br>
- // Scan the high 32 bits.<br>
- if (_BitScanReverse(&where, static_cast<unsigned long>(__x >> 32)))<br>
- return 63 - (where + 32); // Create a bit offset from the MSB.<br>
- // Scan the low 32 bits.<br>
- if (_BitScanReverse(&where, static_cast<unsigned long>(__x)))<br>
- return 63 - where;<br>
-#endif<br>
- return 64; // Undefined Behavior.<br>
-#endif // _LIBCPP_COMPILER_MSVC<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return __builtin_popcount (__x);<br>
-#else<br>
- static_assert(sizeof(unsigned) == 4, "");<br>
- return __popcnt(__x);<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return __builtin_popcountl (__x);<br>
-#else<br>
- static_assert(sizeof(unsigned long) == 4, "");<br>
- return __popcnt(__x);<br>
-#endif<br>
-}<br>
-<br>
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {<br>
-#ifndef _LIBCPP_COMPILER_MSVC<br>
- return __builtin_popcountll(__x);<br>
-#else<br>
- static_assert(sizeof(unsigned long long) == 8, "");<br>
- return __popcnt64(__x);<br>
-#endif<br>
-}<br>
-<br>
// all_of<br>
<br>
template <class _InputIterator, class _Predicate><br>
<br>
Added: libcxx/trunk/include/bit<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bit?rev=339943&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bit?rev=339943&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/include/bit (added)<br>
+++ libcxx/trunk/include/bit Thu Aug 16 14:35:38 2018<br>
@@ -0,0 +1,169 @@<br>
+// -*- C++ -*-<br>
+//===------------------------------ bit ----------------------------------===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===---------------------------------------------------------------------===//<br>
+<br>
+#ifndef _LIBCPP_BIT<br>
+#define _LIBCPP_BIT<br>
+<br>
+/*<br>
+ bit synopsis<br>
+<br>
+namespace std {<br>
+<br>
+} // namespace std<br>
+<br>
+*/<br>
+<br>
+#include <__config><br>
+<br>
+#if defined(__IBMCPP__)<br>
+#include "support/ibm/support.h"<br>
+#endif<br>
+#if defined(_LIBCPP_COMPILER_MSVC)<br>
+#include <intrin.h><br>
+#endif<br>
+<br>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
+#pragma GCC system_header<br>
+#endif<br>
+<br>
+_LIBCPP_BEGIN_NAMESPACE_STD<br>
+<br>
+// Precondition: __x != 0<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned __ctz(unsigned __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned>(__builtin_ctz(__x));<br>
+#else<br>
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
+ static_assert(sizeof(unsigned long) == 4, "");<br>
+ unsigned long where;<br>
+ // Search from LSB to MSB for first set bit.<br>
+ // Returns zero if no set bit is found.<br>
+ if (_BitScanForward(&where, __x))<br>
+ return where;<br>
+ return 32;<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned long __ctz(unsigned long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned long>(__builtin_ctzl(__x));<br>
+#else<br>
+ static_assert(sizeof(unsigned long) == sizeof(unsigned), "");<br>
+ return __ctz(static_cast<unsigned>(__x));<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned long long __ctz(unsigned long long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned long long>(__builtin_ctzll(__x));<br>
+#else<br>
+ unsigned long where;<br>
+// Search from LSB to MSB for first set bit.<br>
+// Returns zero if no set bit is found.<br>
+#if defined(_LIBCPP_HAS_BITSCAN64)<br>
+ (defined(_M_AMD64) || defined(__x86_64__))<br>
+ if (_BitScanForward64(&where, __x))<br>
+ return static_cast<int>(where);<br>
+#else<br>
+ // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.<br>
+ // Scan the Low Word.<br>
+ if (_BitScanForward(&where, static_cast<unsigned long>(__x)))<br>
+ return where;<br>
+ // Scan the High Word.<br>
+ if (_BitScanForward(&where, static_cast<unsigned long>(__x >> 32)))<br>
+ return where + 32; // Create a bit offset from the LSB.<br>
+#endif<br>
+ return 64;<br>
+#endif // _LIBCPP_COMPILER_MSVC<br>
+}<br>
+<br>
+// Precondition: __x != 0<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned __clz(unsigned __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned>(__builtin_clz(__x));<br>
+#else<br>
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
+ static_assert(sizeof(unsigned long) == 4, "");<br>
+ unsigned long where;<br>
+ // Search from LSB to MSB for first set bit.<br>
+ // Returns zero if no set bit is found.<br>
+ if (_BitScanReverse(&where, __x))<br>
+ return 31 - where;<br>
+ return 32; // Undefined Behavior.<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned long __clz(unsigned long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned long>(__builtin_clzl (__x));<br>
+#else<br>
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");<br>
+ return __clz(static_cast<unsigned>(__x));<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY<br>
+unsigned long long __clz(unsigned long long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return static_cast<unsigned long long>(__builtin_clzll(__x));<br>
+#else<br>
+ unsigned long where;<br>
+// BitScanReverse scans from MSB to LSB for first set bit.<br>
+// Returns 0 if no set bit is found.<br>
+#if defined(_LIBCPP_HAS_BITSCAN64)<br>
+ if (_BitScanReverse64(&where, __x))<br>
+ return static_cast<int>(63 - where);<br>
+#else<br>
+ // Scan the high 32 bits.<br>
+ if (_BitScanReverse(&where, static_cast<unsigned long>(__x >> 32)))<br>
+ return 63 - (where + 32); // Create a bit offset from the MSB.<br>
+ // Scan the low 32 bits.<br>
+ if (_BitScanReverse(&where, static_cast<unsigned long>(__x)))<br>
+ return 63 - where;<br>
+#endif<br>
+ return 64; // Undefined Behavior.<br>
+#endif // _LIBCPP_COMPILER_MSVC<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return __builtin_popcount (__x);<br>
+#else<br>
+ static_assert(sizeof(unsigned) == 4, "");<br>
+ return __popcnt(__x);<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return __builtin_popcountl (__x);<br>
+#else<br>
+ static_assert(sizeof(unsigned long) == 4, "");<br>
+ return __popcnt(__x);<br>
+#endif<br>
+}<br>
+<br>
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {<br>
+#ifndef _LIBCPP_COMPILER_MSVC<br>
+ return __builtin_popcountll(__x);<br>
+#else<br>
+ static_assert(sizeof(unsigned long long) == 8, "");<br>
+ return __popcnt64(__x);<br>
+#endif<br>
+}<br>
+<br>
+_LIBCPP_END_NAMESPACE_STD<br>
+<br>
+#endif // _LIBCPP_BIT<br>
<br>
Modified: libcxx/trunk/include/module.modulemap<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=339943&r1=339942&r2=339943&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=339943&r1=339942&r2=339943&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/module.modulemap (original)<br>
+++ libcxx/trunk/include/module.modulemap Thu Aug 16 14:35:38 2018<br>
@@ -228,6 +228,10 @@ module std [system] {<br>
header "atomic"<br>
export *<br>
}<br>
+ module bit {<br>
+ header "bit"<br>
+ export *<br>
+ }<br>
module bitset {<br>
header "bitset"<br>
export string<br>
<br>
Modified: libcxx/trunk/test/libcxx/double_include.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=339943&r1=339942&r2=339943&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=339943&r1=339942&r2=339943&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/test/libcxx/double_include.sh.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/double_include.sh.cpp Thu Aug 16 14:35:38 2018<br>
@@ -27,6 +27,7 @@<br>
#ifndef _LIBCPP_HAS_NO_THREADS<br>
#include <atomic><br>
#endif<br>
+#include <bit><br>
#include <bitset><br>
#include <cassert><br>
#include <ccomplex><br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>