[libcxx] r339804 - Mark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, since those calls were introduced in C++11. They're already guarded by an ifdef in the code, so this is a

2018-08-15 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Aug 15 12:27:53 2018
New Revision: 339804

URL: http://llvm.org/viewvc/llvm-project?rev=339804&view=rev
Log:
Mark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, 
since those calls were introduced in C++11.  They're already guarded by an 
ifdef in the code, so this is a 'belt-and-suspenders' change.

Modified:

libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp

libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp

libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp?rev=339804&r1=339803&r2=339804&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp 
Wed Aug 15 12:27:53 2018
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 
//===--===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test quick_exit and at_quick_exit
 

Modified: 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp?rev=339804&r1=339803&r2=339804&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
 Wed Aug 15 12:27:53 2018
@@ -7,6 +7,7 @@
 //
 
//===--===//
 //
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not 
defined
 // results in a compile error.

Modified: 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp?rev=339804&r1=339803&r2=339804&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
 Wed Aug 15 12:27:53 2018
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 
//===--===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
 // results in a compile error.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r339816 - Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799

2018-08-15 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Aug 15 14:19:08 2018
New Revision: 339816

URL: http://llvm.org/viewvc/llvm-project?rev=339816&view=rev
Log:
Selectively import timespec_get into namespace std, since some C libraries 
don't have it. Reviewed as https://reviews.llvm.org/D50799

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/cstdlib
libcxx/trunk/include/ctime
libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Aug 15 14:19:08 2018
@@ -334,6 +334,7 @@
 #define _LIBCPP_HAS_C11_FEATURES
 #  elif defined(__Fuchsia__)
 #define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_TIMESPEC_GET
 #define _LIBCPP_HAS_C11_FEATURES
 #  elif defined(__linux__)
 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
@@ -342,9 +343,11 @@
 #  endif
 #  if _LIBCPP_GLIBC_PREREQ(2, 17)
 #define _LIBCPP_HAS_C11_FEATURES
+#define _LIBCPP_HAS_TIMESPEC_GET
 #  endif
 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
 #  define _LIBCPP_HAS_QUICK_EXIT
+#  define _LIBCPP_HAS_TIMESPEC_GET
 #  define _LIBCPP_HAS_C11_FEATURES
 #endif
 #  endif // __linux__

Modified: libcxx/trunk/include/cstdlib
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Wed Aug 15 14:19:08 2018
@@ -151,11 +151,11 @@ using ::mbtowc;
 using ::wctomb;
 using ::mbstowcs;
 using ::wcstombs;
-#ifdef _LIBCPP_HAS_QUICK_EXIT
+#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
 using ::at_quick_exit;
 using ::quick_exit;
 #endif
-#ifdef _LIBCPP_HAS_C11_FEATURES
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
 using ::aligned_alloc;
 #endif
 

Modified: libcxx/trunk/include/ctime
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ctime?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/include/ctime (original)
+++ libcxx/trunk/include/ctime Wed Aug 15 14:19:08 2018
@@ -73,7 +73,7 @@ using ::gmtime;
 using ::localtime;
 #endif
 using ::strftime;
-#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
 using ::timespec_get;
 #endif
 

Modified: libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp Wed 
Aug 15 14:19:08 2018
@@ -45,7 +45,7 @@ int main()
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
 static_assert((std::is_same::value), "");
 #endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS

Modified: libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp Wed Aug 15 
14:19:08 2018
@@ -47,7 +47,7 @@ int main()
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
 static_assert((std::is_same::value), "");
 #endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=339816&r1=339815&r2=339816&view=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Wed Aug 15 14:19:08 2018
@@ -124,22 +124,29 @@
 
 // Sniff out to see if the underling

[libcxx] r339943 - Establish the header. NFC yet. Reviewed as https://reviews.llvm.org/D50815

2018-08-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Aug 16 14:35:38 2018
New Revision: 339943

URL: http://llvm.org/viewvc/llvm-project?rev=339943&view=rev
Log:
Establish the  header. NFC yet. Reviewed as https://reviews.llvm.org/D50815

Added:
libcxx/trunk/include/bit
Modified:
libcxx/trunk/include/algorithm
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=339943&r1=339942&r2=339943&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu Aug 16 14:35:38 2018
@@ -645,13 +645,7 @@ template 
 #include 
 #include 
-
-#if defined(__IBMCPP__)
-#include "support/ibm/support.h"
-#endif
-#if defined(_LIBCPP_COMPILER_MSVC)
-#include 
-#endif
+#include 
 
 #include <__debug>
 
@@ -788,135 +782,6 @@ struct __debug_less
 
 #endif  // _LIBCPP_DEBUG
 
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __ctz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanForward(&where, __x))
-return where;
-  return 32;
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __ctz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctzl(__x));
-#else
-static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
-return __ctz(static_cast(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __ctz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctzll(__x));
-#else
-unsigned long where;
-// Search from LSB to MSB for first set bit.
-// Returns zero if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-(defined(_M_AMD64) || defined(__x86_64__))
-  if (_BitScanForward64(&where, __x))
-return static_cast(where);
-#else
-  // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
-  // Scan the Low Word.
-  if (_BitScanForward(&where, static_cast(__x)))
-return where;
-  // Scan the High Word.
-  if (_BitScanForward(&where, static_cast(__x >> 32)))
-return where + 32; // Create a bit offset from the LSB.
-#endif
-  return 64;
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __clz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanReverse(&where, __x))
-return 31 - where;
-  return 32; // Undefined Behavior.
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __clz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clzl (__x));
-#else
-static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-return __clz(static_cast(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __clz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clzll(__x));
-#else
-  unsigned long where;
-// BitScanReverse scans from MSB to LSB for first set bit.
-// Returns 0 if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-  if (_BitScanReverse64(&where, __x))
-return static_cast(63 - where);
-#else
-  // Scan the high 32 bits.
-  if (_BitScanReverse(&where, static_cast(__x >> 32)))
-return 63 - (where + 32); // Create a bit offset from the MSB.
-  // Scan the low 32 bits.
-  if (_BitScanReverse(&where, static_cast(__x)))
-return 63 - where;
-#endif
-  return 64; // Undefined Behavior.
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcount  (__x);
-#else
-  static_assert(sizeof(unsigned) == 4, "");
-  return __popcnt(__x);
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcountl (__x);
-#else
-  static_assert(sizeof(unsigned long) == 4, "");
-  return __popcnt(__x);
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcountll(__x);
-#else
-  static_assert(sizeof(unsigned long long) == 8, "");
-  return __popcnt64(__x);
-#endif
-}
-
 // all_of
 
 template 

Added: libcxx/trunk/include/bit
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bit?rev=339943&view=auto
==

Re: [libcxx] r339943 - Establish the header. NFC yet. Reviewed as https://reviews.llvm.org/D50815

2018-08-17 Thread Marshall Clow via cfe-commits
On Thu, Aug 16, 2018 at 3:30 PM, Vitaly Buka  wrote:

> This brakes some bots
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/22441
>
> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/algorithm:648:10:
>  fatal error: 'bit' file not found
> #include 
>  ^
> 1 error generated.
>
> That's very weird.

I suspect that you have a build system problem, since you picked up the new
 (that #includes )
but not the new file 

How can that be?

-- Marshall
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r339943 - Establish the header. NFC yet. Reviewed as https://reviews.llvm.org/D50815

2018-08-17 Thread Marshall Clow via cfe-commits
On Fri, Aug 17, 2018 at 8:49 AM, Marshall Clow 
wrote:

> On Thu, Aug 16, 2018 at 3:30 PM, Vitaly Buka 
> wrote:
>
>> This brakes some bots
>> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-
>> fast/builds/22441
>>
>> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/algorithm:648:10:
>>  fatal error: 'bit' file not found
>> #include 
>>  ^
>> 1 error generated.
>>
>> That's very weird.
>
> I suspect that you have a build system problem, since you picked up the
> new  (that #includes )
> but not the new file 
>
> How can that be?
>
>
Looks like I needed to put a line in libcxx/include/CMakeLists.txt .
Sorry for the noise.
Will re-commit.

-- Marshall
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r340045 - Recommit r339943 - Establish the header. NFC yet. Reviewed as https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots

2018-08-17 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Aug 17 09:07:48 2018
New Revision: 340045

URL: http://llvm.org/viewvc/llvm-project?rev=340045&view=rev
Log:
Recommit r339943 - Establish the  header. NFC yet. Reviewed as 
https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots

Added:
libcxx/trunk/include/bit
Modified:
libcxx/trunk/include/CMakeLists.txt
libcxx/trunk/include/algorithm
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp

Modified: libcxx/trunk/include/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=340045&r1=340044&r2=340045&view=diff
==
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Fri Aug 17 09:07:48 2018
@@ -25,6 +25,7 @@ set(files
   any
   array
   atomic
+  bit
   bitset
   cassert
   ccomplex

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=340045&r1=340044&r2=340045&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Fri Aug 17 09:07:48 2018
@@ -645,13 +645,7 @@ template 
 #include 
 #include 
-
-#if defined(__IBMCPP__)
-#include "support/ibm/support.h"
-#endif
-#if defined(_LIBCPP_COMPILER_MSVC)
-#include 
-#endif
+#include 
 
 #include <__debug>
 
@@ -788,135 +782,6 @@ struct __debug_less
 
 #endif  // _LIBCPP_DEBUG
 
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __ctz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanForward(&where, __x))
-return where;
-  return 32;
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __ctz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctzl(__x));
-#else
-static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
-return __ctz(static_cast(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __ctz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctzll(__x));
-#else
-unsigned long where;
-// Search from LSB to MSB for first set bit.
-// Returns zero if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-(defined(_M_AMD64) || defined(__x86_64__))
-  if (_BitScanForward64(&where, __x))
-return static_cast(where);
-#else
-  // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
-  // Scan the Low Word.
-  if (_BitScanForward(&where, static_cast(__x)))
-return where;
-  // Scan the High Word.
-  if (_BitScanForward(&where, static_cast(__x >> 32)))
-return where + 32; // Create a bit offset from the LSB.
-#endif
-  return 64;
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __clz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanReverse(&where, __x))
-return 31 - where;
-  return 32; // Undefined Behavior.
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __clz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clzl (__x));
-#else
-static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-return __clz(static_cast(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __clz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_clzll(__x));
-#else
-  unsigned long where;
-// BitScanReverse scans from MSB to LSB for first set bit.
-// Returns 0 if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-  if (_BitScanReverse64(&where, __x))
-return static_cast(63 - where);
-#else
-  // Scan the high 32 bits.
-  if (_BitScanReverse(&where, static_cast(__x >> 32)))
-return 63 - (where + 32); // Create a bit offset from the MSB.
-  // Scan the low 32 bits.
-  if (_BitScanReverse(&where, static_cast(__x)))
-return 63 - where;
-#endif
-  return 64; // Undefined Behavior.
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcount  (__x);
-#else
-  static_assert(sizeof(unsigned) == 4, "");
-  return __popcnt(__x);
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {
-#ifn

[libcxx] r340049 - Refactor the newly created header. Still (almost) NFC. Reviewed as https://reviews.llvm.org/D50876

2018-08-17 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Aug 17 10:27:25 2018
New Revision: 340049

URL: http://llvm.org/viewvc/llvm-project?rev=340049&view=rev
Log:
Refactor the newly created  header. Still (almost) NFC. Reviewed as 
https://reviews.llvm.org/D50876

Modified:
libcxx/trunk/include/__bit_reference
libcxx/trunk/include/bit

Modified: libcxx/trunk/include/__bit_reference
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=340049&r1=340048&r2=340049&view=diff
==
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Fri Aug 17 10:27:25 2018
@@ -12,6 +12,7 @@
 #define _LIBCPP___BIT_REFERENCE
 
 #include <__config>
+#include 
 #include 
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -254,18 +255,18 @@ __count_bool_true(__bit_iterator<_Cp, _I
 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - 
__first.__ctz_);
 __storage_type __dn = _VSTD::min(__clz_f, __n);
 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & 
(~__storage_type(0) >> (__clz_f - __dn));
-__r = _VSTD::__pop_count(*__first.__seg_ & __m);
+__r = _VSTD::__popcount(*__first.__seg_ & __m);
 __n -= __dn;
 ++__first.__seg_;
 }
 // do middle whole words
 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
-__r += _VSTD::__pop_count(*__first.__seg_);
+__r += _VSTD::__popcount(*__first.__seg_);
 // do last partial word
 if (__n > 0)
 {
 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
-__r += _VSTD::__pop_count(*__first.__seg_ & __m);
+__r += _VSTD::__popcount(*__first.__seg_ & __m);
 }
 return __r;
 }
@@ -285,18 +286,18 @@ __count_bool_false(__bit_iterator<_Cp, _
 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - 
__first.__ctz_);
 __storage_type __dn = _VSTD::min(__clz_f, __n);
 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & 
(~__storage_type(0) >> (__clz_f - __dn));
-__r = _VSTD::__pop_count(~*__first.__seg_ & __m);
+__r = _VSTD::__popcount(~*__first.__seg_ & __m);
 __n -= __dn;
 ++__first.__seg_;
 }
 // do middle whole words
 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
-__r += _VSTD::__pop_count(~*__first.__seg_);
+__r += _VSTD::__popcount(~*__first.__seg_);
 // do last partial word
 if (__n > 0)
 {
 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
-__r += _VSTD::__pop_count(~*__first.__seg_ & __m);
+__r += _VSTD::__popcount(~*__first.__seg_ & __m);
 }
 return __r;
 }

Modified: libcxx/trunk/include/bit
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bit?rev=340049&r1=340048&r2=340049&view=diff
==
--- libcxx/trunk/include/bit (original)
+++ libcxx/trunk/include/bit Fri Aug 17 10:27:25 2018
@@ -35,135 +35,123 @@ namespace std {
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifndef _LIBCPP_COMPILER_MSVC
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned __x)   { return __builtin_ctz(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long __x)  { return __builtin_ctzl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long long __x) { return __builtin_ctzll(__x); }
+
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned __x)   { return __builtin_clz(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long __x)  { return __builtin_clzl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long long __x) { return __builtin_clzll(__x); }
+
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned __x)   { return __builtin_popcount(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned long __x)  { return __builtin_popcountl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned long long __x) { return __builtin_popcountll(__x); }
+
+#else  // _LIBCPP_COMPILER_MSVC
+
 // Precondition:  __x != 0
 inline _LIBCPP_INLINE_VISIBILITY
-unsigned __ctz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctz(__x));
-#else
+int __ctz(unsigned __x) {
   static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
   static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanForward(&where, __x))
-return where;
+  unsigned long __where;
+  if (_BitScanForward(&__where, __x))
+return static_cast(__where);
   return 32;
-#endif
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __ctz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-return static_cast(__builtin_ctzl(

[libcxx] r340385 - Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept tests for all the containers that have clear().

2018-08-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Aug 21 21:28:43 2018
New Revision: 340385

URL: http://llvm.org/viewvc/llvm-project?rev=340385&view=rev
Log:
Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept 
tests for all the containers that have clear().

Added:

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
Modified:
libcxx/trunk/include/map

libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp
libcxx/trunk/test/std/containers/associative/set/clear.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/clear.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/clear.pass.cpp

Modified: libcxx/trunk/include/map
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=340385&r1=340384&r2=340385&view=diff
==
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Tue Aug 21 21:28:43 2018
@@ -1884,7 +1884,7 @@ public:
 #endif
 
 _LIBCPP_INLINE_VISIBILITY
-void clear() {__tree_.clear();}
+void clear() _NOEXCEPT {__tree_.clear();}
 
 _LIBCPP_INLINE_VISIBILITY
 void swap(multimap& __m)

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp?rev=340385&r1=340384&r2=340385&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp 
Tue Aug 21 21:28:43 2018
@@ -11,11 +11,12 @@
 
 // class map
 
-// void clear();
+// void clear() noexcept;
 
 #include 
 #include 
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@ int main()
 };
 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
 assert(m.size() == 8);
+ASSERT_NOEXCEPT(m.clear());
 m.clear();
 assert(m.size() == 0);
 }
@@ -56,6 +58,7 @@ int main()
 };
 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
 assert(m.size() == 8);
+ASSERT_NOEXCEPT(m.clear());
 m.clear();
 assert(m.size() == 0);
 }

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp?rev=340385&r1=340384&r2=340385&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
 Tue Aug 21 21:28:43 2018
@@ -11,11 +11,12 @@
 
 // class multimap
 
-// void clear();
+// void clear() noexcept;
 
 #include 
 #include 
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@ int main()
 };
 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
 assert(m.size() == 8);
+ASSERT_NOEXCEPT(m.clear());
 m.clear();
 assert(m.size() == 0);
 }
@@ -56,6 +58,7 @@ int main()
 };
 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
 assert(m.size() == 8);
+ASSERT_NOEXCEPT(m.clear());
 m.clear();
 assert(m.size() == 0);
 }

Modified: libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp?rev=340385&r1=340384&r2=340385&view=diff
==
--- libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp Tue 
Aug 21 21:28:43 2018
@@ -11,11 +11,12 @@
 
 // class multiset
 
-// void clear();
+// void clear() noexcept;
 
 #include 
 #include 
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@ int main()
 };
 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
 assert(m.size() == 8);
+ASSERT_NOEXC

[libcxx] r332000 - More notes on Rapperswil issues

2018-05-10 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 10 10:07:38 2018
New Revision: 332000

URL: http://llvm.org/viewvc/llvm-project?rev=332000&view=rev
Log:
More notes on Rapperswil issues

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=332000&r1=331999&r2=332000&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Thu May 10 10:07:38 2018
@@ -70,7 +70,7 @@
 https://wg21.link/LWG3076";>3076basic_string CTAD 
ambiguityRapperswil
 https://wg21.link/LWG3079";>3079LWG 2935 forgot 
to fix the existing_p overloads of 
create_directoryRapperswil
 https://wg21.link/LWG3080";>3080Floating point 
from_chars pattern specification breaks 
round-trippingRapperswil
-https://wg21.link/LWG3083";>3083What should 
ios::iword(-1) do?Rapperswil
+https://wg21.link/LWG3083";>3083What should 
ios::iword(-1) do?RapperswilNothing to do
 https://wg21.link/LWG3094";>3094[time.duration.io]p4 makes 
surprising claims about encodingRapperswil
 https://wg21.link/LWG3100";>3100Unnecessary and 
confusing "empty span" wordingRapperswilNothing to 
do
 https://wg21.link/LWG3102";>3102Clarify span 
iterator and const_iterator behaviorRapperswil
@@ -92,17 +92,17 @@
 Comments about the issues
 
 2139 - I think that this is just wording cleanup.
-2970 - 
-3058 - 
+2970 - I think that we already do this - checking with Michael.
+3058 - We don't do the parallel algos yet
 3062 - This should be very easy.
 3067 - Adding restrictions; no code changes needed.
 3071 - This is just wording cleanup.
-3074 - 
+3074 - Large change, that looks straightforward.
 3076 - 
-3079 - 
-3080 - 
-3083 - 
-3094 - 
+3079 - Eric? 
+3080 - We don't have a from_chars implementation yet.
+3083 - This is just wording cleanup.
+3094 - We haven't implemented Howard's date library yet.
 3100 - This is just wording cleanup.
 3102 - This should be just adding tests.
 3104 - We already do this.
@@ -117,7 +117,7 @@
  2936 - Eric - don't we do this already?
 
 
-Last Updated: 7-May-2018
+Last Updated: 10-May-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r332768 - Implement deduction guides for ; Reviewed as https://reviews.llvm.org/D46964

2018-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri May 18 14:01:04 2018
New Revision: 332768

URL: http://llvm.org/viewvc/llvm-project?rev=332768&view=rev
Log:
Implement deduction guides for ; Reviewed as 
https://reviews.llvm.org/D46964

Added:
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/array

Modified: libcxx/trunk/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=332768&r1=332767&r2=332768&view=diff
==
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Fri May 18 14:01:04 2018
@@ -72,6 +72,9 @@ struct array
 const T* data() const noexcept;
 };
 
+  template 
+array(T, U...) -> array;
+
 template 
   bool operator==(const array& x, const array& y);
 template 
@@ -86,7 +89,7 @@ template 
   bool operator>=(const array& x, const array& y);
 
 template 
-  void swap(array& x, array& y) noexcept(noexcept(x.swap(y)));
+  void swap(array& x, array& y) noexcept(noexcept(x.swap(y))); // 
C++17
 
 template  class tuple_size;
 template  class tuple_element;
@@ -354,6 +357,14 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0
 };
 
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template && ...), void>::type
+ >
+array(_Tp, _Args...)
+  -> array<_Tp, 1 + sizeof...(_Args)>;
+#endif
+
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 bool

Added: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp?rev=332768&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp 
Fri May 18 14:01:04 2018
@@ -0,0 +1,32 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template 
+//   array(T, U...) -> array;
+//
+//  Requires: (is_same_v && ...) is true. Otherwise the program is 
ill-formed.
+
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+int main()
+{
+{
+std::array arr{1,2,3L}; // expected-error {{no viable constructor or 
deduction guide for deduction of template arguments of 'array'}}
+}
+}

Added: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp?rev=332768&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
Fri May 18 14:01:04 2018
@@ -0,0 +1,58 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template 
+//   array(T, U...) -> array;
+//
+//  Requires: (is_same_v && ...) is true. Otherwise the program is 
ill-formed.
+
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+int main()
+{
+//  Test the explicit deduction guides
+{
+std::array arr{1,2,3};  // array(T, U...)
+static_assert(std::is_same_v>, "");
+assert(arr[0] == 1);
+assert(arr[1] == 2);
+assert(arr[2] == 3);
+}
+
+{
+const long l1 = 42;
+std::array arr{1L, 4L, 9L, l1}; // array(T, U...)
+static_assert(std::is_same_v, "");
+static_assert(arr.size() == 4, "");
+assert(arr[0] == 1);
+assert(arr[1] == 4);
+assert(arr[2] == 9);
+assert(arr[3] == l1);
+}
+
+//  Test the implicit deduction guides
+  {
+  std::array source = {4.0, 5.0};
+  std::array arr(source);   // array(array)
+static_assert(std::is_same_v, "");
+static_assert(std::is_same_v>, "");
+assert(arr[0] == 4.0);
+assert(arr[1] == 5.0);
+  }
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r332779 - Disable 'missing-braces' warning

2018-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri May 18 15:21:33 2018
New Revision: 332779

URL: http://llvm.org/viewvc/llvm-project?rev=332779&view=rev
Log:
Disable 'missing-braces' warning

Modified:
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp?rev=332779&r1=332778&r2=332779&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.fail.cpp 
Fri May 18 15:21:33 2018
@@ -22,6 +22,11 @@
 #include 
 #include 
 
+// std::array is explicitly allowed to be initialized with A a = { init-list 
};.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+
 #include "test_macros.h"
 
 int main()

Modified: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp?rev=332779&r1=332778&r2=332779&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
Fri May 18 15:21:33 2018
@@ -22,6 +22,10 @@
 #include 
 #include 
 
+// std::array is explicitly allowed to be initialized with A a = { init-list 
};.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
 #include "test_macros.h"
 
 int main()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r332785 - Implement deduction guides for

2018-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri May 18 16:44:13 2018
New Revision: 332785

URL: http://llvm.org/viewvc/llvm-project?rev=332785&view=rev
Log:
Implement deduction guides for 

Added:
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.fail.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/deque

Modified: libcxx/trunk/include/deque
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=332785&r1=332784&r2=332785&view=diff
==
--- libcxx/trunk/include/deque (original)
+++ libcxx/trunk/include/deque Fri May 18 16:44:13 2018
@@ -128,6 +128,10 @@ public:
 void clear() noexcept;
 };
 
+template ::value_type>>
+   deque(InputIterator, InputIterator, Allocator = Allocator())
+   -> deque::value_type, Allocator>;
+
 template 
 bool operator==(const deque& x, const deque& y);
 template 
@@ -921,13 +925,14 @@ class __deque_base
 {
 __deque_base(const __deque_base& __c);
 __deque_base& operator=(const __deque_base& __c);
-protected:
-typedef _Tp  value_type;
+public:
 typedef _Allocator   allocator_type;
 typedef allocator_traits __alloc_traits;
+typedef typename __alloc_traits::size_type   size_type;
+protected:
+typedef _Tp  value_type;
 typedef value_type&  reference;
 typedef const value_type&const_reference;
-typedef typename __alloc_traits::size_type   size_type;
 typedef typename __alloc_traits::difference_type difference_type;
 typedef typename __alloc_traits::pointer pointer;
 typedef typename __alloc_traits::const_pointer   const_pointer;
@@ -946,6 +951,7 @@ protected:
 typedef __deque_iteratorconst_iterator;
 
+protected:
 __map __map_;
 size_type __start_;
 __compressed_pair __size_;
@@ -1461,6 +1467,23 @@ private:
 void __move_assign(deque& __c, false_type);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value_type>,
+ class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+ >
+deque(_InputIterator, _InputIterator)
+  -> deque::value_type, _Alloc>;
+
+template::value, void>::type
+ >
+deque(_InputIterator, _InputIterator, _Alloc)
+  -> deque::value_type, _Alloc>;
+#endif
+
+
 template 
 deque<_Tp, _Allocator>::deque(size_type __n)
 {

Added: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.fail.cpp?rev=332785&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.fail.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.fail.cpp 
Fri May 18 16:44:13 2018
@@ -0,0 +1,42 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//deque(InputIterator, InputIterator, Allocator = Allocator())
+//-> deque::value_type, Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+#include  // INT_MAX
+
+struct A {};
+
+int main()
+{  
+//  Test the explicit deduction guides
+
+//  Test the implicit deduction guides
+{
+//  deque (allocator &)
+std::deque deq((std::allocator()));  // expected-error {{no viable 
constructor or deduction guide for deduction of template arguments of 'deque'}}
+//  Note: The extra parens are necessary, since otherwise clang decides it is 
a function declaration.
+//  Also, we can't use {} instead of parens, because that constructs a
+//  deque, allocator>>
+}
+
+}

Added: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp?rev=332785&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp 
Fri May 18 16:44:13 2018
@@ -0,0 +1,98 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinoi

[libcxx] r332797 - Remove expression '1L + INT_MAX', because it overflows on machines where int/long are the same size

2018-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri May 18 20:09:05 2018
New Revision: 332797

URL: http://llvm.org/viewvc/llvm-project?rev=332797&view=rev
Log:
Remove expression '1L + INT_MAX', because it overflows on machines where 
int/long are the same size

Modified:
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp?rev=332797&r1=332796&r2=332797&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp 
Fri May 18 20:09:05 2018
@@ -43,12 +43,12 @@ int main()
 }
 
 {
-const long arr[] = {INT_MAX, 1L + INT_MAX, 2L, 3L };
+const long arr[] = {INT_MAX, 1L, 2L, 3L };
 std::deque deq(std::begin(arr), std::end(arr), std::allocator());
 static_assert(std::is_same_v, "");
 assert(deq.size() == 4);
 assert(deq[0] == INT_MAX);
-assert(deq[1] == 1L + INT_MAX);
+assert(deq[1] == 1L);
 assert(deq[2] == 2L);
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r332811 - Implement deduction guides for forward_list

2018-05-19 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sat May 19 09:02:05 2018
New Revision: 332811

URL: http://llvm.org/viewvc/llvm-project?rev=332811&view=rev
Log:
Implement deduction guides for forward_list

Added:

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.fail.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/forward_list

Modified: libcxx/trunk/include/forward_list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=332811&r1=332810&r2=332811&view=diff
==
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Sat May 19 09:02:05 2018
@@ -134,6 +134,11 @@ public:
 void reverse() noexcept;
 };
 
+
+template ::value_type>>
+forward_list(InputIterator, InputIterator, Allocator = Allocator())
+-> forward_list::value_type, 
Allocator>;  // C++17
+
 template 
 bool operator==(const forward_list& x,
 const forward_list& y);
@@ -845,6 +850,23 @@ private:
 __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
 };
 
+
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value_type>,
+ class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+ >
+forward_list(_InputIterator, _InputIterator)
+  -> forward_list::value_type, 
_Alloc>;
+
+template::value, void>::type
+ >
+forward_list(_InputIterator, _InputIterator, _Alloc)
+  -> forward_list::value_type, 
_Alloc>;
+#endif
+
 template 
 inline
 forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)

Added: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.fail.cpp?rev=332811&view=auto
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.fail.cpp
 Sat May 19 09:02:05 2018
@@ -0,0 +1,42 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//forward_list(InputIterator, InputIterator, Allocator = Allocator())
+//-> forward_list::value_type, 
Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+#include  // INT_MAX
+
+struct A {};
+
+int main()
+{  
+//  Test the explicit deduction guides
+
+//  Test the implicit deduction guides
+{
+//  forward_list (allocator &)
+std::forward_list fwl((std::allocator()));  // expected-error {{no 
viable constructor or deduction guide for deduction of template arguments of 
'forward_list'}}
+//  Note: The extra parens are necessary, since otherwise clang decides it is 
a function declaration.
+//  Also, we can't use {} instead of parens, because that constructs a
+//  forward_list, allocator>>
+}
+
+}

Added: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp?rev=332811&view=auto
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
 Sat May 19 09:02:05 2018
@@ -0,0 +1,103 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//deque(InputIterator, InputIterator, Allocator = Allocator())
+//-> deque::value_type, Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+#include  // INT_MAX
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "test_allocator.h"
+
+struct A {};
+
+int main()
+{
+  
+//  Test the explicit deduction guides
+{
+const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+std::forward_list fwl(std::begi

[libcxx] r332818 - Deduction guides for list

2018-05-20 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun May 20 07:05:31 2018
New Revision: 332818

URL: http://llvm.org/viewvc/llvm-project?rev=332818&view=rev
Log:
Deduction guides for list

Added:
libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.fail.cpp
libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/list

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=332818&r1=332817&r2=332818&view=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Sun May 20 07:05:31 2018
@@ -147,6 +147,11 @@ public:
 void reverse() noexcept;
 };
 
+
+template ::value_type>>
+list(InputIterator, InputIterator, Allocator = Allocator())
+-> list::value_type, Allocator>;  
// C++17
+
 template 
 bool operator==(const list& x, const list& y);
 template 
@@ -527,11 +532,12 @@ class __list_imp
 {
 __list_imp(const __list_imp&);
 __list_imp& operator=(const __list_imp&);
-protected:
-typedef _Tp value_type;
+public:
 typedef _Alloc  
allocator_type;
 typedef allocator_traits
__alloc_traits;
 typedef typename __alloc_traits::size_type  size_type;
+protected:
+typedef _Tp value_type;
 typedef typename __alloc_traits::void_pointer   
__void_pointer;
 typedef __list_iterator iterator;
 typedef __list_const_iterator   
const_iterator;
@@ -1106,6 +1112,22 @@ private:
 void __move_assign(list& __c, false_type);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value_type>,
+ class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+ >
+list(_InputIterator, _InputIterator)
+  -> list::value_type, _Alloc>;
+
+template::value, void>::type
+ >
+list(_InputIterator, _InputIterator, _Alloc)
+  -> list::value_type, _Alloc>;
+#endif
+
 // Link in nodes [__f, __l] just prior to __p
 template 
 inline

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.fail.cpp?rev=332818&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.fail.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.fail.cpp 
Sun May 20 07:05:31 2018
@@ -0,0 +1,42 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//list(InputIterator, InputIterator, Allocator = Allocator())
+//-> list::value_type, Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+#include  // INT_MAX
+
+struct A {};
+
+int main()
+{  
+//  Test the explicit deduction guides
+
+//  Test the implicit deduction guides
+{
+//  list (allocator &)
+std::list lst((std::allocator()));  // expected-error {{no viable 
constructor or deduction guide for deduction of template arguments of 'list'}}
+//  Note: The extra parens are necessary, since otherwise clang decides it is 
a function declaration.
+//  Also, we can't use {} instead of parens, because that constructs a
+//  deque, allocator>>
+}
+
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.pass.cpp?rev=332818&view=auto
==
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.pass.cpp 
(added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/deduct.pass.cpp 
Sun May 20 07:05:31 2018
@@ -0,0 +1,103 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//list(InputIterator, InputIterator, Allocator = Allocator())
+//-

[libcxx] r332901 - Implement deduction guides for vector

2018-05-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 21 14:30:12 2018
New Revision: 332901

URL: http://llvm.org/viewvc/llvm-project?rev=332901&view=rev
Log:
Implement deduction guides for vector

Added:

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.fail.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/vector

Modified: libcxx/trunk/include/vector
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=332901&r1=332900&r2=332901&view=diff
==
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Mon May 21 14:30:12 2018
@@ -244,6 +244,10 @@ public:
 bool __invariants() const;
 };
 
+template ::value_type>>
+   vector(InputIterator, InputIterator, Allocator = Allocator())
+   -> vector::value_type, Allocator>;
+
 template  struct hash>;
 
 template  bool operator==(const vector& 
x, const vector& y);
@@ -316,13 +320,14 @@ template 
 class __vector_base
 : protected __vector_base_common
 {
-protected:
-typedef _Tp  value_type;
+public:
 typedef _Allocator   allocator_type;
 typedef allocator_traits __alloc_traits;
+typedef typename __alloc_traits::size_type   size_type;
+protected:
+typedef _Tp  value_type;
 typedef value_type&  reference;
 typedef const value_type&const_reference;
-typedef typename __alloc_traits::size_type   size_type;
 typedef typename __alloc_traits::difference_type difference_type;
 typedef typename __alloc_traits::pointer pointer;
 typedef typename __alloc_traits::const_pointer   const_pointer;
@@ -492,8 +497,8 @@ public:
 #if _LIBCPP_STD_VER > 11
 explicit vector(size_type __n, const allocator_type& __a);
 #endif
-vector(size_type __n, const_reference __x);
-vector(size_type __n, const_reference __x, const allocator_type& __a);
+vector(size_type __n, const value_type& __x);
+vector(size_type __n, const value_type& __x, const allocator_type& __a);
 template 
 vector(_InputIterator __first,
typename enable_if<__is_input_iterator  <_InputIterator>::value 
&&
@@ -890,6 +895,22 @@ private:
 
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value_type>,
+ class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+ >
+vector(_InputIterator, _InputIterator)
+  -> vector::value_type, _Alloc>;
+
+template::value, void>::type
+ >
+vector(_InputIterator, _InputIterator, _Alloc)
+  -> vector::value_type, _Alloc>;
+#endif
+
 template 
 void
 vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v)
@@ -1099,7 +1120,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 #endif
 
 template 
-vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
+vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 __get_db()->__insert_c(this);
@@ -1112,7 +1133,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 }
 
 template 
-vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const 
allocator_type& __a)
+vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const 
allocator_type& __a)
 : __base(__a)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2

Added: 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.fail.cpp?rev=332901&view=auto
==
--- 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.fail.cpp 
(added)
+++ 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/deduct.fail.cpp 
Mon May 21 14:30:12 2018
@@ -0,0 +1,40 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//vector(InputIterator, InputIterator, Allocator = Allocator())
+//-> vector::value_type, 
Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+
+
+int main()
+{  
+//  Test the explicit deduction guides
+
+//  Test the implicit deduction guides
+{
+//  vector (allocator &)
+std::vector vec((std::allocator()));  // expected-error {{no viable 
constructor or deduction guide for deduction of template arguments of 'vector'}}
+//  Note: The extra parens are 

[libcxx] r332927 - Deduction guides for the container adaptors - queue, stack, and priority_queue

2018-05-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 21 18:57:53 2018
New Revision: 332927

URL: http://llvm.org/viewvc/llvm-project?rev=332927&view=rev
Log:
Deduction guides for the container adaptors - queue, stack, and priority_queue

Added:

libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.fail.cpp

libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp

libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
Modified:
libcxx/trunk/include/queue
libcxx/trunk/include/stack

Modified: libcxx/trunk/include/queue
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/queue?rev=332927&r1=332926&r2=332927&view=diff
==
--- libcxx/trunk/include/queue (original)
+++ libcxx/trunk/include/queue Mon May 21 18:57:53 2018
@@ -69,6 +69,12 @@ public:
 void swap(queue& q) noexcept(is_nothrow_swappable_v)
 };
 
+template
+  queue(Container) -> queue; // 
C++17
+  
+template 
+  queue(Container, Allocator) -> queue; // C++17
+
 template 
   bool operator==(const queue& x,const queue& y);
 
@@ -157,6 +163,20 @@ public:
  is_nothrow_swappable_v)
 };
 
+template 
+priority_queue(Compare, Container)
+-> priority_queue; // 
C++17
+  
+template::value_type>,
+ class Container = vector::value_type>>
+priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = 
Container())
+-> priority_queue::value_type, 
Container, Compare>; // C++17
+  
+template
+priority_queue(Compare, Container, Allocator)
+-> priority_queue; // 
C++17
+
 template 
   void swap(priority_queue& x,
 priority_queue& y)
@@ -321,6 +341,22 @@ public:
 operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value, 
nullptr_t>::type
+>
+queue(_Container)
+-> queue;
+  
+template::value, 
nullptr_t>::type,
+ class = typename enable_if< __is_allocator<_Alloc>::value, 
nullptr_t>::type
+>
+queue(_Container, _Alloc)
+-> queue;
+#endif
+
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 bool
@@ -515,6 +551,36 @@ public:
__is_nothrow_swappable::value);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template ::value, 
nullptr_t>::type,
+  class = typename enable_if::value, 
nullptr_t>::type
+>
+priority_queue(_Compare, _Container)
+-> priority_queue;
+  
+template::value_type>,
+ class _Container = vector::value_type>,
+ class = typename enable_if< 
__is_input_iterator<_InputIterator>::value, nullptr_t>::type,
+ class = typename enable_if::value, 
nullptr_t>::type,
+ class = typename enable_if::value, 
nullptr_t>::type
+>
+priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), 
_Container = _Container())
+-> priority_queue::value_type, 
_Container, _Compare>;
+  
+template::value, 
nullptr_t>::type,
+ class = typename enable_if::value, 
nullptr_t>::type,
+ class = typename enable_if< __is_allocator<_Alloc>::value, 
nullptr_t>::type
+>
+priority_queue(_Compare, _Container, _Alloc)
+-> priority_queue;
+#endif
+
 template 
 inline
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& 
__comp,

Modified: libcxx/trunk/include/stack
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stack?rev=332927&r1=332926&r2=332927&view=diff
==
--- libcxx/trunk/include/stack (original)
+++ libcxx/trunk/include/stack Mon May 21 18:57:53 2018
@@ -61,6 +61,12 @@ public:
 void swap(stack& c) noexcept(is_nothrow_swappable_v)
 };
 
+template
+  stack(Container) -> stack;  // 
C++17
+  
+template 
+  stack(Container, Allocator) -> stack; // C++17
+
 template 
   bool operator==(const stack& x, const stack& y);
 template 
@@ -229,6 +235,22 @@ public:
 operator< (const stack& __x, const stack& __y);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value, 
nullptr_t>::type
+>
+stack(_Container)
+-> stack;
+  
+template::value, 
nullptr_t>::type,
+ class = typename enable_if< __is_allocator<_Alloc>::value, 
nullptr_t>::type
+ > 
+stack(_Container, _Alloc)
+-> stack;
+#endif
+
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 bool

Added: 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.fail.cpp?rev=332927&view=auto
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.fail.cpp
 Mon May 21 18:57:53

[libcxx] r332931 - Missed the tests for the deduction guides for prority_queue

2018-05-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 21 19:19:38 2018
New Revision: 332931

URL: http://llvm.org/viewvc/llvm-project?rev=332931&view=rev
Log:
Missed the tests for the deduction guides for prority_queue

Added:

libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.fail.cpp

libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp

Added: 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.fail.cpp?rev=332931&view=auto
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.fail.cpp
 Mon May 21 19:19:38 2018
@@ -0,0 +1,58 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+int main()
+{  
+//  Test the explicit deduction guides
+{
+//  queue(Compare, Container, const Alloc);
+//  The '45' is not an allocator
+std::priority_queue pri(std::greater(), std::deque({1,2,3}), 
45);  // expected-error {{no viable constructor or deduction guide for 
deduction of template arguments of 'priority_queue'}}
+}
+
+{
+//  queue(const queue&, const Alloc&);
+//  The '45' is not an allocator
+std::priority_queue source;
+std::priority_queue pri(source, 45);  // expected-error {{no viable 
constructor or deduction guide for deduction of template arguments of 
'priority_queue'}}
+}
+
+{
+//  priority_queue(Iter, Iter, Comp)  
+//  int is not an iterator
+std::priority_queue pri(15, 17, std::greater());  // 
expected-error {{no viable constructor or deduction guide for deduction of 
template arguments of 'priority_queue'}}
+}
+
+{
+//  priority_queue(Iter, Iter, Comp, Container)
+//  float is not an iterator
+std::priority_queue pri(23.f, 2.f, std::greater(), 
std::deque());   // expected-error {{no viable constructor or deduction 
guide for deduction of template arguments of 'priority_queue'}}
+}
+
+//  Test the implicit deduction guides
+{
+//  priority_queue (allocator &)
+std::priority_queue pri((std::allocator()));  // expected-error {{no 
viable constructor or deduction guide for deduction of template arguments of 
'priority_queue'}}
+//  Note: The extra parens are necessary, since otherwise clang decides it is 
a function declaration.
+//  Also, we can't use {} instead of parens, because that constructs a
+//  stack, allocator>>
+}
+
+}

Added: 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp?rev=332931&view=auto
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
 Mon May 21 19:19:38 2018
@@ -0,0 +1,123 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+// template
+// priority_queue(Compare, Container)
+// -> priority_queue;
+// 
+// template::value_type>,
+//  class Container = vector::value_type>>
+// priority_queue(InputIterator, InputIterator, Compare = Compare(), Container 
= Container())
+// -> priority_queue::value_type, 
Container, Compare>;
+// 
+// template
+// priority_queue(Compare, Container, Allocator)
+// -> priority_queue;
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include  // INT_MAX
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "test_allocator.h"
+
+struct A {};
+
+int main()
+{
+  
+//  Test the explicit deduction guides
+{
+std::vector v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+std::priority_queue pri(std::gr

[libcxx] r332996 - Change the names of two private methods: allocate -> __vallocate and deallocate -> __vdeallocate. NFC. This change triggered by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806, w

2018-05-22 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue May 22 09:20:28 2018
New Revision: 332996

URL: http://llvm.org/viewvc/llvm-project?rev=332996&view=rev
Log:
Change the names of two private methods: allocate -> __vallocate and deallocate 
-> __vdeallocate. NFC. This change triggered by 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806, which shows up when we 
implement deduction guides for the container adaptors.The names have a 'v' in 
them because WIN32 has a macro named __deallocate. (sigh).


Modified:
libcxx/trunk/include/vector

Modified: libcxx/trunk/include/vector
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=332996&r1=332995&r2=332996&view=diff
==
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Tue May 22 09:20:28 2018
@@ -781,8 +781,8 @@ public:
 private:
 _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
 _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer 
__new_last);
-void allocate(size_type __n);
-void deallocate() _NOEXCEPT;
+void __vallocate(size_type __n);
+void __vdeallocate() _NOEXCEPT;
 _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) 
const;
 void __construct_at_end(size_type __n);
 _LIBCPP_INLINE_VISIBILITY
@@ -951,7 +951,7 @@ vector<_Tp, _Allocator>::__swap_out_circ
 //  Postcondition:  size() == 0
 template 
 void
-vector<_Tp, _Allocator>::allocate(size_type __n)
+vector<_Tp, _Allocator>::__vallocate(size_type __n)
 {
 if (__n > max_size())
 this->__throw_length_error();
@@ -962,7 +962,7 @@ vector<_Tp, _Allocator>::allocate(size_t
 
 template 
 void
-vector<_Tp, _Allocator>::deallocate() _NOEXCEPT
+vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT
 {
 if (this->__begin_ != nullptr)
 {
@@ -1098,7 +1098,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 #endif
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__n);
 }
 }
@@ -1113,7 +1113,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 #endif
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__n);
 }
 }
@@ -1127,7 +1127,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 #endif
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__n, __x);
 }
 }
@@ -1141,7 +1141,7 @@ vector<_Tp, _Allocator>::vector(size_typ
 #endif
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__n, __x);
 }
 }
@@ -1195,7 +1195,7 @@ vector<_Tp, _Allocator>::vector(_Forward
 size_type __n = static_cast(_VSTD::distance(__first, __last));
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__first, __last, __n);
 }
 }
@@ -1215,7 +1215,7 @@ vector<_Tp, _Allocator>::vector(_Forward
 size_type __n = static_cast(_VSTD::distance(__first, __last));
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__first, __last, __n);
 }
 }
@@ -1230,7 +1230,7 @@ vector<_Tp, _Allocator>::vector(const ve
 size_type __n = __x.size();
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__x.__begin_, __x.__end_, __n);
 }
 }
@@ -1245,7 +1245,7 @@ vector<_Tp, _Allocator>::vector(const ve
 size_type __n = __x.size();
 if (__n > 0)
 {
-allocate(__n);
+__vallocate(__n);
 __construct_at_end(__x.__begin_, __x.__end_, __n);
 }
 }
@@ -1306,7 +1306,7 @@ vector<_Tp, _Allocator>::vector(initiali
 #endif
 if (__il.size() > 0)
 {
-allocate(__il.size());
+__vallocate(__il.size());
 __construct_at_end(__il.begin(), __il.end(), __il.size());
 }
 }
@@ -1321,7 +1321,7 @@ vector<_Tp, _Allocator>::vector(initiali
 #endif
 if (__il.size() > 0)
 {
-allocate(__il.size());
+__vallocate(__il.size());
 __construct_at_end(__il.begin(), __il.end(), __il.size());
 }
 }
@@ -1356,7 +1356,7 @@ void
 vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
 _NOEXCEPT_(is_nothrow_move_assignable::value)
 {
-deallocate();
+__vdeallocate();
 __base::__move_assign_alloc(__c); // this can throw
 this->__begin_ = __c.__begin_;
 this->__end_ = __c.__end_;
@@ -1431,8 +1431,8 @@ vector<_Tp, _Allocator>::assign(_Forward
 }
 else
 {
-deallocate();
-allocate(__recommend(__new_size));
+__vdeallocate();
+__vallocate(__recommend(__new_size));
 __construct_at_end(__first, __last, __new_size);
 }
 __invalidate_all_iterators();
@@ -1453,8 +1453,8 @@ vector<_Tp, _Allocator>::assign(size_typ
 }
 else
 {
-deallocate();
-allocate(__recommend(static_cast(__n)));
+__vdeallocate();
+__vallocate(__reco

[libcxx] r333050 - Implement deduction guides for basic_regex

2018-05-22 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue May 22 18:57:02 2018
New Revision: 333050

URL: http://llvm.org/viewvc/llvm-project?rev=333050&view=rev
Log:
Implement deduction guides for basic_regex

Added:
libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.fail.cpp
libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp
Modified:
libcxx/trunk/include/regex

Modified: libcxx/trunk/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=333050&r1=333049&r2=333050&view=diff
==
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Tue May 22 18:57:02 2018
@@ -192,6 +192,11 @@ public:
 void swap(basic_regex&);
 };
 
+template
+basic_regex(ForwardIterator, ForwardIterator,
+regex_constants::syntax_option_type = regex_constants::ECMAScript)
+-> basic_regex::value_type>; // 
C++17
+
 typedef basic_regexregex;
 typedef basic_regex wregex;
 
@@ -2922,6 +2927,15 @@ private:
 template  friend class __lookahead;
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template ::value, nullptr_t>::type
+>
+basic_regex(_ForwardIterator, _ForwardIterator,
+regex_constants::syntax_option_type = regex_constants::ECMAScript)
+-> basic_regex::value_type>;
+#endif
+
 template 
 const regex_constants::syntax_option_type basic_regex<_CharT, 
_Traits>::icase;
 template 

Added: libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.fail.cpp?rev=333050&view=auto
==
--- libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.fail.cpp (added)
+++ libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.fail.cpp Tue 
May 22 18:57:02 2018
@@ -0,0 +1,45 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template ::value_type>>
+//vector(InputIterator, InputIterator, Allocator = Allocator())
+//-> vector::value_type, 
Allocator>;
+//
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+int main()
+{  
+//  Test the explicit deduction guides
+{
+// basic_regex(ForwardIterator, ForwardIterator)
+//   is not an iterator
+std::basic_regex re(23, 34);   // expected-error {{no viable constructor 
or deduction guide for deduction of template arguments of 'basic_regex'}}
+}
+
+{
+// basic_regex(ForwardIterator, ForwardIterator, flag_type)
+//   is not an iterator
+std::basic_regex re(23.0, 34.0, std::regex_constants::basic);   // 
expected-error {{no viable constructor or deduction guide for deduction of 
template arguments of 'basic_regex'}}
+}
+
+//  Test the implicit deduction guides
+
+}

Added: libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp?rev=333050&view=auto
==
--- libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp (added)
+++ libcxx/trunk/test/std/re/re.regex/re.regex.construct/deduct.pass.cpp Tue 
May 22 18:57:02 2018
@@ -0,0 +1,137 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template
+// basic_regex(ForwardIterator, ForwardIterator,
+// regex_constants::syntax_option_type = 
regex_constants::ECMAScript)
+// -> basic_regex::value_type>;
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "test_allocator.h"
+
+using namespace std::literals;
+
+struct A {};
+
+int main()
+{
+  
+//  Test the explicit deduction guides
+{
+//  basic_regex(ForwardIterator, ForwardIterator)
+std::string s1("\\(a\\)");
+std::basic_regex re(s1.begin(), s1.end());
+
+static_assert(std::is_same_v>, "");
+assert(re.flags() == std::regex_constants::ECMAScript);
+assert(re.mark_count() == 0);
+}
+
+{
+std::wstring s1(L"\\(a\\)");
+std::basic_regex re(s1.begin

[libcxx] r333058 - Mark more bits of P0433 as complete.

2018-05-22 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue May 22 20:22:59 2018
New Revision: 333058

URL: http://llvm.org/viewvc/llvm-project?rev=333058&view=rev
Log:
Mark more bits of P0433 as complete.


Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=333058&r1=333057&r2=333058&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue May 22 20:22:59 2018
@@ -172,7 +172,7 @@
   
 
 The parts of P0607 that are not done are the  bits.
-So far, only the  part of P0433 has been 
implemented.
+So far, only the , sequence containers, container adaptors 
and  portions of P0433 have been implemented.
 
 [ Note: "Nothing to do" means that no library changes were needed to 
implement this change -- end note]
 
@@ -504,7 +504,7 @@
 
   
 
-  Last Updated: 8-Mar-2018
+  Last Updated: 22-May-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333251 - Add deduction guides for optional

2018-05-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 24 19:08:49 2018
New Revision: 333251

URL: http://llvm.org/viewvc/llvm-project?rev=333251&view=rev
Log:
Add deduction guides for optional

Added:

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
Modified:
libcxx/trunk/include/optional

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=333251&r1=333250&r2=333251&view=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Thu May 24 19:08:49 2018
@@ -139,6 +139,10 @@ namespace std {
   private:
 T *val; // exposition only
   };
+
+template
+  optional(T) -> optional;
+
 } // namespace std
 
 */
@@ -1003,6 +1007,11 @@ private:
 }
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template
+optional(T) -> optional;
+#endif
+
 // Comparisons between optionals
 template 
 _LIBCPP_INLINE_VISIBILITY constexpr

Added: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp?rev=333251&view=auto
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
 Thu May 24 19:08:49 2018
@@ -0,0 +1,38 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template
+//   optional(T) -> optional;
+
+
+#include 
+#include 
+
+struct A {};
+
+int main()
+{  
+//  Test the explicit deduction guides
+
+//  Test the implicit deduction guides
+{
+//  optional()
+std::optional opt;   // expected-error {{no viable constructor or 
deduction guide for deduction of template arguments of 'optional'}}
+}
+
+{
+//  optional(nullopt_t)
+std::optional opt(std::nullopt);   // expected-error-re@optional:* 
{{static_assert failed{{.*}} "instantiation of optional with nullopt_t is 
ill-formed"}}
+}
+}

Added: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp?rev=333251&view=auto
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 Thu May 24 19:08:49 2018
@@ -0,0 +1,44 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+
+// template
+//   optional(T) -> optional;
+
+
+#include 
+#include 
+
+struct A {};
+
+int main()
+{  
+//  Test the explicit deduction guides
+{
+// optional(T)
+std::optional opt(5);
+static_assert(std::is_same_v>, "");
+   assert(static_cast(opt));
+   assert(*opt == 5);
+}
+
+{
+// optional(T)
+std::optional opt(A{});
+static_assert(std::is_same_v>, "");
+   assert(static_cast(opt));
+}
+
+//  Test the implicit deduction guides
+
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333252 - Add one more test for optional

2018-05-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 24 19:22:54 2018
New Revision: 333252

URL: http://llvm.org/viewvc/llvm-project?rev=333252&view=rev
Log:
Add one more test for optional

Modified:

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp?rev=333252&r1=333251&r2=333252&view=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 Thu May 24 19:22:54 2018
@@ -25,20 +25,29 @@ int main()
 {  
 //  Test the explicit deduction guides
 {
-// optional(T)
+//  optional(T)
 std::optional opt(5);
 static_assert(std::is_same_v>, "");
-   assert(static_cast(opt));
-   assert(*opt == 5);
+assert(static_cast(opt));
+assert(*opt == 5);
 }
 
 {
-// optional(T)
+//  optional(T)
 std::optional opt(A{});
 static_assert(std::is_same_v>, "");
-   assert(static_cast(opt));
+assert(static_cast(opt));
 }
 
 //  Test the implicit deduction guides
 
+{
+//  optional(const optional &);
+std::optional source('A');
+std::optional opt(source);
+static_assert(std::is_same_v>, "");
+assert(static_cast(opt) == static_cast(source));
+assert(*opt == *source);
+}
+
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r333325 - Add nonnull; use it for atomics

2018-05-26 Thread Marshall Clow via cfe-commits
On Fri, May 25, 2018 at 4:43 PM, JF Bastien via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jfb
> Date: Fri May 25 16:43:53 2018
> New Revision: 25
>
> URL: http://llvm.org/viewvc/llvm-project?rev=25&view=rev
> Log:
> Add nonnull; use it for atomics
>
>
JF - please revert this patch.
Let's have a discussion about how to implement this so that it is more
friendly to people with installed code bases.
[ We've had *extremely* loud responses to unilaterally adding warnings -
especially ones that can't be easily disabled - to the libc++ code base in
the past. ]

Also, please include both myself and EricWF on all libc++ reviews.

-- Marshall
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333376 - Mark the template deduction tests as UNSUPPORTED on clang 5, because it deduces the wrong type.

2018-05-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 28 08:42:47 2018
New Revision: 76

URL: http://llvm.org/viewvc/llvm-project?rev=76&view=rev
Log:
Mark the template deduction tests as UNSUPPORTED on clang 5, because it deduces 
the wrong type.

Modified:

libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp?rev=76&r1=75&r2=76&view=diff
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
 Mon May 28 08:42:47 2018
@@ -9,8 +9,10 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: clang-5
 // UNSUPPORTED: libcpp-no-deduction-guides
-
+// Clang 5 will generate bad implicit deduction guides
+//  Specifically, for the copy constructor.
 
 // template
 //   queue(Container) -> queue;

Modified: 
libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp?rev=76&r1=75&r2=76&view=diff
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
 Mon May 28 08:42:47 2018
@@ -9,7 +9,10 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: clang-5
 // UNSUPPORTED: libcpp-no-deduction-guides
+// Clang 5 will generate bad implicit deduction guides
+// Specifically, for the copy constructor.
 
 
 // template


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333381 - Fix up the final bits of breakage due to clang v5 generating bad implicit template deduction guides - specifically for copy-ctors

2018-05-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon May 28 12:20:21 2018
New Revision: 81

URL: http://llvm.org/viewvc/llvm-project?rev=81&view=rev
Log:
Fix up the final bits of breakage due to clang v5 generating bad implicit 
template deduction guides - specifically for copy-ctors

Modified:
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp?rev=81&r1=80&r2=81&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/deduct.pass.cpp 
Mon May 28 12:20:21 2018
@@ -9,7 +9,10 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: clang-5
 // UNSUPPORTED: libcpp-no-deduction-guides
+// Clang 5 will generate bad implicit deduction guides
+// Specifically, for the copy constructor.
 
 
 // template 
@@ -51,8 +54,6 @@ int main()
 }
 
 //  Test the implicit deduction guides
-// FIXME broken: no matching constructor
-#if 0
   {
   std::array source = {4.0, 5.0};
   std::array arr(source);   // array(array)
@@ -61,5 +62,4 @@ int main()
 assert(arr[0] == 4.0);
 assert(arr[1] == 5.0);
   }
-#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp?rev=81&r1=80&r2=81&view=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp
 Mon May 28 12:20:21 2018
@@ -9,7 +9,10 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: clang-5
 // UNSUPPORTED: libcpp-no-deduction-guides
+// Clang 5 will generate bad implicit deduction guides
+//  Specifically, for the copy constructor.
 
 
 // template
@@ -28,7 +31,12 @@ int main()
 //  Test the implicit deduction guides
 {
 //  optional()
-std::optional opt;   // expected-error {{declaration of variable 'opt' 
with deduced type 'std::optional' requires an initializer}}
+std::optional opt;   // expected-error-re declaration of variable 
'opt' with deduced type 'std::optional' requires an initializer|no viable 
constructor or deduction guide for deduction of template arguments of 
'optional'
+//  clang-6 gives a bogus error here:
+//  declaration of variable 'opt' with deduced type 'std::optional' 
requires an initializer
+//  clang-7 (and later) give a better message:
+//  no viable constructor or deduction guide for deduction of template 
arguments of 'optional'
+//  So we check for one or the other.
 }
 
 {

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp?rev=81&r1=80&r2=81&view=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp
 Mon May 28 12:20:21 2018
@@ -9,7 +9,10 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: clang-5
 // UNSUPPORTED: libcpp-no-deduction-guides
+// Clang 5 will generate bad implicit deduction guides
+//  Specifically, for the copy constructor.
 
 
 // template
@@ -40,18 +43,12 @@ int main()
 }
 
 //  Test the implicit deduction guides
-
 {
-//  optional(const optional &);
-  // FIXME clang and GCC disagree about this!
-  // clang thinks opt is optional>, GCC thinks it's 
optional.
-#if 0
+//  optional(optional);
 std::optional source('A');
 std::optional opt(source);
-static_assert(std::is_same_v>>, "");
+static_assert(std::is_same_v>, "");
 assert(static_cast(opt) == static_cast(source));
 assert(*opt == *source);
-#endif
 }
-
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333435 - Mark __clear_and_shrink() as noexcept. This prevents the generation of a catch block and call to terminate in string's move assignment. Thanks to Howard for the 'catch'.

2018-05-29 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue May 29 10:04:37 2018
New Revision: 333435

URL: http://llvm.org/viewvc/llvm-project?rev=333435&view=rev
Log:
Mark __clear_and_shrink() as noexcept. This prevents the generation of a catch 
block and call to terminate in string's move assignment. Thanks to Howard for 
the 'catch'.

Modified:
libcxx/trunk/include/string

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=333435&r1=333434&r2=333435&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Tue May 29 10:04:37 2018
@@ -1259,7 +1259,7 @@ public:
 
 _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
 
-_LIBCPP_INLINE_VISIBILITY void __clear_and_shrink();
+_LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
 
 _LIBCPP_INLINE_VISIBILITY
 bool __is_long() const _NOEXCEPT
@@ -3585,7 +3585,7 @@ basic_string<_CharT, _Traits, _Allocator
 template
 inline _LIBCPP_INLINE_VISIBILITY
 void 
-basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink()
+basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
 {
 clear();
 if(__is_long())


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r333467 - Fix embarrasing typo in uncaught_exceptions. Update tests to really test this. Thanks to Peter Klotz for calling my attention to this.

2018-05-29 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue May 29 15:25:42 2018
New Revision: 333467

URL: http://llvm.org/viewvc/llvm-project?rev=333467&view=rev
Log:
Fix embarrasing typo in uncaught_exceptions. Update tests to really test this. 
Thanks to Peter Klotz for calling my attention to this.

Modified:
libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp

libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp

Modified: libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp?rev=333467&r1=333466&r2=333467&view=diff
==
--- libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp (original)
+++ libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp Tue May 29 
15:25:42 2018
@@ -18,7 +18,7 @@ bool uncaught_exception() _NOEXCEPT { re
 
 int uncaught_exceptions() _NOEXCEPT
 {
-# if _LIBCPPABI_VERSION > 1101
+# if _LIBCPPABI_VERSION > 1001
 return __cxa_uncaught_exceptions();
 # else
 return __cxa_uncaught_exception() ? 1 : 0;

Modified: 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp?rev=333467&r1=333466&r2=333467&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 Tue May 29 15:25:42 2018
@@ -15,40 +15,48 @@
 // XFAIL: availability=macosx10.9
 // XFAIL: availability=macosx10.10
 // XFAIL: availability=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.13
 
 // test uncaught_exceptions
 
 #include 
 #include 
 
-struct A
-{
-~A()
-{
-assert(std::uncaught_exceptions() > 0);
-}
-};
+struct Uncaught {
+Uncaught(int depth) : d_(depth) {}
+~Uncaught() { assert(std::uncaught_exceptions() == d_); }
+int d_;
+};
 
-struct B
-{
-B()
-{
-// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
-assert(std::uncaught_exceptions() == 0);
+struct Outer {
+Outer(int depth) : d_(depth) {}
+~Outer() {
+try {
+assert(std::uncaught_exceptions() == d_);
+Uncaught u(d_+1);
+throw 2;
 }
+catch (int) {}
+}
+int d_;
 };
 
-int main()
-{
-try
+int main () {
+assert(std::uncaught_exceptions() == 0);
 {
-A a;
-assert(std::uncaught_exceptions() == 0);
-throw B();
+Outer o(0);
 }
-catch (...)
+
+assert(std::uncaught_exceptions() == 0);
 {
-assert(std::uncaught_exception() == 0);
+try {
+Outer o(1);
+throw 1;
+}
+catch (int) {
+assert(std::uncaught_exceptions() == 0);
+}   
 }
 assert(std::uncaught_exceptions() == 0);
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r314940 - Initial cut at infastructure for fuzzing support for OSS-fuzz

2017-10-04 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  4 15:23:03 2017
New Revision: 314940

URL: http://llvm.org/viewvc/llvm-project?rev=314940&view=rev
Log:
Initial cut at infastructure for fuzzing support for OSS-fuzz

Added:
libcxx/trunk/fuzzing/
libcxx/trunk/fuzzing/fuzzing.cpp
libcxx/trunk/fuzzing/fuzzing.h
libcxx/trunk/test/libcxx/fuzzing/
libcxx/trunk/test/libcxx/fuzzing/nth_element.cpp
libcxx/trunk/test/libcxx/fuzzing/partial_sort.cpp
libcxx/trunk/test/libcxx/fuzzing/partition.cpp
libcxx/trunk/test/libcxx/fuzzing/sort.cpp
libcxx/trunk/test/libcxx/fuzzing/stable_partition.cpp
libcxx/trunk/test/libcxx/fuzzing/stable_sort.cpp

Added: libcxx/trunk/fuzzing/fuzzing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.cpp?rev=314940&view=auto
==
--- libcxx/trunk/fuzzing/fuzzing.cpp (added)
+++ libcxx/trunk/fuzzing/fuzzing.cpp Wed Oct  4 15:23:03 2017
@@ -0,0 +1,222 @@
+// -*- C++ -*-
+//===- fuzzing.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// A set of routines to use when fuzzing the algorithms in libc++
+// Each one tests a single algorithm.
+//
+// They all have the form of:
+// int `algorithm`(const uint8_t *data, size_t size);
+//
+// They perform the operation, and then check to see if the results are 
correct.
+// If so, they return zero, and non-zero otherwise.
+//
+// For example, sort calls std::sort, then checks two things:
+// (1) The resulting vector is sorted
+// (2) The resulting vector contains the same elements as the 
original data.
+
+
+
+#include "fuzzing.h"
+#include 
+#include 
+
+#include 
+
+// If we had C++14, we could use the four iterator version of 
is_permutation
+
+namespace fuzzing {
+
+// This is a struct we can use to test the stable_XXX algorithms.
+// perform the operation on the key, then check the order of the payload.
+
+struct stable_test {
+   uint8_t key;
+   uint8_t payload;
+   
+   stable_test(uint8_t k) : key(k), payload(0) {}
+   stable_test(uint8_t k, uint8_t p) : key(k), payload(p) {}
+   };
+
+void swap(stable_test &lhs, stable_test &rhs)
+{
+   using std::swap;
+   swap(lhs.key, rhs.key);
+   swap(lhs.payload, rhs.payload);
+}
+
+struct key_less
+{
+   bool operator () (const stable_test &lhs, const stable_test &rhs) const
+   {
+   return lhs.key < rhs.key;
+   }
+};
+
+struct payload_less
+{
+   bool operator () (const stable_test &lhs, const stable_test &rhs) const
+   {
+   return lhs.payload < rhs.payload;
+   }
+};
+
+struct total_less
+{
+   bool operator () (const stable_test &lhs, const stable_test &rhs) const
+   {
+   return lhs.key == rhs.key ? lhs.payload < rhs.payload : lhs.key 
< rhs.key;
+   }
+};
+
+bool operator==(const stable_test &lhs, const stable_test &rhs)
+{ 
+   return lhs.key == rhs.key && lhs.payload == rhs.payload;
+}
+
+
+template
+struct is_even
+{
+   bool operator () (const T &t) const
+   {
+   return t % 2 == 0;
+   }
+};
+
+
+template<>
+struct is_even
+{
+   bool operator () (const stable_test &t) const
+   {
+   return t.key % 2 == 0;
+   }
+};
+
+// == sort ==
+
+int sort(const uint8_t *data, size_t size)
+{
+   std::vector working(data, data + size);
+   std::sort(working.begin(), working.end());
+
+   if (!std::is_sorted(working.begin(), working.end())) return 1;
+   if (!std::is_permutation(data, data + size, working.begin())) return 99;
+   return 0;
+}
+
+
+// == stable_sort ==
+
+int stable_sort(const uint8_t *data, size_t size)
+{
+   std::vector input;
+   for (size_t i = 0; i < size; ++i)
+   input.push_back(stable_test(data[i], i));
+   std::vector working = input;
+   std::stable_sort(working.begin(), working.end(), key_less());
+
+   if (!std::is_sorted(working.begin(), working.end(), key_less()))   
return 1;
+   auto iter = working.begin();
+   while (iter != working.end())
+   {
+   auto range = std::equal_range(iter, working.end(), *iter, 
key_less());
+   if (!std::is_sorted(range.first, range.second, total_less())) 
return 2; 
+   iter = range.second;
+   }
+   if (!std::is_permutation(input.begin(), input.end(), working.begin())) 
return 99;
+   return 0;
+}
+
+// == partition ==
+
+int partition(const uint8_t *data, size_t size)
+{
+   std::vector working(data, data + size);
+   auto iter = std::partition(w

[libcxx] r315582 - More fuzzing infastructre - regex

2017-10-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Oct 12 07:48:09 2017
New Revision: 315582

URL: http://llvm.org/viewvc/llvm-project?rev=315582&view=rev
Log:
More fuzzing infastructre - regex

Added:
libcxx/trunk/test/libcxx/fuzzing/regex_ECMAScript.cpp
libcxx/trunk/test/libcxx/fuzzing/regex_POSIX.cpp
libcxx/trunk/test/libcxx/fuzzing/regex_awk.cpp
libcxx/trunk/test/libcxx/fuzzing/regex_egrep.cpp
libcxx/trunk/test/libcxx/fuzzing/regex_extended.cpp
libcxx/trunk/test/libcxx/fuzzing/regex_grep.cpp
Modified:
libcxx/trunk/fuzzing/fuzzing.cpp
libcxx/trunk/fuzzing/fuzzing.h

Modified: libcxx/trunk/fuzzing/fuzzing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.cpp?rev=315582&r1=315581&r2=315582&view=diff
==
--- libcxx/trunk/fuzzing/fuzzing.cpp (original)
+++ libcxx/trunk/fuzzing/fuzzing.cpp Thu Oct 12 07:48:09 2017
@@ -26,8 +26,7 @@
 #include "fuzzing.h"
 #include 
 #include 
-
-#include 
+#include 
 
 // If we had C++14, we could use the four iterator version of 
is_permutation
 
@@ -219,4 +218,59 @@ int partial_sort (const uint8_t *data, s
return 0;
 }
 
+
+// --  regex fuzzers
+
+static int regex_helper(const uint8_t *data, size_t size, 
std::regex::flag_type flag)
+{
+   if (size > 0)
+   {
+   try
+   {
+   std::string s((const char *)data, size);
+   std::regex re(s, flag);
+   return std::regex_match(s, re) ? 1 : 0;
+   } 
+   catch (std::regex_error &ex) {} 
+   }
+   return 0;   
+}
+
+
+int regex_ECMAScript (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::ECMAScript);
+   return 0;
+}
+
+int regex_POSIX (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::basic);
+   return 0;
+}
+
+int regex_extended (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::extended);
+   return 0;
+}
+
+int regex_awk (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::awk);
+   return 0;
+}
+
+int regex_grep (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::grep);
+   return 0;
+}
+
+int regex_egrep (const uint8_t *data, size_t size)
+{
+   (void) regex_helper(data, size, std::regex_constants::egrep);
+   return 0;
+}
+
 } // namespace fuzzing

Modified: libcxx/trunk/fuzzing/fuzzing.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.h?rev=315582&r1=315581&r2=315582&view=diff
==
--- libcxx/trunk/fuzzing/fuzzing.h (original)
+++ libcxx/trunk/fuzzing/fuzzing.h Thu Oct 12 07:48:09 2017
@@ -27,7 +27,15 @@ namespace fuzzing {
 
int nth_element  (const uint8_t *data, size_t size);
int partial_sort (const uint8_t *data, size_t size);
-   
+
+// Various flavors of regex
+   int regex_ECMAScript (const uint8_t *data, size_t size);
+   int regex_POSIX  (const uint8_t *data, size_t size);
+   int regex_extended   (const uint8_t *data, size_t size);
+   int regex_awk(const uint8_t *data, size_t size);
+   int regex_grep   (const uint8_t *data, size_t size);
+   int regex_egrep  (const uint8_t *data, size_t size);
+
 } // namespace fuzzing
 
 #endif // _LIBCPP_FUZZING

Added: libcxx/trunk/test/libcxx/fuzzing/regex_ECMAScript.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/fuzzing/regex_ECMAScript.cpp?rev=315582&view=auto
==
--- libcxx/trunk/test/libcxx/fuzzing/regex_ECMAScript.cpp (added)
+++ libcxx/trunk/test/libcxx/fuzzing/regex_ECMAScript.cpp Thu Oct 12 07:48:09 
2017
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===- regex_ECMAScript.cpp 
---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// XFAIL
+
+#include "fuzzing.h"
+#include 
+#include  // for strlen
+
+const char * test_cases[] = {
+   "",
+   "s",
+   "b*c",
+   "ba?sf"
+   "lka*ea",
+   "adsf*kas;lnc441[0-9]1r34525234"
+   };
+
+const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
+
+int main ()
+{
+   for (size_t i = 0; i < k_num_tests; ++i)
+   {
+   const size_t   size = std::strlen(test_cases[i]);
+   const uint8_t *data = (const uint8_t *) test_cases[i];
+   assert(0 == fuzzing::regex_ECMAScript(data, size));
+

[libcxx] r316095 - Fix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D37955

2017-10-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct 18 09:49:22 2017
New Revision: 316095

URL: http://llvm.org/viewvc/llvm-project?rev=316095&view=rev
Log:
Fix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as 
https://reviews.llvm.org/D37955

Added:

libcxx/trunk/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
Modified:
libcxx/trunk/include/regex

Modified: libcxx/trunk/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=316095&r1=316094&r2=316095&view=diff
==
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed Oct 18 09:49:22 2017
@@ -2409,17 +2409,28 @@ __bracket_expression<_CharT, _Traits>::_
 goto __exit;
 }
 }
-if (!__neg_chars_.empty())
+// set of "__found" chars =
+//   union(complement(union(__neg_chars_, __neg_mask_)),
+// other cases...)
+//
+// __neg_chars_ and __neg_mask_'d better be handled together, as there
+// are no short circuit opportunities.
+//
+// In addition, when __neg_mask_/__neg_chars_ is empty, they should be
+// treated as all ones/all chars.
 {
-for (size_t __i = 0; __i < __neg_chars_.size(); ++__i)
-{
-if (__ch == __neg_chars_[__i])
-goto __is_neg_char;
-}
+  const bool __in_neg_mask = (__neg_mask_ == 0) ||
+  __traits_.isctype(__ch, __neg_mask_);
+  const bool __in_neg_chars =
+  __neg_chars_.empty() ||
+  std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
+  __neg_chars_.end();
+  if (!(__in_neg_mask || __in_neg_chars))
+  {
 __found = true;
 goto __exit;
+  }
 }
-__is_neg_char:
 if (!__ranges_.empty())
 {
 string_type __s2 = __collate_ ?
@@ -2450,11 +2461,6 @@ __is_neg_char:
 {
 __found = true;
 goto __exit;
-}
-if (__neg_mask_ && !__traits_.isctype(__ch, __neg_mask_))
-{
-__found = true;
-goto __exit;
 }
 }
 else

Added: 
libcxx/trunk/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp?rev=316095&view=auto
==
--- 
libcxx/trunk/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp 
(added)
+++ 
libcxx/trunk/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp 
Wed Oct 18 09:49:22 2017
@@ -0,0 +1,29 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template 
+// bool
+// regex_search(BidirectionalIterator first, BidirectionalIterator last,
+//  match_results& m,
+//  const basic_regex& e,
+//  regex_constants::match_flag_type flags = 
regex_constants::match_default);
+
+#include 
+#include 
+#include "test_macros.h"
+
+// PR34310
+int main()
+{
+  assert(std::regex_search("HelloWorld", std::regex("[^\\W]")));
+  assert(std::regex_search("_", std::regex("[^\\W]")));
+  return 0;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316125 - Fix a think-o in the design of the stable_XXX sort tests; only shows up for test cases > 255 elements

2017-10-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct 18 13:40:57 2017
New Revision: 316125

URL: http://llvm.org/viewvc/llvm-project?rev=316125&view=rev
Log:
Fix a think-o in the design of the stable_XXX sort tests; only shows up for 
test cases > 255 elements

Modified:
libcxx/trunk/fuzzing/fuzzing.cpp

Modified: libcxx/trunk/fuzzing/fuzzing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.cpp?rev=316125&r1=316124&r2=316125&view=diff
==
--- libcxx/trunk/fuzzing/fuzzing.cpp (original)
+++ libcxx/trunk/fuzzing/fuzzing.cpp Wed Oct 18 13:40:57 2017
@@ -37,10 +37,10 @@ namespace fuzzing {
 
 struct stable_test {
uint8_t key;
-   uint8_t payload;
+   size_t payload;

stable_test(uint8_t k) : key(k), payload(0) {}
-   stable_test(uint8_t k, uint8_t p) : key(k), payload(p) {}
+   stable_test(uint8_t k, size_t p) : key(k), payload(p) {}
};
 
 void swap(stable_test &lhs, stable_test &rhs)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316172 - Fix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D39066

2017-10-19 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Oct 19 10:39:16 2017
New Revision: 316172

URL: http://llvm.org/viewvc/llvm-project?rev=316172&view=rev
Log:
Fix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. 
Reviewed as https://reviews.llvm.org/D39066

Added:
libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp
Modified:
libcxx/trunk/include/regex

Modified: libcxx/trunk/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=316172&r1=316171&r2=316172&view=diff
==
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Thu Oct 19 10:39:16 2017
@@ -4064,6 +4064,8 @@ basic_regex<_CharT, _Traits>::__parse_DU
  __first != __last && ( __val = __traits_.value(*__first, 10)) 
!= -1;
  ++__first)
 {
+if (__c >= std::numeric_limits::max() / 10)
+__throw_regex_error();
 __c *= 10;
 __c += __val;
 }

Added: libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp?rev=316172&view=auto
==
--- libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp (added)
+++ libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp Thu Oct 
19 10:39:16 2017
@@ -0,0 +1,40 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: c++03
+
+// the "n" in `a{n}` should be within the numeric limits.
+
+#include 
+#include 
+
+int main() {
+  for (std::regex_constants::syntax_option_type op :
+   {std::regex::basic, std::regex::grep}) {
+try {
+  (void)std::regex("a\\{10\\}", op);
+  assert(false);
+} catch (const std::regex_error &e) {
+  assert(e.code() == std::regex_constants::error_badbrace);
+}
+  }
+  for (std::regex_constants::syntax_option_type op :
+   {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+std::regex::awk}) {
+try {
+  (void)std::regex("a{10}", op);
+  assert(false);
+} catch (const std::regex_error &e) {
+  assert(e.code() == std::regex_constants::error_badbrace);
+}
+  }
+  return 0;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316191 - Fix an unsigned integer overflow in regex that lead to a bad memory access. Found by OSS-Fuzz

2017-10-19 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Oct 19 15:10:41 2017
New Revision: 316191

URL: http://llvm.org/viewvc/llvm-project?rev=316191&view=rev
Log:
Fix an unsigned integer overflow in regex that lead to a bad memory access. 
Found by OSS-Fuzz

Modified:
libcxx/trunk/include/regex
libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp

Modified: libcxx/trunk/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=316191&r1=316190&r2=316191&view=diff
==
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Thu Oct 19 15:10:41 2017
@@ -4327,8 +4327,12 @@ basic_regex<_CharT, _Traits>::__parse_de
 unsigned __v = *__first - '0';
 for (++__first;
 __first != __last && '0' <= *__first && *__first <= '9'; 
++__first)
+{
+if (__v >= std::numeric_limits::max() / 10)
+__throw_regex_error();
 __v = 10 * __v + *__first - '0';
-if (__v > mark_count())
+}
+if (__v == 0 || __v > mark_count())
 __throw_regex_error();
 __push_back_ref(__v);
 }
@@ -5455,15 +5459,17 @@ match_results<_BidirectionalIterator, _A
 if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
 {
 ++__fmt_first;
-size_t __i = *__fmt_first - '0';
+size_t __idx = *__fmt_first - '0';
 if (__fmt_first + 1 != __fmt_last &&
 '0' <= __fmt_first[1] && __fmt_first[1] <= '9')
 {
 ++__fmt_first;
-__i = 10 * __i + *__fmt_first - '0';
+if (__idx >= std::numeric_limits::max() / 
10)
+
__throw_regex_error();
+__idx = 10 * __idx + *__fmt_first - '0';
 }
-__output = _VSTD::copy((*this)[__i].first,
-(*this)[__i].second, __output);
+__output = _VSTD::copy((*this)[__idx].first,
+(*this)[__idx].second, __output);
 }
 else
 {

Modified: 
libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp?rev=316191&r1=316190&r2=316191&view=diff
==
--- libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp 
(original)
+++ libcxx/trunk/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp 
Thu Oct 19 15:10:41 2017
@@ -34,6 +34,7 @@ int main()
 {
 assert(error_badbackref_thrown("\\1abc"));  // no references
 assert(error_badbackref_thrown("ab(c)\\2def")); // only one reference
+assert(error_badbackref_thrown("\\80")); // 
overflows
 
 //  this should NOT throw, because we only should look at the '1'
 //  See https://bugs.llvm.org/show_bug.cgi?id=31387


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316343 - Fix misguided error message in debug mode. No functional change. Fixes PR#34966

2017-10-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct 23 09:46:44 2017
New Revision: 316343

URL: http://llvm.org/viewvc/llvm-project?rev=316343&view=rev
Log:
Fix misguided error message in debug mode. No functional change. Fixes PR#34966

Modified:
libcxx/trunk/include/list

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=316343&r1=316342&r2=316343&view=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Mon Oct 23 09:46:44 2017
@@ -481,7 +481,7 @@ public:
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
-   "Attempted to dereference a non-dereferenceable 
list::iterator");
+   "Attempted to dereference a non-dereferenceable 
list::const_iterator");
 #endif
 return 
pointer_traits::pointer_to(__ptr_->__as_node()->__value_);
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316394 - More fuzzing interfaces

2017-10-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct 23 16:19:30 2017
New Revision: 316394

URL: http://llvm.org/viewvc/llvm-project?rev=316394&view=rev
Log:
More fuzzing interfaces

Added:
libcxx/trunk/fuzzing/RoutineNames.txt
Modified:
libcxx/trunk/fuzzing/fuzzing.cpp
libcxx/trunk/fuzzing/fuzzing.h

Added: libcxx/trunk/fuzzing/RoutineNames.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/RoutineNames.txt?rev=316394&view=auto
==
--- libcxx/trunk/fuzzing/RoutineNames.txt (added)
+++ libcxx/trunk/fuzzing/RoutineNames.txt Mon Oct 23 16:19:30 2017
@@ -0,0 +1,16 @@
+sort
+stable_sort
+partition
+stable_partition
+nth_element
+partial_sort
+make_heap
+push_heap
+pop_heap
+regex_ECMAScript
+regex_POSIX
+regex_extended
+regex_awk
+regex_grep
+regex_egrep
+search

Modified: libcxx/trunk/fuzzing/fuzzing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.cpp?rev=316394&r1=316393&r2=316394&view=diff
==
--- libcxx/trunk/fuzzing/fuzzing.cpp (original)
+++ libcxx/trunk/fuzzing/fuzzing.cpp Mon Oct 23 16:19:30 2017
@@ -26,9 +26,12 @@
 #include "fuzzing.h"
 #include 
 #include 
+#include 
 #include 
 
-// If we had C++14, we could use the four iterator version of 
is_permutation
+#include 
+
+// If we had C++14, we could use the four iterator version of 
is_permutation and equal
 
 namespace fuzzing {
 
@@ -273,4 +276,101 @@ int regex_egrep (const uint8_t *data, si
return 0;
 }
 
+// --  heap fuzzers
+int make_heap (const uint8_t *data, size_t size)
+{
+   std::vector working(data, data + size);
+   std::make_heap(working.begin(), working.end());
+
+   if (!std::is_heap(working.begin(), working.end())) return 1;
+   if (!std::is_permutation(data, data + size, working.begin())) return 99;
+   return 0;
+}
+
+int push_heap (const uint8_t *data, size_t size)
+{
+   if (size < 2) return 0;
+
+// Make a heap from the first half of the data
+   std::vector working(data, data + size);
+   auto iter = working.begin() + (size / 2);
+   std::make_heap(working.begin(), iter);
+   if (!std::is_heap(working.begin(), iter)) return 1;
+
+// Now push the rest onto the heap, one at a time
+   ++iter;
+   for (; iter != working.end(); ++iter) {
+   std::push_heap(working.begin(), iter);
+   if (!std::is_heap(working.begin(), iter)) return 2; 
+   }
+
+   if (!std::is_permutation(data, data + size, working.begin())) return 99;
+   return 0;
+}
+
+int pop_heap (const uint8_t *data, size_t size)
+{
+   if (size < 2) return 0;
+   std::vector working(data, data + size);
+   std::make_heap(working.begin(), working.end());
+
+// Pop things off, one at a time
+   auto iter = --working.end();
+   while (iter != working.begin()) {
+   std::pop_heap(working.begin(), iter);
+   if (!std::is_heap(working.begin(), --iter)) return 2;   
+   }
+
+   return 0;
+}
+
+
+// --  search fuzzers
+int search (const uint8_t *data, size_t size)
+{
+   if (size < 2) return 0;
+   
+   const size_t pat_size = data[0] * (size - 1) / 
std::numeric_limits::max();
+   assert(pat_size <= size - 1);
+   const uint8_t *pat_begin = data + 1;
+   const uint8_t *pat_end   = pat_begin + pat_size;
+   const uint8_t *data_end  = data + size;
+   assert(pat_end <= data_end);
+// std::cerr << "data[0] = " << size_t(data[0]) << " ";
+// std::cerr << "Pattern size = " << pat_size << "; corpus is " << size - 
1 << std::endl;
+   auto it = std::search(pat_end, data_end, pat_begin, pat_end);
+   if (it != data_end) // not found
+   if (!std::equal(pat_begin, pat_end, it))
+   return 1;
+   return 0;
+}
+
+template 
+static int search_helper (const uint8_t *data, size_t size)
+{
+   if (size < 2) return 0;
+   
+   const size_t pat_size = data[0] * (size - 1) / 
std::numeric_limits::max();
+   const uint8_t *pat_begin = data + 1;
+   const uint8_t *pat_end   = pat_begin + pat_size;
+   const uint8_t *data_end  = data + size;
+
+   auto it = std::search(pat_end, data_end, S(pat_begin, pat_end));
+   if (it != data_end) // not found
+   if (!std::equal(pat_begin, pat_end, it))
+   return 1;
+   return 0;
+}
+
+// These are still in std::experimental
+// int search_boyer_moore (const uint8_t *data, size_t size)
+// {
+// return search_helper>(data, 
size);
+// }
+// 
+// int search_boyer_moore_horspool (const uint8_t *data, size_t size)
+// {
+// return search_helper>(data, size);
+// }
+
 } // namespace fuzzing

Modified: libcxx/trunk/fuzzing/fuzzing.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/fuzzing/fuzzing.h?rev=316394&r1=316393&r2=316394&view=diff
===

[libcxx] r316439 - Mark string_view literals as 'noexcept'. Fixes PR#25054. Thanks to Pavel K for the bug report.

2017-10-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Oct 24 07:06:00 2017
New Revision: 316439

URL: http://llvm.org/viewvc/llvm-project?rev=316439&view=rev
Log:
Mark string_view literals as 'noexcept'. Fixes PR#25054. Thanks to Pavel K for 
the bug report.

Modified:
libcxx/trunk/include/string_view

libcxx/trunk/test/std/strings/string.view/string_view.literals/literal.pass.cpp

Modified: libcxx/trunk/include/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=316439&r1=316438&r2=316439&view=diff
==
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Tue Oct 24 07:06:00 2017
@@ -155,10 +155,10 @@ namespace std {
   template <> struct hash;
   template <> struct hash;
 
-  constexpr basic_string operator "" s( const char *str, size_t 
len ); // C++17
-  constexpr basic_string  operator "" s( const wchar_t *str,  size_t 
len ); // C++17
-  constexpr basic_string operator "" s( const char16_t *str, size_t 
len ); // C++17
-  constexpr basic_string operator "" s( const char32_t *str, size_t 
len ); // C++17
+  constexpr basic_string_view operator "" sv( const char *str, 
size_t len ) noexcept;
+  constexpr basic_string_view  operator "" sv( const wchar_t *str,  
size_t len ) noexcept;
+  constexpr basic_string_view operator "" sv( const char16_t *str, 
size_t len ) noexcept;
+  constexpr basic_string_view operator "" sv( const char32_t *str, 
size_t len ) noexcept;
 
 }  // namespace std
 
@@ -760,25 +760,25 @@ inline namespace literals
   inline namespace string_view_literals
   {
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-basic_string_view operator "" sv(const char *__str, size_t __len)
+basic_string_view operator "" sv(const char *__str, size_t __len) 
_NOEXCEPT
 {
 return basic_string_view (__str, __len);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-basic_string_view operator "" sv(const wchar_t *__str, size_t 
__len)
+basic_string_view operator "" sv(const wchar_t *__str, size_t 
__len) _NOEXCEPT
 {
 return basic_string_view (__str, __len);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-basic_string_view operator "" sv(const char16_t *__str, size_t 
__len)
+basic_string_view operator "" sv(const char16_t *__str, size_t 
__len) _NOEXCEPT
 {
 return basic_string_view (__str, __len);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-basic_string_view operator "" sv(const char32_t *__str, size_t 
__len)
+basic_string_view operator "" sv(const char32_t *__str, size_t 
__len) _NOEXCEPT
 {
 return basic_string_view (__str, __len);
 }

Modified: 
libcxx/trunk/test/std/strings/string.view/string_view.literals/literal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string_view.literals/literal.pass.cpp?rev=316439&r1=316438&r2=316439&view=diff
==
--- 
libcxx/trunk/test/std/strings/string.view/string_view.literals/literal.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/strings/string.view/string_view.literals/literal.pass.cpp 
Tue Oct 24 07:06:00 2017
@@ -54,4 +54,10 @@ int main()
 static_assert( L"ABC"sv.size() == 3, "");
 static_assert( u"ABC"sv.size() == 3, "");
 static_assert( U"ABC"sv.size() == 3, "");
+
+static_assert(noexcept(  "ABC"sv), "");
+static_assert(noexcept(u8"ABC"sv), "");
+static_assert(noexcept( L"ABC"sv), "");
+static_assert(noexcept( u"ABC"sv), "");
+static_assert(noexcept( U"ABC"sv), "");
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r316456 - Mark string_view's constructor from (ptr, len) as noexcept (an extension). Update the tests to check this (and other noexcept bits

2017-10-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Oct 24 09:30:06 2017
New Revision: 316456

URL: http://llvm.org/viewvc/llvm-project?rev=316456&view=rev
Log:
Mark string_view's constructor from (ptr,len) as noexcept (an extension). 
Update the tests to check this (and other noexcept bits

Modified:
libcxx/trunk/include/string_view
libcxx/trunk/test/std/strings/string.view/string.view.cons/default.pass.cpp

libcxx/trunk/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp

libcxx/trunk/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp

libcxx/trunk/test/std/strings/string.view/string.view.cons/from_string.pass.cpp

Modified: libcxx/trunk/include/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=316456&r1=316455&r2=316456&view=diff
==
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Tue Oct 24 09:30:06 2017
@@ -216,7 +216,7 @@ public:
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = 
default;
 
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-   basic_string_view(const _CharT* __s, size_type __len)
+   basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
: __data(__s), __size(__len)
{
 // #if _LIBCPP_STD_VER > 11

Modified: 
libcxx/trunk/test/std/strings/string.view/string.view.cons/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.cons/default.pass.cpp?rev=316456&r1=316455&r2=316456&view=diff
==
--- libcxx/trunk/test/std/strings/string.view/string.view.cons/default.pass.cpp 
(original)
+++ libcxx/trunk/test/std/strings/string.view/string.view.cons/default.pass.cpp 
Tue Oct 24 09:30:06 2017
@@ -21,6 +21,8 @@ template
 void test () {
 #if TEST_STD_VER > 11
 {
+ASSERT_NOEXCEPT(T());
+
 constexpr T sv1;
 static_assert ( sv1.size() == 0, "" );
 static_assert ( sv1.empty(), "");

Modified: 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp?rev=316456&r1=316455&r2=316456&view=diff
==
--- 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
 Tue Oct 24 09:30:06 2017
@@ -30,7 +30,11 @@ size_t StrLen ( const CharT *s ) {
 
 template
 void test ( const CharT *s ) {
-std::basic_string_view sv1 ( s );
+typedef std::basic_string_view SV;
+//  I'd love to do this, but it would require traits::length() to be noexcept
+//  LIBCPP_ASSERT_NOEXCEPT(SV(s));
+
+SV sv1 ( s );
 assert ( sv1.size() == StrLen( s ));
 assert ( sv1.data() == s );
 }

Modified: 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp?rev=316456&r1=316455&r2=316456&view=diff
==
--- 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
 Tue Oct 24 09:30:06 2017
@@ -23,7 +23,10 @@
 template
 void test ( const CharT *s, size_t sz ) {
 {
-std::basic_string_view sv1 ( s, sz );
+typedef std::basic_string_view SV;
+LIBCPP_ASSERT_NOEXCEPT(SV(s, sz));
+
+SV sv1 ( s, sz );
 assert ( sv1.size() == sz );
 assert ( sv1.data() == s );
 }

Modified: 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.cons/from_string.pass.cpp?rev=316456&r1=316455&r2=316456&view=diff
==
--- 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_string.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/strings/string.view/string.view.cons/from_string.pass.cpp 
Tue Oct 24 09:30:06 2017
@@ -24,7 +24,10 @@ struct dummy_char_traits : public std::c
 
 template
 void test ( const std::basic_string &str ) {
-std::basic_string_view sv1 ( str );
+typedef std::basic_string_view SV;
+ASSERT_NOEXCEPT(SV(str));
+
+SV sv1 ( str );
 assert ( sv1.size() == str.size());
 assert ( sv1.data() == str.data());
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r340752 - Mark P0556 as 'in progress'

2018-08-27 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Aug 27 09:07:01 2018
New Revision: 340752

URL: http://llvm.org/viewvc/llvm-project?rev=340752&view=rev
Log:
Mark P0556 as 'in progress'


Modified:
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=340752&r1=340751&r2=340752&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Mon Aug 27 09:07:01 2018
@@ -89,7 +89,7 @@
https://wg21.link/P0476R2";>P0476R2LWGBit-casting 
object representationsRapperswil
https://wg21.link/P0528R3";>P0528R3CWGThe Curious 
Case of Padding Bits, Featuring Atomic 
Compare-and-ExchangeRapperswil
https://wg21.link/P0542R5";>P0542R5CWGSupport for 
contract based programming in C++Rapperswil
-   https://wg21.link/P0556R3";>P0556R3LWGIntegral 
power-of-2 operationsRapperswil
+   https://wg21.link/P0556R3";>P0556R3LWGIntegral 
power-of-2 operationsRapperswilIn 
Progress
https://wg21.link/P0619R4";>P0619R4LWGReviewing 
Deprecated Facilities of C++17 for 
C++20Rapperswil
https://wg21.link/P0646R1";>P0646R1LWGImproving the 
Return Value of Erase-Like 
AlgorithmsRapperswil
https://wg21.link/P0722R3";>P0722R3CWGEfficient 
sized delete for variable sized 
classesRapperswil
@@ -222,7 +222,7 @@
 
   
 
-  Last Updated: 1-Aug-2018
+  Last Updated: 27-Aug-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r340823 - Use addressof instead of operator& in make_shared. Fixes PR38729. As a drive-by, make the same change in raw_storage_iterator (twice).

2018-08-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Aug 28 06:29:30 2018
New Revision: 340823

URL: http://llvm.org/viewvc/llvm-project?rev=340823&view=rev
Log:
Use addressof instead of operator& in make_shared. Fixes PR38729. As a 
drive-by, make the same change in raw_storage_iterator (twice).

Modified:
libcxx/trunk/include/memory

libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp

libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=340823&r1=340822&r2=340823&view=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Tue Aug 28 06:29:30 2018
@@ -1989,10 +1989,10 @@ public:
 _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator 
__x) : __x_(__x) {}
 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& 
__element)
-{::new(&*__x_) _Tp(__element); return *this;}
+{::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
 #if _LIBCPP_STD_VER >= 14
 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
-{::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+{::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return 
*this;}
 #endif
 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; 
return *this;}
 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
@@ -3682,7 +3682,7 @@ private:
 virtual void __on_zero_shared_weak() _NOEXCEPT;
 public:
 _LIBCPP_INLINE_VISIBILITY
-_Tp* get() _NOEXCEPT {return &__data_.second();}
+_Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());}
 };
 
 template 

Modified: 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp?rev=340823&r1=340822&r2=340823&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
 Tue Aug 28 06:29:30 2018
@@ -15,6 +15,13 @@
 
 #include "test_macros.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
+
 int A_constructed = 0;
 
 struct A
@@ -27,6 +34,7 @@ public:
 ~A() {--A_constructed; data_ = 0;}
 
 bool operator==(int i) const {return data_ == i;}
+A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp?rev=340823&r1=340822&r2=340823&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
 Tue Aug 28 06:29:30 2018
@@ -16,6 +16,12 @@
 #include "test_macros.h"
 #include 
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 int A_constructed = 0;
 
 struct A
@@ -28,6 +34,7 @@ public:
 ~A() {--A_constructed; data_ = 0;}
 
 bool operator==(int i) const {return data_ == i;}
+A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp?rev=340823&r1=340822&r2=340823&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
 Tue Aug 28 06:29:30 2018
@@ -23,6 +23,12 @@
 #include "test_allocator.h"
 #include "min_allocator.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION

[libcxx] r340992 - Last week, someone noted that a couple of the time_point member functions were not constexpr. I looked, and they were right. They were made constexpr in p0505, so I looked at all th

2018-08-29 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Aug 29 16:02:15 2018
New Revision: 340992

URL: http://llvm.org/viewvc/llvm-project?rev=340992&view=rev
Log:
Last week, someone noted that a couple of the time_point member functions were 
not constexpr. I looked, and they were right. They were made constexpr in 
p0505, so I looked at all the other bits in that paper to make sure that I 
didn't miss anything else. There were a couple methods in the synopsis that 
should have been marked constexpr, but the code was correct.

Modified:
libcxx/trunk/include/chrono

libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp

libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp

Modified: libcxx/trunk/include/chrono
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=340992&r1=340991&r2=340992&view=diff
==
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Wed Aug 29 16:02:15 2018
@@ -77,16 +77,18 @@ public:
 
 constexpr common_type::type  operator+() const;
 constexpr common_type::type  operator-() const;
-constexpr duration& operator++();
-constexpr duration  operator++(int);
-constexpr duration& operator--();
-constexpr duration  operator--(int);
-
-constexpr duration& operator+=(const duration& d);
-constexpr duration& operator-=(const duration& d);
-
-duration& operator*=(const rep& rhs);
-duration& operator/=(const rep& rhs);
+constexpr duration& operator++();// constexpr in C++17
+constexpr duration  operator++(int); // constexpr in C++17
+constexpr duration& operator--();// constexpr in C++17
+constexpr duration  operator--(int); // constexpr in C++17
+
+constexpr duration& operator+=(const duration& d);  // constexpr in C++17
+constexpr duration& operator-=(const duration& d);  // constexpr in C++17
+
+duration& operator*=(const rep& rhs);   // constexpr in C++17
+duration& operator/=(const rep& rhs);   // constexpr in C++17
+duration& operator%=(const rep& rhs);   // constexpr in C++17
+duration& operator%=(const duration& rhs);  // constexpr in C++17
 
 // special values
 
@@ -127,8 +129,8 @@ public:
 
 // arithmetic
 
-time_point& operator+=(const duration& d);
-time_point& operator-=(const duration& d);
+time_point& operator+=(const duration& d); // constexpr in C++17
+time_point& operator-=(const duration& d); // constexpr in C++17
 
 // special values
 
@@ -1355,8 +1357,8 @@ public:
 
 // arithmetic
 
-_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) 
{__d_ += __d; return *this;}
-_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) 
{__d_ -= __d; return *this;}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& 
operator+=(const duration& __d) {__d_ += __d; return *this;}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& 
operator-=(const duration& __d) {__d_ -= __d; return *this;}
 
 // special values
 

Modified: 
libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_%2B%3D.pass.cpp?rev=340992&r1=340991&r2=340992&view=diff
==
--- 
libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
 Wed Aug 29 16:02:15 2018
@@ -12,15 +12,35 @@
 // time_point
 
 // time_point& operator+=(const duration& d);
+// constexpr in c++17
 
 #include 
 #include 
 
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool constexpr_test()
+{
+typedef std::chrono::system_clock Clock;
+typedef std::chrono::milliseconds Duration;
+std::chrono::time_point t(Duration(5));
+t += Duration(4);
+return t.time_since_epoch() == Duration(9);
+}
+#endif
+
 int main()
 {
+{
 typedef std::chrono::system_clock Clock;
 typedef std::chrono::milliseconds Duration;
 std::chrono::time_point t(Duration(3));
 t += Duration(2);
 assert(t.time_since_epoch() == Duration(5));
+}
+
+#if TEST_STD_VER > 14
+static_assert(constexpr_test(), "");
+#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_-%3D.pass.cpp?rev=340992&r1=340991&r2=340992&view=diff
==
--- 
libcxx/trunk/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/time/time.point/tim

[libcxx] r341671 - [asan] Update a vector's storage annotation during destruction. Reviewed as https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch.

2018-09-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Sep  7 08:47:59 2018
New Revision: 341671

URL: http://llvm.org/viewvc/llvm-project?rev=341671&view=rev
Log:
[asan] Update a vector's storage annotation during destruction. Reviewed as 
https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch.

Modified:
libcxx/trunk/include/vector

Modified: libcxx/trunk/include/vector
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=341671&r1=341670&r2=341671&view=diff
==
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Fri Sep  7 08:47:59 2018
@@ -540,13 +540,14 @@ public:
 value_type,
 typename 
iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
 
-#if _LIBCPP_DEBUG_LEVEL >= 2
 _LIBCPP_INLINE_VISIBILITY
 ~vector()
 {
+__annotate_delete();
+#if _LIBCPP_DEBUG_LEVEL >= 2
 __get_db()->__erase_c(this);
-}
 #endif
+}
 
 vector(const vector& __x);
 vector(const vector& __x, const allocator_type& __a);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r341975 - Fix PR# 38900 - don't call swap inside of random_shuffle when we'd be swapping an element with itself

2018-09-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Sep 11 11:33:45 2018
New Revision: 341975

URL: http://llvm.org/viewvc/llvm-project?rev=341975&view=rev
Log:
Fix PR# 38900 - don't call swap inside of random_shuffle when we'd be swapping 
an element with itself

Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=341975&r1=341974&r2=341975&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Tue Sep 11 11:33:45 2018
@@ -2987,7 +2987,8 @@ random_shuffle(_RandomAccessIterator __f
 for (--__last; __first < __last; ++__first, --__d)
 {
 difference_type __i = __rand(__d);
-swap(*__first, *(__first + __i));
+if (__i != difference_type(0))
+   swap(*__first, *(__first + __i));
 }
 }
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r341990 - Update the synopsis for . NFC

2018-09-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Sep 11 13:51:54 2018
New Revision: 341990

URL: http://llvm.org/viewvc/llvm-project?rev=341990&view=rev
Log:
Update the synopsis for . NFC

Modified:
libcxx/trunk/include/version

Modified: libcxx/trunk/include/version
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/version?rev=341990&r1=341989&r2=341990&view=diff
==
--- libcxx/trunk/include/version (original)
+++ libcxx/trunk/include/version Tue Sep 11 13:51:54 2018
@@ -14,6 +14,85 @@
 /*
 version synopsis
 
+Table 35 — Standard library feature-test macros
+Macro name  Value   Headers
+__cpp_lib_addressof_constexpr   201603L 
+__cpp_lib_allocator_traits_is_always_equal  201411L  
  
+  
 
+  
 
+__cpp_lib_any   201606L 
+__cpp_lib_apply 201603L 
+__cpp_lib_array_constexpr   201603L  
+__cpp_lib_as_const  201510L 
+__cpp_lib_atomic_is_always_lock_free201603L 
+__cpp_lib_atomic_ref201806L 
+__cpp_lib_bit_cast  201806L 
+__cpp_lib_bool_constant 201505L 
+__cpp_lib_boyer_moore_searcher  201603L 
+__cpp_lib_byte  201603L 
+__cpp_lib_chrono201611L 
+__cpp_lib_clamp 201603L 
+__cpp_lib_complex_udls  201309L 
+__cpp_lib_concepts  201806L 
+__cpp_lib_constexpr_swap_algorithms 201806L 
+__cpp_lib_enable_shared_from_this   201603L 
+__cpp_lib_exchange_function 201304L 
+__cpp_lib_execution 201603L 
+__cpp_lib_filesystem201703L 
+__cpp_lib_gcd_lcm   201606L 
+__cpp_lib_generic_associative_lookup201304L  
+__cpp_lib_hardware_interference_size201703L 
+__cpp_lib_has_unique_object_representations 201606L 
+__cpp_lib_hypot 201603L 
+__cpp_lib_incomplete_container_elements 201505L   

+__cpp_lib_integer_sequence  201304L 
+__cpp_lib_integral_constant_callable201304L 
+__cpp_lib_invoke201411L 
+__cpp_lib_is_aggregate  201703L 
+__cpp_lib_is_final  201402L 
+__cpp_lib_is_invocable  201703L 
+__cpp_lib_is_null_pointer   201309L 
+__cpp_lib_is_swappable  201603L 
+__cpp_lib_launder   201606L 
+__cpp_lib_list_remove_return_type   201806L  
+__cpp_lib_logical_traits201510L 
+__cpp_lib_make_from_tuple   201606L 
+__cpp_lib_make_reverse_iterator 201402L 
+__cpp_lib_make_unique   201304L 
+__cpp_lib_map_try_emplace   201411L 
+__cpp_lib_math_special_functions201603L 
+__cpp_lib_memory_resource   201603L 
+__cpp_lib_node_extract  201606L   
 
+__cpp_lib_nonmember_container_access201411L

+

+ 
 
+__cpp_lib_not_fn201603L 
+__cpp_lib_null_iterators201304L 
+__cpp_lib_optional  201606L 
+__cpp_lib_parallel_algorithm201603L  
+__cpp_lib_quoted_string_io  201304L 
+__cpp_lib_raw_memory_algorithms 201606L 
+__cpp_lib_result_of_sfinae  201210L  
+__cpp_lib_robust_nonmodifying_seq_ops   201304L 
+__cpp_lib_sample201603L 
+__cpp_lib_scoped_lock   201703L 
+__cpp_lib_shared_mutex  201505L 
+__cpp_lib_shared_ptr_arrays 201611L 
+__cpp_lib_shared_ptr_weak_type  201606L 
+__cpp_lib_shared_timed_mutex201402L 
+__cpp_lib_string_udls   201304L 
+__cpp_lib_string_view   201606L  
+__cpp_lib_to_chars  201611L 
+__cpp_lib_transformation_trait_aliases  201304L 
+__cpp_lib_transparent_operators 201510L  
+__cpp_lib_tuple_element_t   201402L 
+__cpp_lib_tuples_by_type201304L  
+__cpp_lib_type_trait_variable_templates 201510L 
+__cpp_lib_uncaught_exceptions   201411L 
+__cpp_lib_unordered_map_try_emplace 201411L 
+__cpp_lib_variant   201606L 
+__cpp_lib_void_t201411L 
+
 */
 
 #include <__config>


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.o

[libcxx] r342057 - Implement LWG #3017. list splice functions should use addressof

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 07:46:17 2018
New Revision: 342057

URL: http://llvm.org/viewvc/llvm-project?rev=342057&view=rev
Log:
Implement LWG #3017. list splice functions should use addressof

Modified:
libcxx/trunk/include/list
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/list
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=342057&r1=342056&r2=342057&view=diff
==
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Wed Sep 12 07:46:17 2018
@@ -2208,7 +2208,7 @@ template 
 void
 list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
 {
-if (this != &__c)
+if (this != _VSTD::addressof(__c))
 {
 iterator __f1 = begin();
 iterator __e1 = end();

Modified: 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp?rev=342057&r1=342056&r2=342057&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp Wed 
Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // 
 
 // void merge(list& x);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include 
 #include 
@@ -26,7 +27,16 @@ int main()
 std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2);
 assert(c1 == std::list(a3, a3+sizeof(a3)/sizeof(a3[0])));
+assert(c2.empty());
 }
+
+{
+int a1[] = {1, 3, 7, 9, 10};
+std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+c1.merge(c1);
+assert((c1 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0];
+}
+
 #if TEST_STD_VER >= 11
 {
 int a1[] = {1, 3, 7, 9, 10};
@@ -36,6 +46,7 @@ int main()
 std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2);
 assert((c1 == std::list>(a3, 
a3+sizeof(a3)/sizeof(a3[0];
+assert(c2.empty());
 }
 #endif
 }

Modified: 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp?rev=342057&r1=342056&r2=342057&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp 
Wed Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // 
 
 // template  void merge(list& x, Compare comp);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include 
 #include 
@@ -27,7 +28,15 @@ int main()
 std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2, std::greater());
 assert(c1 == std::list(a3, a3+sizeof(a3)/sizeof(a3[0])));
+assert(c2.empty());
 }
+{
+int a1[] = {10, 9, 7, 3, 1};
+std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+c1.merge(c1, std::greater());
+assert((c1 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0];
+}
+
 #if TEST_STD_VER >= 11
 {
 int a1[] = {10, 9, 7, 3, 1};
@@ -37,6 +46,7 @@ int main()
 std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
 c1.merge(c2, std::greater());
 assert((c1 == std::list>(a3, 
a3+sizeof(a3)/sizeof(a3[0];
+assert(c2.empty());
 }
 #endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342057&r1=342056&r2=342057&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 07:46:17 2018
@@ -73,7 +73,7 @@
https://wg21.link/P0768R1";>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1";>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
https://wg21.link/P0122R7";>P0122R7LWGJacksonvilleComplete7.0
-   https://wg21.link/P0355R7";>P0355R7LWGExtending 
chrono to Calendars and Time 
ZonesJacksonville
+   https://wg21.link/P0355R7";>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
https://wg21.link/P0551R3";>P0551R3LWGThou Shalt Not 
Specialize std Function 
Templates!Jacksonville
https://wg21.link/P0753R2";>P0753R2LWGManipulators 
for C++ Synchronized Buffered 
OstreamJacksonville
https://wg21.link/P0754R2";>P0754R2LWGJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
https://wg21.link/P0476R2";>P0476R2LWGBit-casting 
object representationsRapperswil
https://wg21.link

[libcxx] r342063 - Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulat

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 09:59:09 2018
New Revision: 342063

URL: http://llvm.org/viewvc/llvm-project?rev=342063&view=rev
Log:
Update the failure annotations for the uncaught_exceptions test. The underlying 
abi library on some Mac OS versions does not support the plural 
uncaught_exceptions, so libc++ emulates it from the singlar; this means it will 
only return 0 or 1.


Modified:

libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp?rev=342063&r1=342062&r2=342063&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
 Wed Sep 12 09:59:09 2018
@@ -10,11 +10,11 @@
 // UNSUPPORTED: libcpp-no-exceptions
 // XFAIL: libcpp-no-exceptions
 
-// XFAIL: availability=macosx10.7
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.11
+// XFAIL: macosx10.7
+// XFAIL: macosx10.8
+// XFAIL: macosx10.9
+// XFAIL: macosx10.10
+// XFAIL: macosx10.11
 // XFAIL: with_system_cxx_lib=macosx10.12
 // XFAIL: with_system_cxx_lib=macosx10.13
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r342070 - mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 11:51:12 2018
New Revision: 342070

URL: http://llvm.org/viewvc/llvm-project?rev=342070&view=rev
Log:
mark LWG#2953 as complete. No code changes required, but added a couple of 
extra tests.

Modified:

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp?rev=342070&r1=342069&r2=342070&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
 Wed Sep 12 11:51:12 2018
@@ -18,6 +18,23 @@
 #include 
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+Throws() : v_(0) {}
+Throws(int v) : v_(v) {}
+Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &&rhs) { v_ = rhs.v_; return *this; }
+int v_;
+
+static bool sThrows;
+};
+ 
+bool Throws::sThrows = false;
+#endif
 
 template 
 C
@@ -90,4 +107,19 @@ int main()
 testN> >(rng[i], rng[j]);
 }
 #endif
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of 
T.
+// (which includes move assignment)
+{
+Throws arr[] = {1, 2, 3};
+std::deque v(arr, arr+3);
+Throws::sThrows = true;
+v.erase(v.begin());
+v.erase(--v.end());
+v.erase(v.begin());
+assert(v.size() == 0);
+}
+#endif
 }

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp?rev=342070&r1=342069&r2=342070&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
 Wed Sep 12 11:51:12 2018
@@ -20,6 +20,24 @@
 #include 
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+Throws() : v_(0) {}
+Throws(int v) : v_(v) {}
+Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws(  Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+Throws& operator=(  Throws &&rhs) { v_ = rhs.v_; return *this; }
+int v_;
+
+static bool sThrows;
+};
+ 
+bool Throws::sThrows = false;
+#endif
+
 
 template 
 C
@@ -96,4 +114,18 @@ int main()
 testN> >(rng[i], rng[j]);
 }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of 
T.
+// (which includes move assignment)
+{
+Throws arr[] = {1, 2, 3};
+std::deque v(arr, arr+3);
+Throws::sThrows = true;
+v.erase(v.begin(), --v.end());
+assert(v.size() == 1);
+v.erase(v.begin(), v.end());
+assert(v.size() == 0);
+}
+#endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342070&r1=342069&r2=342070&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 11:51:12 2018
@@ -73,7 +73,7 @@
https://wg21.link/P0768R1";>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1";>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
https://wg21.link/P0122R7";>P0122R7LWGJacksonvilleComplete7.0
-   https://wg21.link/P0355R7";>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
+   https://wg21.link/P0355R7";>P0355R7LWGExtending 
chrono to Calendars and Time ZonesJacksonvilleIn 
progress
https://wg21.link/P0551R3";>P0551R3LWGThou Shalt Not 
Specialize std Function 
Templates!Jacksonville
https://wg21.link/P0753R2";>P0753R2LWGManipulators 
for C++ Synchronized Buffered 
OstreamJacksonville
https://wg21.link/P0754R2";>P0754R2LWGJacksonvilleComplete7.0
@@ -89,7 +89,7 @@
   

[libcxx] r342071 - Actually mark LWG#2953, don't just say you've done so in r342070

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 11:53:02 2018
New Revision: 342071

URL: http://llvm.org/viewvc/llvm-project?rev=342071&view=rev
Log:
Actually mark LWG#2953, don't just say you've done so in r342070

Modified:
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342071&r1=342070&r2=342071&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 11:53:02 2018
@@ -148,7 +148,7 @@
https://wg21.link/LWG2948";>2948unique_ptr 
does not define operator<< for stream 
outputAlbuquerqueComplete
https://wg21.link/LWG2950";>2950std::byte 
operations are misspecifiedAlbuquerqueComplete
https://wg21.link/LWG2952";>2952iterator_traits should work 
for pointers to cv TAlbuquerqueComplete
-   https://wg21.link/LWG2953";>2953LWG 2853 
should apply to deque::erase tooAlbuquerque
+   https://wg21.link/LWG2953";>2953LWG 2853 
should apply to deque::erase tooAlbuquerqueComplete
https://wg21.link/LWG2958";>2958Moves 
improperly defined as deletedAlbuquerqueWe already do 
this
https://wg21.link/LWG2964";>2964Apparently 
redundant requirement for 
dynamic_pointer_castAlbuquerque
https://wg21.link/LWG2965";>2965Non-existing 
path::native_string() in filesystem_error::what() 
specificationAlbuquerqueNothing to do


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r342073 - Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 12:41:40 2018
New Revision: 342073

URL: http://llvm.org/viewvc/llvm-project?rev=342073&view=rev
Log:
Implement the infrastructure for feature-test macros. Very few actual feature 
test macros, though. Reviewed as: https://reviews.llvm.org/D51955

Added:

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
Modified:
libcxx/trunk/include/algorithm
libcxx/trunk/include/any
libcxx/trunk/include/array
libcxx/trunk/include/atomic
libcxx/trunk/include/bit
libcxx/trunk/include/chrono
libcxx/trunk/include/cmath
libcxx/trunk/include/complex
libcxx/trunk/include/cstddef
libcxx/trunk/include/deque

[libcxx] r342103 - Mark LWG#3102 as complete. No code changes, but I updated a test or two

2018-09-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Sep 12 19:23:52 2018
New Revision: 342103

URL: http://llvm.org/viewvc/llvm-project?rev=342103&view=rev
Log:
Mark LWG#3102 as complete. No code changes, but I updated a test or two

Modified:
libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp?rev=342103&r1=342102&r2=342103&view=diff
==
--- libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/views/span.iterators/end.pass.cpp Wed Sep 
12 19:23:52 2018
@@ -32,8 +32,11 @@ constexpr bool testConstexprSpan(Span s)
 }
 else
 {
+   typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
 ret = ret &&  ( e !=  s.begin());
 ret = ret &&  (ce != s.cbegin());
+ret = ret &&  (&*( e-1) == last);
+ret = ret &&  (&*(ce-1) == last);
 }
 
 ret = ret &&  (( e -  s.begin()) == s.size());
@@ -55,8 +58,11 @@ void testRuntimeSpan(Span s)
 }
 else
 {
+   typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
 assert( e !=  s.begin());
 assert(ce != s.cbegin());
+assert( &*( e-1) == last);
+assert( &*(ce-1) == last);
 }
 
 assert(( e -  s.begin()) == s.size());

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342103&r1=342102&r2=342103&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 19:23:52 2018
@@ -216,7 +216,7 @@
https://wg21.link/LWG3083";>3083What 
should ios::iword(-1) do?RapperswilNothing to 
do
https://wg21.link/LWG3094";>3094[time.duration.io]p4 makes 
surprising claims about encodingRapperswil
https://wg21.link/LWG3100";>3100Unnecessary and confusing 
"empty span" wordingRapperswilNothing to do
-   https://wg21.link/LWG3102";>3102Clarify 
span iterator and const_iterator behaviorRapperswil
+   https://wg21.link/LWG3102";>3102Clarify 
span iterator and const_iterator 
behaviorRapperswilComplete
https://wg21.link/LWG3104";>3104Fixing 
duration divisionRapperswilComplete
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r337808 - Disable 'suggest braces' warnings for std::array in tests

2018-07-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Jul 23 20:41:36 2018
New Revision: 337808

URL: http://llvm.org/viewvc/llvm-project?rev=337808&view=rev
Log:
Disable 'suggest braces' warnings for std::array in tests

Modified:
libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp
libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp

Modified: libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp?rev=337808&r1=337807&r2=337808&view=diff
==
--- libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/views/span.cons/deduct.pass.cpp Mon Jul 23 
20:41:36 2018
@@ -37,6 +37,10 @@
 
 #include "test_macros.h"
 
+// std::array is explicitly allowed to be initialized with A a = { init-list 
};.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
 int main ()
 {
 {

Modified: libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp?rev=337808&r1=337807&r2=337808&view=diff
==
--- libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/views/span.cons/stdarray.pass.cpp Mon Jul 
23 20:41:36 2018
@@ -27,6 +27,9 @@
 #include 
 
 #include "test_macros.h"
+// std::array is explicitly allowed to be initialized with A a = { init-list 
};.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
 
 
 void checkCV()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r337809 - fix nesting of namespace and standard-version check. Also include <__config>

2018-07-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Jul 23 20:56:38 2018
New Revision: 337809

URL: http://llvm.org/viewvc/llvm-project?rev=337809&view=rev
Log:
fix nesting of namespace and standard-version check. Also include <__config>

Modified:
libcxx/trunk/include/span

Modified: libcxx/trunk/include/span
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/span?rev=337809&r1=337808&r2=337809&view=diff
==
--- libcxx/trunk/include/span (original)
+++ libcxx/trunk/include/span Mon Jul 23 20:56:38 2018
@@ -140,6 +140,7 @@ template
 
 */
 
+#include <__config>
 #include   // for ptrdiff_t
 #include  // for iterators
 #include // for array
@@ -600,7 +601,8 @@ template
 template
 span(const _Container&) -> span;
 
+#endif // _LIBCPP_STD_VER > 17
+
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP_STD_VER > 17
 #endif // _LIBCPP_SPAN


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r337879 - Mark as complete

2018-07-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 24 18:55:25 2018
New Revision: 337879

URL: http://llvm.org/viewvc/llvm-project?rev=337879&view=rev
Log:
Mark  as complete

Modified:
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=337879&r1=337878&r2=337879&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Tue Jul 24 18:55:25 2018
@@ -72,7 +72,7 @@
https://wg21.link/P0767R1";>P0767R1CWGDeprecate 
PODAlbuquerqueComplete7.0
https://wg21.link/P0768R1";>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1";>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
-   https://wg21.link/P0122R7";>P0122R7LWGJacksonvilleIn
 Progress
+   https://wg21.link/P0122R7";>P0122R7LWGJacksonvilleComplete7.0
https://wg21.link/P0355R7";>P0355R7LWGExtending 
chrono to Calendars and Time 
ZonesJacksonville
https://wg21.link/P0551R3";>P0551R3LWGThou Shalt Not 
Specialize std Function 
Templates!Jacksonville
https://wg21.link/P0753R2";>P0753R2LWGManipulators 
for C++ Synchronized Buffered 
OstreamJacksonville
@@ -222,7 +222,7 @@
 
   
 
-  Last Updated: 11-Jun-2018
+  Last Updated: 23-Jul-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r337885 - New test support for comparisons. Reviewed as https://reviews.llvm.org/D49773

2018-07-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 24 21:21:21 2018
New Revision: 337885

URL: http://llvm.org/viewvc/llvm-project?rev=337885&view=rev
Log:
New test support for comparisons. Reviewed as https://reviews.llvm.org/D49773

Added:
libcxx/trunk/test/support/test_comparisons.h

Added: libcxx/trunk/test/support/test_comparisons.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_comparisons.h?rev=337885&view=auto
==
--- libcxx/trunk/test/support/test_comparisons.h (added)
+++ libcxx/trunk/test/support/test_comparisons.h Tue Jul 24 21:21:21 2018
@@ -0,0 +1,175 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+//  A set of routines for testing the comparison operators of a type
+//
+//  6 tests all six comparison operators
+//  2 tests only op== and op!=
+//
+//  AssertComparisonsXAreNoexcept   static_asserts that the operations 
are all noexcept.
+//  AssertComparisonsXReturnBoolstatic_asserts that the operations 
return bool.
+//  AssertComparisonsXConvertibleToBool static_asserts that the operations 
return something convertible to bool.
+
+
+#ifndef TEST_COMPARISONS_H
+#define TEST_COMPARISONS_H
+
+#include 
+#include "test_macros.h"
+
+//  Test all six comparison operations for sanity
+template 
+TEST_CONSTEXPR_CXX14 bool testComparisons6(const T& t1, const T& t2, bool 
isEqual, bool isLess)
+{
+if (isEqual)
+{
+if (!(t1 == t2)) return false;
+if (!(t2 == t1)) return false;
+if ( (t1 != t2)) return false;
+if ( (t2 != t1)) return false;
+if ( (t1  < t2)) return false;
+if ( (t2  < t1)) return false;
+if (!(t1 <= t2)) return false;
+if (!(t2 <= t1)) return false;
+if ( (t1  > t2)) return false;
+if ( (t2  > t1)) return false;
+if (!(t1 >= t2)) return false;
+if (!(t2 >= t1)) return false;
+}
+else if (isLess)
+{
+if ( (t1 == t2)) return false;
+if ( (t2 == t1)) return false;
+if (!(t1 != t2)) return false;
+if (!(t2 != t1)) return false;
+if (!(t1  < t2)) return false;
+if ( (t2  < t1)) return false;
+if (!(t1 <= t2)) return false;
+if ( (t2 <= t1)) return false;
+if ( (t1  > t2)) return false;
+if (!(t2  > t1)) return false;
+if ( (t1 >= t2)) return false;
+if (!(t2 >= t1)) return false;
+}
+else /* greater */
+{
+if ( (t1 == t2)) return false;
+if ( (t2 == t1)) return false;
+if (!(t1 != t2)) return false;
+if (!(t2 != t1)) return false;
+if ( (t1  < t2)) return false;
+if (!(t2  < t1)) return false;
+if ( (t1 <= t2)) return false;
+if (!(t2 <= t1)) return false;
+if (!(t1  > t2)) return false;
+if ( (t2  > t1)) return false;
+if (!(t1 >= t2)) return false;
+if ( (t2 >= t1)) return false;
+}
+
+return true;
+}
+
+//  Easy call when you can init from something already comparable.
+template 
+TEST_CONSTEXPR_CXX14 bool testComparisons6Values(Param val1, Param val2)
+{
+const bool isEqual = val1 == val2;
+const bool isLess  = val1  < val2;
+
+return testComparisons6(T{val1}, T{val2}, isEqual, isLess);
+}
+
+template 
+void AssertComparisons6AreNoexcept()
+{
+ASSERT_NOEXCEPT(std::declval() == std::declval());
+ASSERT_NOEXCEPT(std::declval() != std::declval());
+ASSERT_NOEXCEPT(std::declval() <  std::declval());
+ASSERT_NOEXCEPT(std::declval() <= std::declval());
+ASSERT_NOEXCEPT(std::declval() >  std::declval());
+ASSERT_NOEXCEPT(std::declval() >= std::declval());
+}
+
+template 
+void AssertComparisons6ReturnBool()
+{
+ASSERT_SAME_TYPE(decltype(std::declval() == std::declval()), bool);
+ASSERT_SAME_TYPE(decltype(std::declval() != std::declval()), bool);
+ASSERT_SAME_TYPE(decltype(std::declval() <  std::declval()), bool);
+ASSERT_SAME_TYPE(decltype(std::declval() <= std::declval()), bool);
+ASSERT_SAME_TYPE(decltype(std::declval() >  std::declval()), bool);
+ASSERT_SAME_TYPE(decltype(std::declval() >= std::declval()), bool);
+}
+
+
+template 
+void AssertComparisons6ConvertibleToBool()
+{
+static_assert((std::is_convertible() == 
std::declval()), bool>::value), "");
+static_assert((std::is_convertible() != 
std::declval()), bool>::value), "");
+static_assert((std::is_convertible() <  
std::declval()), bool>::value), "");
+static_assert((std::is_convertible() <= 
std::declval()), bool>::value), "");
+static_assert((std::is_convertible() >  

[libcxx] r338332 - Code cleanup - change naked 'throw' expressions to call helpre function '__throw_future_error'. The behavior change is that if you build libc++ with exceptions disabled, and then us

2018-07-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Jul 30 16:33:48 2018
New Revision: 338332

URL: http://llvm.org/viewvc/llvm-project?rev=338332&view=rev
Log:
Code cleanup - change naked 'throw' expressions to call helpre function 
'__throw_future_error'. The behavior change is that if you build libc++ with 
exceptions disabled, and then use that in a program that sets the value of the 
future twice (for example), it will now abort instead of behaving unpredictably.

Modified:
libcxx/trunk/src/future.cpp

Modified: libcxx/trunk/src/future.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/future.cpp?rev=338332&r1=338331&r2=338332&view=diff
==
--- libcxx/trunk/src/future.cpp (original)
+++ libcxx/trunk/src/future.cpp Mon Jul 30 16:33:48 2018
@@ -92,10 +92,8 @@ void
 __assoc_sub_state::set_value()
 {
 unique_lock __lk(__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__has_value())
-throw 
future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+__throw_future_error(future_errc::promise_already_satisfied);
 __state_ |= __constructed | ready;
 __cv_.notify_all();
 }
@@ -104,10 +102,8 @@ void
 __assoc_sub_state::set_value_at_thread_exit()
 {
 unique_lock __lk(__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__has_value())
-throw 
future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+__throw_future_error(future_errc::promise_already_satisfied);
 __state_ |= __constructed;
 __thread_local_data()->__make_ready_at_thread_exit(this);
 }
@@ -116,10 +112,8 @@ void
 __assoc_sub_state::set_exception(exception_ptr __p)
 {
 unique_lock __lk(__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__has_value())
-throw 
future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+__throw_future_error(future_errc::promise_already_satisfied);
 __exception_ = __p;
 __state_ |= ready;
 __cv_.notify_all();
@@ -129,10 +123,8 @@ void
 __assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
 {
 unique_lock __lk(__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__has_value())
-throw 
future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+__throw_future_error(future_errc::promise_already_satisfied);
 __exception_ = __p;
 __thread_local_data()->__make_ready_at_thread_exit(this);
 }
@@ -181,18 +173,14 @@ __assoc_sub_state::__sub_wait(unique_loc
 void
 __assoc_sub_state::__execute()
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 }
 
 future::future(__assoc_sub_state* __state)
 : __state_(__state)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_->__has_future_attached())
-throw 
future_error(make_error_code(future_errc::future_already_retrieved));
-#endif
+__throw_future_error(future_errc::future_already_retrieved);
 __state_->__add_shared();
 __state_->__set_future_attached();
 }
@@ -234,50 +222,40 @@ promise::~promise()
 future
 promise::get_future()
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_ == nullptr)
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 return future(__state_);
 }
 
 void
 promise::set_value()
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_ == nullptr)
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 __state_->set_value();
 }
 
 void
 promise::set_exception(exception_ptr __p)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_ == nullptr)
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 __state_->set_exception(__p);
 }
 
 void
 promise::set_value_at_thread_exit()
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_ == nullptr)
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 __state_->set_value_at_thread_exit();
 }
 
 void
 promise::set_exception_at_thread_exit(exception_ptr __p)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__state_ == nullptr)
-throw future_error(make_error_code(future_errc::no_state));
-#endif
+__throw_future_error(future_errc::no_state);
 __state_->set_exception_at_thread_exit(__p);
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338411 - Introduce a new test macro TEST_HAS_C11_FEATURES which is set when the underlying C library has C11 features. In C++17, we use those features. <__config> defines a similar macro, _L

2018-07-31 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 31 11:23:57 2018
New Revision: 338411

URL: http://llvm.org/viewvc/llvm-project?rev=338411&view=rev
Log:
Introduce a new test macro TEST_HAS_C11_FEATURES which is set when the 
underlying C library has C11 features. In C++17, we use those features. 
<__config> defines a similar macro, _LIBCPP_HAS_C11_FEATURES, but we don't want 
to use that in the library-independent parts of the tests, so define the new 
one. Also add a libc++-specific test to make sure the two stay in sync.

Added:
libcxx/trunk/test/libcxx/language.support/has_c11_features.pass.cpp
Modified:
libcxx/trunk/test/support/test_macros.h

Added: libcxx/trunk/test/libcxx/language.support/has_c11_features.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/language.support/has_c11_features.pass.cpp?rev=338411&view=auto
==
--- libcxx/trunk/test/libcxx/language.support/has_c11_features.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/language.support/has_c11_features.pass.cpp Tue Jul 
31 11:23:57 2018
@@ -0,0 +1,29 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// We have two macros for checking whether or not the underlying C library
+//  has C11 features:
+// TEST_HAS_C11_FEATURES- which is defined in "test_macros.h"
+// _LIBCPP_HAS_C11_FEATURES - which is defined in <__config>
+// They should always be the same
+
+#ifdef TEST_HAS_C11_FEATURES
+# ifndef _LIBCPP_HAS_C11_FEATURES
+#  error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is 
not"
+# endif
+#endif
+
+#ifdef _LIBCPP_HAS_C11_FEATURES
+# ifndef TEST_HAS_C11_FEATURES
+#  error "_LIBCPP_HAS_C11_FEATURES is defined, but TEST_HAS_C11_FEATURES is 
not"
+# endif
+#endif
+
+int main() {}

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=338411&r1=338410&r2=338411&view=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Tue Jul 31 11:23:57 2018
@@ -94,16 +94,6 @@
 #define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
 #endif
 
-/* Features that were introduced in C++14 */
-#if TEST_STD_VER >= 14
-#define TEST_HAS_EXTENDED_CONSTEXPR
-#define TEST_HAS_VARIABLE_TEMPLATES
-#endif
-
-/* Features that were introduced after C++14 */
-#if TEST_STD_VER > 14
-#endif
-
 #if TEST_STD_VER >= 11
 #define TEST_ALIGNOF(...) alignof(__VA_ARGS__)
 #define TEST_ALIGNAS(...) alignas(__VA_ARGS__)
@@ -132,6 +122,43 @@
 #define TEST_THROW_SPEC(...) throw(__VA_ARGS__)
 #endif
 
+// Sniff out to see if the underling C library has C11 features
+// Note that at this time (July 2018), MacOS X and iOS do NOT.
+#if __ISO_C_VISIBLE >= 2011
+#  if defined(__FreeBSD__)
+#define TEST_HAS_C11_FEATURES
+#  elif defined(__Fuchsia__)
+#define TEST_HAS_C11_FEATURES
+#  elif defined(__linux__)
+#if !defined(_LIBCPP_HAS_MUSL_LIBC)
+#  if _LIBCPP_GLIBC_PREREQ(2, 17)
+#define TEST_HAS_C11_FEATURES
+#  endif
+#else // defined(_LIBCPP_HAS_MUSL_LIBC)
+#  define TEST_HAS_C11_FEATURES
+#endif
+#  elif defined(_WIN32)
+#if defined(_MSC_VER) && !defined(__MINGW32__)
+#  define TEST_HAS_C11_FEATURES // Using Microsoft's C Runtime library
+#endif
+#  endif
+#endif
+
+/* Features that were introduced in C++14 */
+#if TEST_STD_VER >= 14
+#define TEST_HAS_EXTENDED_CONSTEXPR
+#define TEST_HAS_VARIABLE_TEMPLATES
+#endif
+
+/* Features that were introduced in C++17 */
+#if TEST_STD_VER >= 17
+#endif
+
+/* Features that were introduced after C++17 */
+#if TEST_STD_VER > 17
+#endif
+
+
 #define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__))
 
 #if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338419 - import timespec and timespec_get into namespace std if we're under c++17 or later AND the underlying C library has them. Fixes PR#38220, but doesn't implement all of P0063 yet.

2018-07-31 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 31 12:25:00 2018
New Revision: 338419

URL: http://llvm.org/viewvc/llvm-project?rev=338419&view=rev
Log:
import timespec and timespec_get into namespace std if we're under c++17 or 
later AND the underlying C library has them. Fixes PR#38220, but doesn't 
implement all of P0063 yet.

Modified:
libcxx/trunk/include/ctime
libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp

Modified: libcxx/trunk/include/ctime
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ctime?rev=338419&r1=338418&r2=338419&view=diff
==
--- libcxx/trunk/include/ctime (original)
+++ libcxx/trunk/include/ctime Tue Jul 31 12:25:00 2018
@@ -18,7 +18,8 @@ Macros:
 
 NULL
 CLOCKS_PER_SEC
-
+TIME_UTC // C++17
+
 namespace std
 {
 
@@ -28,7 +29,8 @@ Types:
 size_t
 time_t
 tm
-
+timespec // C++17
+
 clock_t clock();
 double difftime(time_t time1, time_t time0);
 time_t mktime(tm* timeptr);
@@ -39,7 +41,7 @@ tm*gmtime(const time_t* timer);
 tm* localtime(const time_t* timer);
 size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
 const tm* restrict timeptr);
-
+int timespec_get( struct timespec *ts, int base); // C++17
 }  // std
 
 */
@@ -57,6 +59,9 @@ using ::clock_t;
 using ::size_t;
 using ::time_t;
 using ::tm;
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
+using ::timespec;
+#endif
 using ::clock;
 using ::difftime;
 using ::mktime;
@@ -68,6 +73,9 @@ using ::gmtime;
 using ::localtime;
 #endif
 using ::strftime;
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
+using ::timespec_get;
+#endif
 
 _LIBCPP_END_NAMESPACE_STD
 

Modified: libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp?rev=338419&r1=338418&r2=338419&view=diff
==
--- libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp Tue 
Jul 31 12:25:00 2018
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include "test_macros.h"
 
 #ifndef NULL
 #error NULL not defined
@@ -20,12 +21,22 @@
 #error CLOCKS_PER_SEC not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef TIME_UTC
+#error TIME_UTC not defined
+#endif
+#endif
+
 int main()
 {
 std::clock_t c = 0;
 std::size_t s = 0;
 std::time_t t = 0;
 std::tm tm = {};
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+std::timespec tmspec = {};
+((void)tmspec); // Prevent unused warning
+#endif
 ((void)c); // Prevent unused warning
 ((void)s); // Prevent unused warning
 ((void)t); // Prevent unused warning
@@ -34,6 +45,9 @@ int main()
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+static_assert((std::is_same::value), "");
+#endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");

Modified: libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp?rev=338419&r1=338418&r2=338419&view=diff
==
--- libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp Tue Jul 31 
12:25:00 2018
@@ -10,6 +10,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 #ifndef NULL
 #error NULL not defined
 #endif
@@ -18,6 +20,12 @@
 #error CLOCKS_PER_SEC not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef TIME_UTC
+#error TIME_UTC not defined
+#endif
+#endif
+
 int main()
 {
 std::clock_t c = 0;
@@ -30,10 +38,18 @@ int main()
 ((void)t); // Prevent unused warning
 ((void)tm); // Prevent unused warning
 ((void)str); // Prevent unused warning
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+std::timespec tmspec = {};
+((void)tmspec); // Prevent unused warning
+#endif
+
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+static_assert((std::is_same::value), "");
+#endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value),

[libcxx] r338454 - Test for the presence of a bunch of new macros for c++17. These macros come from C11. Part of P0063

2018-07-31 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 31 16:29:06 2018
New Revision: 338454

URL: http://llvm.org/viewvc/llvm-project?rev=338454&view=rev
Log:
Test for the presence of a bunch of new macros for c++17. These macros come 
from C11. Part of P0063

Modified:
libcxx/trunk/include/cfloat
libcxx/trunk/include/float.h
libcxx/trunk/test/std/depr/depr.c.headers/float_h.pass.cpp

libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp

Modified: libcxx/trunk/include/cfloat
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cfloat?rev=338454&r1=338453&r2=338454&view=diff
==
--- libcxx/trunk/include/cfloat (original)
+++ libcxx/trunk/include/cfloat Tue Jul 31 16:29:06 2018
@@ -20,11 +20,18 @@ Macros:
 FLT_EVAL_METHOD // C99
 FLT_RADIX
 
+FLT_HAS_SUBNORM // C11
+DBL_HAS_SUBNORM // C11
+LDBL_HAS_SUBNORM// C11
+
 FLT_MANT_DIG
 DBL_MANT_DIG
 LDBL_MANT_DIG
 
 DECIMAL_DIG // C99
+FLT_DECIMAL_DIG // C11
+DBL_DECIMAL_DIG // C11
+LDBL_DECIMAL_DIG// C11
 
 FLT_DIG
 DBL_DIG
@@ -58,6 +65,9 @@ Macros:
 DBL_MIN
 LDBL_MIN
 
+FLT_TRUE_MIN// C11
+DBL_TRUE_MIN// C11
+LDBL_TRUE_MIN   // C11
 */
 
 #include <__config>

Modified: libcxx/trunk/include/float.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/float.h?rev=338454&r1=338453&r2=338454&view=diff
==
--- libcxx/trunk/include/float.h (original)
+++ libcxx/trunk/include/float.h Tue Jul 31 16:29:06 2018
@@ -24,7 +24,14 @@ Macros:
 DBL_MANT_DIG
 LDBL_MANT_DIG
 
+FLT_HAS_SUBNORM // C11
+DBL_HAS_SUBNORM // C11
+LDBL_HAS_SUBNORM// C11
+
 DECIMAL_DIG // C99
+FLT_DECIMAL_DIG // C11
+DBL_DECIMAL_DIG // C11
+LDBL_DECIMAL_DIG// C11
 
 FLT_DIG
 DBL_DIG
@@ -58,6 +65,10 @@ Macros:
 DBL_MIN
 LDBL_MIN
 
+FLT_TRUE_MIN// C11
+DBL_TRUE_MIN// C11
+LDBL_TRUE_MIN   // C11
+
 */
 
 #include <__config>

Modified: libcxx/trunk/test/std/depr/depr.c.headers/float_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/float_h.pass.cpp?rev=338454&r1=338453&r2=338454&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/float_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/float_h.pass.cpp Tue Jul 31 
16:29:06 2018
@@ -23,6 +23,20 @@
 #error FLT_RADIX not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef FLT_HAS_SUBNORM
+#error FLT_HAS_SUBNORM not defined
+#endif
+
+#ifndef DBL_HAS_SUBNORM
+#error DBL_HAS_SUBNORM not defined
+#endif
+
+#ifndef LDBL_HAS_SUBNORM
+#error LDBL_HAS_SUBNORM not defined
+#endif
+#endif
+
 #ifndef FLT_MANT_DIG
 #error FLT_MANT_DIG not defined
 #endif
@@ -39,6 +53,20 @@
 #error DECIMAL_DIG not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef FLT_DECIMAL_DIG
+#error FLT_DECIMAL_DIG not defined
+#endif
+
+#ifndef DBL_DECIMAL_DIG
+#error DBL_DECIMAL_DIG not defined
+#endif
+
+#ifndef LDBL_DECIMAL_DIG
+#error LDBL_DECIMAL_DIG not defined
+#endif
+#endif
+
 #ifndef FLT_DIG
 #error FLT_DIG not defined
 #endif
@@ -135,6 +163,20 @@
 #error LDBL_MIN not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef FLT_TRUE_MIN
+#error FLT_TRUE_MIN not defined
+#endif
+
+#ifndef DBL_TRUE_MIN
+#error DBL_TRUE_MIN not defined
+#endif
+
+#ifndef LDBL_TRUE_MIN
+#error LDBL_TRUE_MIN not defined
+#endif
+#endif
+
 int main()
 {
 }

Modified: 
libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp?rev=338454&r1=338453&r2=338454&view=diff
==
--- 
libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp 
Tue Jul 31 16:29:06 2018
@@ -23,6 +23,20 @@
 #error FLT_RADIX not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef FLT_HAS_SUBNORM
+#error FLT_HAS_SUBNORM not defined
+#endif
+
+#ifndef DBL_HAS_SUBNORM
+#error DBL_HAS_SUBNORM not defined
+#endif
+
+#ifndef LDBL_HAS_SUBNORM
+#error LDBL_HAS_SUBNORM not defined
+#endif
+#endif
+
 #ifndef FLT_MANT_DIG
 #error FLT_MANT_DIG not defined
 #endif
@@ -39,6 +53,20 @@
 #error DECIMAL_DIG not defined
 #endif
 
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#ifndef FLT_DECIMAL_DIG
+#error FLT_DECIMAL_DIG not defined
+#endif
+
+#ifndef DBL_DECIMAL_DIG
+#error DBL_DECIMAL_DIG not defined
+#endif
+
+#ifndef LDBL_DECIMA

[libcxx] r338457 - Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it

2018-07-31 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jul 31 16:39:12 2018
New Revision: 338457

URL: http://llvm.org/viewvc/llvm-project?rev=338457&view=rev
Log:
Final bit of P0063 - make sure that aligned_alloc is available when the 
underlying C library supports it

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp?rev=338457&r1=338456&r2=338457&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp Tue Jul 31 
16:39:12 2018
@@ -12,6 +12,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 // As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
 // in an unevaluated context. For this reason we manually suppress the warning.
 #if defined(__clang__)
@@ -83,6 +85,14 @@ int main()
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+
+//  Microsoft does not implement aligned_alloc in their C library
+#ifndef TEST_COMPILER_C1XX
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+static_assert((std::is_same::value), 
"");
+#endif
+#endif
+
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");

Modified: 
libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp?rev=338457&r1=338456&r2=338457&view=diff
==
--- libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp Tue 
Jul 31 16:39:12 2018
@@ -13,6 +13,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 // As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
 // in an unevaluated context. For this reason we manually suppress the warning.
 #if defined(__clang__)
@@ -71,6 +73,14 @@ int main()
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+
+//  Microsoft does not implement aligned_alloc in their C library
+#ifndef TEST_COMPILER_C1XX
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+static_assert((std::is_same::value), "");
+#endif
+#endif
+
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=338457&r1=338456&r2=338457&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue Jul 31 16:39:12 2018
@@ -99,9 +99,9 @@

https://wg21.link/p0032r3";>p0032r3LWGHomogeneous 
interface for variant, any and 
optionalOuluComplete4.0
https://wg21.link/p0040r3";>p0040r3LWGExtending 
memory management toolsOuluComplete4.0
-   https://wg21.link/p0063r3";>p0063r3LWGC++17 should 
refer to C11 instead of C99OuluNothing to 
don/a
-   https://wg21.link/p0067r3";>p0067r3LWGElementary 
string conversionsOuluNow https://wg21.link/P0067R5";>P0067R5
-   https://wg21.link/p0083r3";>p0083r3LWGSplicing Maps 
and SetsOulu
+   https://wg21.link/p0063r3";>p0063r3LWGC++17 should 
refer to C11 instead of C99OuluComplete7.0
+   https://wg21.link/p0067r3";>p0067r3LWGElementary 
string conversionsOuluNow https://wg21.link/P0067R5";>P0067R5n/a
+   https://wg21.link/p0083r3";>p0083r3LWGSplicing Maps 
and SetsOuluPartially Done
https://wg21.link/p0084r2";>p0084r2LWGEmplace Return 
TypeOuluComplete4.0
https://wg21.link/p0088r3";>p0088r3LWGVariant: a 
type-safe union for C++17OuluComplete4.0
https://wg21.link/p0137r1";>p0137r1CWGCore Issue 
1776: Replacement of class objects containing reference 
membersOuluComplete6.0
@@ -127,7 +127,7 @@
https://wg21.link/P0394r4";>P0394r4LWGHotel 
Parallelifornia: terminate() for Parallel Algorithms Exception 
HandlingOulu

https://wg21.link/P0003R5";>P0003R5LWGRemoving 
Deprecated Exception Specifications from 
C++17IssaquahComplete5.0
-   https://wg21.link/P0067R5";>P0067R5LWGElementary 
string conversions, revision 5Issaquah
+   https://wg21.link/P0067R5";>P0067R5LWGElementary 
string conversions, revision 5IssaquahPartially 
done
 

[libcxx] r338666 - Implement P0887: The identity metafunction

2018-08-01 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Aug  1 18:56:02 2018
New Revision: 338666

URL: http://llvm.org/viewvc/llvm-project?rev=338666&view=rev
Log:
Implement P0887: The identity metafunction

Added:

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=338666&r1=338665&r2=338666&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed Aug  1 18:56:02 2018
@@ -75,6 +75,10 @@ namespace std
 template  struct remove_pointer;
 template  struct add_pointer;
 
+template struct type_identity; // C++20
+template
+  using type_identity_t = typename type_identity::type;  // C++20
+
 // Integral properties:
 template  struct is_signed;
 template  struct is_unsigned;
@@ -1226,6 +1230,12 @@ template  struct _LIBCPP_TEMP
 template  using add_pointer_t = typename add_pointer<_Tp>::type;
 #endif
 
+// type_identity
+#if _LIBCPP_STD_VER > 17
+template struct type_identity { typedef _Tp type; };
+template using type_identity_t = typename type_identity<_Tp>::type;
+#endif
+
 // is_signed
 
 template ::value>

Added: 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp?rev=338666&view=auto
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
 Wed Aug  1 18:56:02 2018
@@ -0,0 +1,40 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// type_traits
+
+// type_identity
+
+#include 
+
+#include "test_macros.h"
+
+template 
+void test_type_identity()
+{
+static_assert((std::is_same::type, 
T>::value), "");
+static_assert((std::is_same< std::type_identity_t, 
T>::value), "");
+}
+
+int main()
+{
+test_type_identity();
+test_type_identity();
+test_type_identity();
+test_type_identity();
+test_type_identity<  int[3]>();
+test_type_identity();
+
+test_type_identity();
+test_type_identity();
+test_type_identity();
+test_type_identity();
+test_type_identity();
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338668 - Implement P1023: constexpr comparison operators for std::array

2018-08-01 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Aug  1 19:11:06 2018
New Revision: 338668

URL: http://llvm.org/viewvc/llvm-project?rev=338668&view=rev
Log:
Implement P1023: constexpr comparison operators for std::array

Modified:
libcxx/trunk/include/array
libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=338668&r1=338667&r2=338668&view=diff
==
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Wed Aug  1 19:11:06 2018
@@ -367,7 +367,7 @@ array(_Tp, _Args...)
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return _VSTD::equal(__x.begin(), __x.end(), __y.begin());
@@ -375,7 +375,7 @@ operator==(const array<_Tp, _Size>& __x,
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return !(__x == __y);
@@ -383,7 +383,7 @@ operator!=(const array<_Tp, _Size>& __x,
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
@@ -392,7 +392,7 @@ operator<(const array<_Tp, _Size>& __x,
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return __y < __x;
@@ -400,7 +400,7 @@ operator>(const array<_Tp, _Size>& __x,
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return !(__y < __x);
@@ -408,7 +408,7 @@ operator<=(const array<_Tp, _Size>& __x,
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
 return !(__x < __y);

Modified: libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp?rev=338668&r1=338667&r2=338668&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp Wed Aug  
1 19:11:06 2018
@@ -9,6 +9,7 @@
 
 // 
 
+//  These are all constexpr in C++20
 // bool operator==(array const&, array const&);
 // bool operator!=(array const&, array const&);
 // bool operator<(array const&, array const&);
@@ -40,6 +41,41 @@ void test_compare(const Array& LHS, cons
   assert((LHS >= RHS) == (LHSV >= RHSV));
 }
 
+#if TEST_STD_VER > 17
+template 
+constexpr bool constexpr_compare(const Array &lhs, const Array &rhs, bool 
isEqual, bool isLess)
+{
+  if (isEqual)
+  {
+if (!(lhs == rhs)) return false;
+if ( (lhs != rhs)) return false;
+if ( (lhs  < rhs)) return false;
+if (!(lhs <= rhs)) return false;
+if ( (lhs  > rhs)) return false;
+if (!(lhs >= rhs)) return false;
+  }
+  else if (isLess)
+  {
+if ( (lhs == rhs)) return false;
+if (!(lhs != rhs)) return false;
+if (!(lhs  < rhs)) return false;
+if (!(lhs <= rhs)) return false;
+if ( (lhs  > rhs)) return false;
+if ( (lhs >= rhs)) return false;
+  }
+  else // greater
+  {
+if ( (lhs == rhs)) return false;
+if (!(lhs != rhs)) return false;
+if ( (lhs  < rhs)) return false;
+if ( (lhs <= rhs)) return false;
+if (!(lhs  > rhs)) return false;
+if (!(lhs >= rhs)) return false;
+  }
+  return true;  
+}
+#endif
+
 int main()
 {
   {
@@ -60,4 +96,14 @@ int main()
 C c2 = {};
 test_compare(c1, c2);
   }
+
+#if TEST_STD_VER > 17
+  {
+  constexpr std::array a1 = {1, 2, 3};
+  constexpr std::array a2 = {2, 3, 4};
+  static_assert(constexpr_compare(a1, a1, true, false), "");
+  static_assert(constexpr_compare(a1, a2, false, true), "");
+  static_assert(constexpr_compare(a2, a1, false, false), "");
+  }
+#endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=338668&r1=338667&r2=338668&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Aug  1 19:11:06 2018
@@ -72,7 +72,7 @@
https://wg21.link/P0767R1";>P0767R1CWGDeprecate 
PODAlbuquerqueComplete7.0
https://wg21.link/P0768R1";>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
https://wg21.link/P0777R1";>P0777R1LWGTr

[libcxx] r338797 - Update the changes to the array tests (that I committed yesterday) to use the test_comparison routines that I committed last week. NFC.

2018-08-02 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Aug  2 17:47:12 2018
New Revision: 338797

URL: http://llvm.org/viewvc/llvm-project?rev=338797&view=rev
Log:
Update the changes to the array tests (that I committed yesterday) to use the 
test_comparison routines that I committed last week. NFC.


Modified:
libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp

Modified: libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp?rev=338797&r1=338796&r2=338797&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp Thu Aug  
2 17:47:12 2018
@@ -23,59 +23,12 @@
 #include 
 
 #include "test_macros.h"
+#include "test_comparisons.h"
 
 // std::array is explicitly allowed to be initialized with A a = { init-list 
};.
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
 
-template 
-void test_compare(const Array& LHS, const Array& RHS) {
-  typedef std::vector Vector;
-  const Vector LHSV(LHS.begin(), LHS.end());
-  const Vector RHSV(RHS.begin(), RHS.end());
-  assert((LHS == RHS) == (LHSV == RHSV));
-  assert((LHS != RHS) == (LHSV != RHSV));
-  assert((LHS < RHS) == (LHSV < RHSV));
-  assert((LHS <= RHS) == (LHSV <= RHSV));
-  assert((LHS > RHS) == (LHSV > RHSV));
-  assert((LHS >= RHS) == (LHSV >= RHSV));
-}
-
-#if TEST_STD_VER > 17
-template 
-constexpr bool constexpr_compare(const Array &lhs, const Array &rhs, bool 
isEqual, bool isLess)
-{
-  if (isEqual)
-  {
-if (!(lhs == rhs)) return false;
-if ( (lhs != rhs)) return false;
-if ( (lhs  < rhs)) return false;
-if (!(lhs <= rhs)) return false;
-if ( (lhs  > rhs)) return false;
-if (!(lhs >= rhs)) return false;
-  }
-  else if (isLess)
-  {
-if ( (lhs == rhs)) return false;
-if (!(lhs != rhs)) return false;
-if (!(lhs  < rhs)) return false;
-if (!(lhs <= rhs)) return false;
-if ( (lhs  > rhs)) return false;
-if ( (lhs >= rhs)) return false;
-  }
-  else // greater
-  {
-if ( (lhs == rhs)) return false;
-if (!(lhs != rhs)) return false;
-if ( (lhs  < rhs)) return false;
-if ( (lhs <= rhs)) return false;
-if (!(lhs  > rhs)) return false;
-if (!(lhs >= rhs)) return false;
-  }
-  return true;  
-}
-#endif
-
 int main()
 {
   {
@@ -85,25 +38,25 @@ int main()
 C c2 = {1, 2, 3};
 C c3 = {3, 2, 1};
 C c4 = {1, 2, 1};
-test_compare(c1, c2);
-test_compare(c1, c3);
-test_compare(c1, c4);
+assert(testComparisons6(c1, c2, true, false));
+assert(testComparisons6(c1, c3, false, true));
+assert(testComparisons6(c1, c4, false, false));
   }
   {
 typedef int T;
 typedef std::array C;
 C c1 = {};
 C c2 = {};
-test_compare(c1, c2);
+assert(testComparisons6(c1, c2, true, false));
   }
 
 #if TEST_STD_VER > 17
   {
   constexpr std::array a1 = {1, 2, 3};
   constexpr std::array a2 = {2, 3, 4};
-  static_assert(constexpr_compare(a1, a1, true, false), "");
-  static_assert(constexpr_compare(a1, a2, false, true), "");
-  static_assert(constexpr_compare(a2, a1, false, false), "");
+  static_assert(testComparisons6(a1, a1, true, false), "");
+  static_assert(testComparisons6(a1, a2, false, true), "");
+  static_assert(testComparisons6(a2, a1, false, false), "");
   }
 #endif
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338803 - Make my new test harness work w/c++03

2018-08-02 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Aug  2 19:58:16 2018
New Revision: 338803

URL: http://llvm.org/viewvc/llvm-project?rev=338803&view=rev
Log:
Make my new test harness work w/c++03

Modified:
libcxx/trunk/test/support/test_comparisons.h

Modified: libcxx/trunk/test/support/test_comparisons.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_comparisons.h?rev=338803&r1=338802&r2=338803&view=diff
==
--- libcxx/trunk/test/support/test_comparisons.h (original)
+++ libcxx/trunk/test/support/test_comparisons.h Thu Aug  2 19:58:16 2018
@@ -82,7 +82,7 @@ TEST_CONSTEXPR_CXX14 bool testComparison
 const bool isEqual = val1 == val2;
 const bool isLess  = val1  < val2;
 
-return testComparisons6(T{val1}, T{val2}, isEqual, isLess);
+return testComparisons6(T(val1), T(val2), isEqual, isLess);
 }
 
 template 
@@ -147,7 +147,7 @@ TEST_CONSTEXPR_CXX14 bool testComparison
 {
 const bool isEqual = val1 == val2;
 
-return testComparisons2(T{val1}, T{val2}, isEqual);
+return testComparisons2(T(val1), T(val2), isEqual);
 }
 
 template 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r338936 - Mark LWG#2260 as complete. We already did the right thing, so I just added tests to ensure that we continue to DTRT.

2018-08-03 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Aug  3 16:28:48 2018
New Revision: 338936

URL: http://llvm.org/viewvc/llvm-project?rev=338936&view=rev
Log:
Mark LWG#2260 as complete. We already did the right thing, so I just added 
tests to ensure that we continue to DTRT.

Modified:

libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp?rev=338936&r1=338935&r2=338936&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
 Fri Aug  3 16:28:48 2018
@@ -39,6 +39,7 @@ int main()
 {
 {
 int i = 0;
+static_assert((std::is_same, 
decltype(std::pointer_traits >::pointer_to(i))>::value), "");
 A a = std::pointer_traits >::pointer_to(i);
 assert(a.t_ == &i);
 }

Modified: 
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp?rev=338936&r1=338935&r2=338936&view=diff
==
--- libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp 
Fri Aug  3 16:28:48 2018
@@ -23,6 +23,7 @@ int main()
 {
 {
 int i = 0;
+static_assert((std::is_same::pointer_to(i))>::value), "");
 int* a = std::pointer_traits::pointer_to(i);
 assert(a == &i);
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=338936&r1=338935&r2=338936&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Fri Aug  3 16:28:48 2018
@@ -442,7 +442,7 @@
https://wg21.link/LWG2777";>2777basic_string_view::copy 
should use char_traits::copyIssaquahComplete
https://wg21.link/LWG2778";>2778basic_string_view is missing 
constexprIssaquahComplete

-   https://wg21.link/LWG2260";>2260Missing 
requirement for Allocator::pointerKona
+   https://wg21.link/LWG2260";>2260Missing 
requirement for Allocator::pointerKonaComplete
https://wg21.link/LWG2676";>2676Provide 
filesystem::path overloads for File-based 
streamsKonaComplete
https://wg21.link/LWG2768";>2768any_cast 
and move semanticsKonaComplete
https://wg21.link/LWG2769";>2769Redundant 
const in the return type of any_cast(const 
any&)KonaComplete
@@ -504,7 +504,7 @@
 
   
 
-  Last Updated: 22-May-2018
+  Last Updated: 3-Aug-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324290 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb  5 15:43:34 2018
New Revision: 324290

URL: http://llvm.org/viewvc/llvm-project?rev=324290&view=rev
Log:
Remove ; use  instead. See 
https://libcxx.llvm.org/TS_deprecation.html

Removed:
libcxx/trunk/test/std/experimental/string.view/
Modified:
libcxx/trunk/include/experimental/string_view
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp
libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
libcxx/trunk/test/std/experimental/nothing_to_do.pass.cpp

Modified: libcxx/trunk/include/experimental/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/string_view?rev=324290&r1=324289&r2=324290&view=diff
==
--- libcxx/trunk/include/experimental/string_view (original)
+++ libcxx/trunk/include/experimental/string_view Mon Feb  5 15:43:34 2018
@@ -8,811 +8,4 @@
 //
 
//===--===//
 
-#ifndef _LIBCPP_LFTS_STRING_VIEW
-#define _LIBCPP_LFTS_STRING_VIEW
-
-/*
-string_view synopsis
-
-namespace std {
- namespace experimental {
-  inline namespace library_fundamentals_v1 {
-
-// 7.2, Class template basic_string_view
-template>
-class basic_string_view;
-
-// 7.9, basic_string_view non-member comparison functions
-template
-constexpr bool operator==(basic_string_view x,
-  basic_string_view y) noexcept;
-template
-constexpr bool operator!=(basic_string_view x,
-  basic_string_view y) noexcept;
-template
-constexpr bool operator< (basic_string_view x,
- basic_string_view y) noexcept;
-template
-constexpr bool operator> (basic_string_view x,
-  basic_string_view y) noexcept;
-template
-constexpr bool operator<=(basic_string_view x,
- basic_string_view y) noexcept;
-template
-constexpr bool operator>=(basic_string_view x,
-  basic_string_view y) noexcept;
-// see below, sufficient additional overloads of comparison functions
-
-// 7.10, Inserters and extractors
-template
-  basic_ostream&
-operator<<(basic_ostream& os,
-   basic_string_view str);
-
-// basic_string_view typedef names
-typedef basic_string_view string_view;
-typedef basic_string_view u16string_view;
-typedef basic_string_view u32string_view;
-typedef basic_string_view wstring_view;
-
-template>
-class basic_string_view {
-  public:
-  // types
-  typedef traits traits_type;
-  typedef charT value_type;
-  typedef charT* pointer;
-  typedef const charT* const_pointer;
-  typedef charT& reference;
-  typedef const charT& const_reference;
-  typedef implementation-defined const_iterator;
-  typedef const_iterator iterator;
-  typedef reverse_iterator const_reverse_iterator;
-  typedef const_reverse_iterator reverse_iterator;
-  typedef size_t size_type;
-  typedef ptrdiff_t difference_type;
-  static constexpr size_type npos = size_type(-1);
-
-  // 7.3, basic_string_view constructors and assignment operators
-  constexpr basic_string_view() noexcept;
-  constexpr basic_string_view(const basic_string_view&) noexcept = default;
-  basic_string_view& operator=(const basic_string_view&) noexcept = 
default;
-  template
-  basic_string_view(const basic_string& str) 
noexcept;
-  constexpr basic_string_view(const charT* str);
-  constexpr basic_string_view(const charT* str, size_type len);
-
-  // 7.4, basic_string_view iterator support
-  constexpr const_iterator begin() const noexcept;
-  constexpr const_iterator end() const noexcept;
-  constexpr const_iterator cbegin() const noexcept;
-  constexpr const_iterator cend() const noexcept;
-  const_reverse_iterator rbegin() const noexcept;
-  const_reverse_iterator rend() const noexcept;
-  const_reverse_iterator crbegin() const noexcept;
-  const_reverse_iterator crend() const noexcept;
-
-  // 7.5, basic_string_view capacity
-  constexpr size_type size() const noexcept;
-  constexpr size_type length() const noexcept;
-  constexpr size_type max_size() const noexcept;
-  constexpr bool empty() const noexcept;
-
-  // 7.6, basic_string_view element access
-  constexpr const_reference operator[](size_type pos) const;
-  constexpr const_reference at(size_type pos) const;
-  constexpr const_reference front() const;
-  constexpr const_reference back() const;
-  constexpr const_pointer data() const noexcept;
-
-  // 7.7, basic_string_view modifiers
-  constexpr void clear() noexcept;
-  constexpr void remove_prefix(size_type n);
-  constexpr void remove_suffix(size_type n);
-

[libcxx] r324292 - Add issues in 'Review'

2018-02-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb  5 15:50:49 2018
New Revision: 324292

URL: http://llvm.org/viewvc/llvm-project?rev=324292&view=rev
Log:
Add issues in 'Review'

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324292&r1=324291&r2=324292&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Feb  5 15:50:49 2018
@@ -94,6 +94,17 @@
 
   
 
+Issues to "Review"
+
+Issue #Issue NameMeetingStatus
+https://wg21.link/LWG2412";>2412promise::set_value() 
and promise::get_future() should not 
raceJacksonville
+https://wg21.link/LWG2682";>2682filesystem::copy()
 won't create a symlink to a directoryJacksonville
+https://wg21.link/LWG2697";>2697[concurr.ts] 
Behavior of future/shared_future unwrapping constructor when given an 
invalid futureJacksonville
+https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending()
 is incorrectly specifiedJacksonville
+https://wg21.link/LWG2936";>2936Path comparison 
is defined in terms of the generic 
formatJacksonville
+
+
+
 Comments about the issues
 
  2164 - Writing tests here will be fun.
@@ -121,8 +132,8 @@
  3030 - Wording changes only?? Do we handle exceptions correctly here?
  3034 - Need to check if our tests are correct.
  3035 - Easy to do
- 3039 - We should implement P0777 first.
- 3041 - We should implement P0777 first.
+ 3039 - Patch Ready
+ 3041 - Patch Ready
  3042 - We already do this.
  3043 - We have a 'TODO(ericwf)' here
  3045 - We haven't done the  rework yet.
@@ -130,7 +141,16 @@
  3051 - Fixing an inadvertent wording change
 
 
-Last Updated: 29-Jan-2018
+Comments about the "Review" issues
+
+ 2412 - 
+ 2682 - 
+ 2697 - 
+ 2708 - 
+ 2936 - 
+
+
+Last Updated: 5-Feb-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324307 - More patches ready

2018-02-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb  5 17:59:28 2018
New Revision: 324307

URL: http://llvm.org/viewvc/llvm-project?rev=324307&view=rev
Log:
More patches ready

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324307&r1=324306&r2=324307&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Feb  5 17:59:28 2018
@@ -63,8 +63,8 @@
 https://wg21.link/LWG2243";>2243istream::putback 
problemJacksonvilleComplete
 https://wg21.link/LWG2816";>2816resize_file has 
impossible postconditionJacksonvilleNothing to 
do
 https://wg21.link/LWG2843";>2843Unclear behavior 
of 
std::pmr::memory_resource::do_allocate()Jacksonville
-https://wg21.link/LWG2849";>2849Why does 
!is_regular_file(from) cause copy_file to report a "file 
already exists" error?JacksonvilleNothing to do
-https://wg21.link/LWG2851";>2851std::filesystem enum 
classes are now underspecifiedJacksonvilleNothing to 
do
+https://wg21.link/LWG2849";>2849Why does 
!is_regular_file(from) cause copy_file to report a "file 
already exists" error?JacksonvilleNothing to 
do
+https://wg21.link/LWG2851";>2851std::filesystem enum 
classes are now underspecifiedJacksonvilleNothing to 
do
 https://wg21.link/LWG2969";>2969polymorphic_allocator::construct()
 shouldn't pass resource()Jacksonville
 https://wg21.link/LWG2975";>2975Missing case for 
pair construction in scoped and polymorphic 
allocatorsJacksonville
 https://wg21.link/LWG2989";>2989path's 
stream insertion operator lets you insert everything under the 
sunJacksonvilleCompleted
@@ -77,15 +77,15 @@
 https://wg21.link/LWG3010";>3010[networking.ts] 
uses_executor says "if a type T::executor_type 
exists"Jacksonville
 https://wg21.link/LWG3013";>3013(recursive_)directory_iterator
 construction and traversal should not be 
noexceptJacksonvilleComplete
 https://wg21.link/LWG3014";>3014More 
noexcept issues with filesystem 
operationsJacksonvilleComplete
-  https://wg21.link/LWG3015";>3015copy_options::unspecified
 underspecifiedJacksonvilleNothing to do
+https://wg21.link/LWG3015";>3015copy_options::unspecified
 underspecifiedJacksonvilleNothing to do
 https://wg21.link/LWG3017";>3017list 
splice functions should use 
addressofJacksonville
 https://wg21.link/LWG3020";>3020[networking.ts] 
Remove spurious nested value_type buffer sequence 
requirementJacksonville
 https://wg21.link/LWG3026";>3026filesystem::weakly_canonical
 still defined in terms of canonical(p, 
base)Jacksonville
 https://wg21.link/LWG3030";>3030Who shall meet 
the requirements of try_lock?Jacksonville
 https://wg21.link/LWG3034";>3034P0767R1 breaks 
previously-standard-layout typesJacksonville
-https://wg21.link/LWG3035";>3035std::allocator's 
constructors should be 
constexprJacksonville
-https://wg21.link/LWG3039";>3039Unnecessary 
decay in thread and 
packaged_taskJacksonville
-https://wg21.link/LWG3041";>3041Unnecessary 
decay in 
reference_wrapperJacksonville
+https://wg21.link/LWG3035";>3035std::allocator's 
constructors should be constexprJacksonvillePatch 
Ready
+https://wg21.link/LWG3039";>3039Unnecessary 
decay in thread and 
packaged_taskJacksonvillePatch Ready
+https://wg21.link/LWG3041";>3041Unnecessary 
decay in 
reference_wrapperJacksonvillePatch 
Ready
 https://wg21.link/LWG3042";>3042is_literal_type_v 
should be inlineJacksonvilleComplete
 https://wg21.link/LWG3043";>3043Bogus 
postcondition for filesystem_error 
constructorJacksonville
 https://wg21.link/LWG3045";>3045atomic
 doesn't have value_type or 
difference_typeJacksonville
@@ -131,7 +131,7 @@
  3026 - I think this is just wording cleanup - Eric?
  3030 - Wording changes only?? Do we handle exceptions correctly here?
  3034 - Need to check if our tests are correct.
- 3035 - Easy to do
+ 3035 - Patch Ready
  3039 - Patch Ready
  3041 - Patch Ready
  3042 - We already do this.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324310 - Mark issue 3034 as 'Patch Ready'

2018-02-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb  5 19:23:16 2018
New Revision: 324310

URL: http://llvm.org/viewvc/llvm-project?rev=324310&view=rev
Log:
Mark issue 3034 as 'Patch Ready'

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324310&r1=324309&r2=324310&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Feb  5 19:23:16 2018
@@ -81,7 +81,7 @@
 https://wg21.link/LWG3017";>3017list 
splice functions should use 
addressofJacksonville
 https://wg21.link/LWG3020";>3020[networking.ts] 
Remove spurious nested value_type buffer sequence 
requirementJacksonville
 https://wg21.link/LWG3026";>3026filesystem::weakly_canonical
 still defined in terms of canonical(p, 
base)Jacksonville
-https://wg21.link/LWG3030";>3030Who shall meet 
the requirements of try_lock?Jacksonville
+https://wg21.link/LWG3030";>3030Who shall meet 
the requirements of try_lock?JacksonvilleNothing 
to do
 https://wg21.link/LWG3034";>3034P0767R1 breaks 
previously-standard-layout typesJacksonville
 https://wg21.link/LWG3035";>3035std::allocator's 
constructors should be constexprJacksonvillePatch 
Ready
 https://wg21.link/LWG3039";>3039Unnecessary 
decay in thread and 
packaged_taskJacksonvillePatch Ready
@@ -129,7 +129,7 @@
  3017 - We don't do the splicing stuff yet
  3020 - No networking TS implementation yet
  3026 - I think this is just wording cleanup - Eric?
- 3030 - Wording changes only?? Do we handle exceptions correctly here?
+ 3030 - Wording changes only
  3034 - Need to check if our tests are correct.
  3035 - Patch Ready
  3039 - Patch Ready


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324312 - No, really this time mark 3034 as 'Patch Ready'

2018-02-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb  5 19:24:21 2018
New Revision: 324312

URL: http://llvm.org/viewvc/llvm-project?rev=324312&view=rev
Log:
No, really this time mark 3034 as 'Patch Ready'

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324312&r1=324311&r2=324312&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Feb  5 19:24:21 2018
@@ -82,7 +82,7 @@
 https://wg21.link/LWG3020";>3020[networking.ts] 
Remove spurious nested value_type buffer sequence 
requirementJacksonville
 https://wg21.link/LWG3026";>3026filesystem::weakly_canonical
 still defined in terms of canonical(p, 
base)Jacksonville
 https://wg21.link/LWG3030";>3030Who shall meet 
the requirements of try_lock?JacksonvilleNothing 
to do
-https://wg21.link/LWG3034";>3034P0767R1 breaks 
previously-standard-layout typesJacksonville
+https://wg21.link/LWG3034";>3034P0767R1 breaks 
previously-standard-layout typesJacksonvillePatch 
Ready
 https://wg21.link/LWG3035";>3035std::allocator's 
constructors should be constexprJacksonvillePatch 
Ready
 https://wg21.link/LWG3039";>3039Unnecessary 
decay in thread and 
packaged_taskJacksonvillePatch Ready
 https://wg21.link/LWG3041";>3041Unnecessary 
decay in 
reference_wrapperJacksonvillePatch 
Ready
@@ -130,7 +130,7 @@
  3020 - No networking TS implementation yet
  3026 - I think this is just wording cleanup - Eric?
  3030 - Wording changes only
- 3034 - Need to check if our tests are correct.
+ 3034 - Patch Ready
  3035 - Patch Ready
  3039 - Patch Ready
  3041 - Patch Ready


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324378 - Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch.

2018-02-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb  6 10:58:05 2018
New Revision: 324378

URL: http://llvm.org/viewvc/llvm-project?rev=324378&view=rev
Log:
Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves 
https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch.

Modified:
libcxx/trunk/include/__string
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/__string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__string?rev=324378&r1=324377&r2=324378&view=diff
==
--- libcxx/trunk/include/__string (original)
+++ libcxx/trunk/include/__string Tue Feb  6 10:58:05 2018
@@ -266,7 +266,7 @@ const char*
 char_traits::find(const char_type* __s, size_t __n, const char_type& 
__a) _NOEXCEPT
 {
 if (__n == 0)
-return NULL;
+return nullptr;
 #if __has_feature(cxx_constexpr_string_builtins)
 return __builtin_char_memchr(__s, to_int_type(__a), __n);
 #elif _LIBCPP_STD_VER <= 14
@@ -278,7 +278,7 @@ char_traits::find(const char_type*
 return __s;
 ++__s;
 }
-return NULL;
+return nullptr;
 #endif
 }
 
@@ -372,9 +372,9 @@ const wchar_t*
 char_traits::find(const char_type* __s, size_t __n, const char_type& 
__a) _NOEXCEPT
 {
 if (__n == 0)
-return NULL;
+return nullptr;
 #if __has_feature(cxx_constexpr_string_builtins)
-return __builtin_wmemchr(__s, __a, __n);
+return __builtin_wmemchr(__s, __a, __n);
 #elif _LIBCPP_STD_VER <= 14
 return wmemchr(__s, __a, __n);
 #else
@@ -384,7 +384,7 @@ char_traits::find(const char_ty
 return __s;
 ++__s;
 }
-return NULL;
+return nullptr;
 #endif
 }
 

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=324378&r1=324377&r2=324378&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Tue Feb  6 10:58:05 2018
@@ -4703,9 +4703,9 @@ __stable_sort_move(_RandomAccessIterator
 ::new(__first2) value_type(_VSTD::move(*__first1));
 return;
 case 2:
-   __destruct_n __d(0);
+__destruct_n __d(0);
 unique_ptr __h2(__first2, __d);
- if (__comp(*--__last1, *__first1))
+if (__comp(*--__last1, *__first1))
 {
 ::new(__first2) value_type(_VSTD::move(*__last1));
 __d.__incr((value_type*)0);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324398 - Implement P0777: Treating unnecessay decay

2018-02-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb  6 12:56:55 2018
New Revision: 324398

URL: http://llvm.org/viewvc/llvm-project?rev=324398&view=rev
Log:
Implement P0777: Treating unnecessay decay

Modified:
libcxx/trunk/include/optional
libcxx/trunk/include/tuple
libcxx/trunk/include/type_traits
libcxx/trunk/include/variant

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=324398&r1=324397&r2=324398&view=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Tue Feb  6 12:56:55 2018
@@ -612,8 +612,8 @@ private:
 };
 template 
 using _CheckOptionalArgsCtor = conditional_t<
-!is_same_v, in_place_t> &&
-!is_same_v, optional>,
+!is_same_v<__uncvref_t<_Up>, in_place_t> &&
+!is_same_v<__uncvref_t<_Up>, optional>,
 _CheckOptionalArgsConstructor,
 __check_tuple_constructor_fail
 >;
@@ -761,7 +761,7 @@ public:
   class = enable_if_t
   <__lazy_and<
   integral_constant, optional> &&
+  !is_same_v<__uncvref_t<_Up>, optional> &&
   !(is_same_v<_Up, value_type> && 
is_scalar_v)
   >,
   is_constructible,

Modified: libcxx/trunk/include/tuple
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=324398&r1=324397&r2=324398&view=diff
==
--- libcxx/trunk/include/tuple (original)
+++ libcxx/trunk/include/tuple Tue Feb  6 12:56:55 2018
@@ -211,7 +211,7 @@ public:
 template ::type, 
__tuple_leaf>>
+  __lazy_not::type, 
__tuple_leaf>>
 , is_constructible<_Hp, _Tp>
 >::value
 >::type
@@ -293,7 +293,7 @@ public:
 template ::type, 
__tuple_leaf>>
+__lazy_not::type, 
__tuple_leaf>>
   , is_constructible<_Hp, _Tp>
 >::value
 >::type
@@ -1383,7 +1383,7 @@ constexpr decltype(auto) apply(_Fn && __
 _LIBCPP_NOEXCEPT_RETURN(
 _VSTD::__apply_tuple_impl(
 _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
-typename __make_tuple_indices>>::type{})
+typename 
__make_tuple_indices>>::type{})
 )
 
 template 
@@ -1398,7 +1398,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 constexpr _Tp make_from_tuple(_Tuple&& __t)
 _LIBCPP_NOEXCEPT_RETURN(
 _VSTD::__make_from_tuple_impl<_Tp>(_VSTD::forward<_Tuple>(__t),
-typename __make_tuple_indices>>::type{})
+typename 
__make_tuple_indices>>::type{})
 )
 
 #undef _LIBCPP_NOEXCEPT_RETURN

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=324398&r1=324397&r2=324398&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Feb  6 12:56:55 2018
@@ -1180,9 +1180,7 @@ struct __is_same_uncvref : is_same 17
 // aligned_union - same as __uncvref
 template 
-struct remove_cvref {
-using type = remove_cv_t>;
-};
+struct remove_cvref : public __uncvref<_Tp> {};
 
 template  using remove_cvref_t = typename remove_cvref<_Tp>::type;
 #endif

Modified: libcxx/trunk/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=324398&r1=324397&r2=324398&view=diff
==
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Tue Feb  6 12:56:55 2018
@@ -1143,9 +1143,9 @@ public:
 
   template <
   class _Arg,
-  enable_if_t, variant>, int> = 0,
-  enable_if_t>::value, int> = 0,
-  enable_if_t>::value, int> = 0,
+  enable_if_t, variant>, int> = 0,
+  enable_if_t>::value, int> = 0,
+  enable_if_t>::value, int> = 0,
   class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
   size_t _Ip =
   __find_detail::__find_unambiguous_index_sfinae<_Tp, 
_Types...>::value,
@@ -1215,7 +1215,7 @@ public:
 
   template <
   class _Arg,
-  enable_if_t, variant>, int> = 0,
+  enable_if_t, variant>, int> = 0,
   class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
   size_t _Ip =
   __find_detail::__find_unambiguous_index_sfinae<_Tp, 
_Types...>::value,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324399 - Mark P0777 as complete

2018-02-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb  6 13:00:58 2018
New Revision: 324399

URL: http://llvm.org/viewvc/llvm-project?rev=324399&view=rev
Log:
Mark P0777 as complete

Modified:
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/www/cxx2a_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=324399&r1=324398&r2=324399&view=diff
==
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Tue Feb  6 13:00:58 2018
@@ -71,7 +71,7 @@
https://wg21.link/P0718R2";>P0718R2LWGAtomic 
shared_ptrAlbuquerque
https://wg21.link/P0767R1";>P0767R1CWGDeprecate 
PODAlbuquerque
https://wg21.link/P0768R1";>P0768R1CWGLibrary 
Support for the Spaceship (Comparison) 
OperatorAlbuquerque
-   https://wg21.link/P0777R1";>P0777R1LWGTreating 
Unnecessary decayAlbuquerque
+   https://wg21.link/P0777R1";>P0777R1LWGTreating 
Unnecessary 
decayAlbuquerqueComplete7.0
 
 
   
@@ -135,7 +135,7 @@
 
   
 
-  Last Updated: 31-Jan-2018
+  Last Updated: 6-Feb-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324423 - Remove more of the std::experimental bits that are now in std::. All the _v type aliases, conjunction/disjunction, apply, etc. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb  6 15:13:48 2018
New Revision: 324423

URL: http://llvm.org/viewvc/llvm-project?rev=324423&view=rev
Log:
Remove more of the std::experimental bits that are now in std::. All the _v 
type aliases, conjunction/disjunction, apply, etc. See 
https://libcxx.llvm.org/TS_deprecation.html

Removed:
libcxx/trunk/test/libcxx/experimental/utilities/ratio/
libcxx/trunk/test/libcxx/experimental/utilities/syserror/
libcxx/trunk/test/libcxx/experimental/utilities/time/
libcxx/trunk/test/libcxx/experimental/utilities/tuple/
libcxx/trunk/test/std/experimental/utilities/meta/meta.logical/
libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/
libcxx/trunk/test/std/experimental/utilities/ratio/
libcxx/trunk/test/std/experimental/utilities/syserror/
libcxx/trunk/test/std/experimental/utilities/time/
libcxx/trunk/test/std/experimental/utilities/tuple/
Modified:
libcxx/trunk/include/experimental/chrono
libcxx/trunk/include/experimental/ratio
libcxx/trunk/include/experimental/system_error
libcxx/trunk/include/experimental/tuple
libcxx/trunk/include/experimental/type_traits
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp
libcxx/trunk/test/libcxx/min_max_macros.sh.cpp

Modified: libcxx/trunk/include/experimental/chrono
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/chrono?rev=324423&r1=324422&r2=324423&view=diff
==
--- libcxx/trunk/include/experimental/chrono (original)
+++ libcxx/trunk/include/experimental/chrono Tue Feb  6 15:13:48 2018
@@ -8,52 +8,4 @@
 //
 
//===--===//
 
-#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
-#define _LIBCPP_EXPERIMENTAL_CHRONO
-
-/**
-experimental/chrono synopsis
-
-// C++1y
-
-#include 
-
-namespace std {
-namespace chrono {
-namespace experimental {
-inline namespace fundamentals_v1 {
-
-  // See C++14 20.12.4, customization traits
-  template  constexpr bool treat_as_floating_point_v
-= treat_as_floating_point::value;
-
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace chrono
-} // namespace std
-
- */
-
-#include 
-#include 
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER > 11
-
-_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS
-
-#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
-
-template  _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
-= treat_as_floating_point<_Rep>::value;
-
-#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
-
-_LIBCPP_END_NAMESPACE_CHRONO_LFTS
-
-#endif /* _LIBCPP_STD_VER > 11 */
-
-#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */
+#error " has been removed. Use  instead."

Modified: libcxx/trunk/include/experimental/ratio
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/ratio?rev=324423&r1=324422&r2=324423&view=diff
==
--- libcxx/trunk/include/experimental/ratio (original)
+++ libcxx/trunk/include/experimental/ratio Tue Feb  6 15:13:48 2018
@@ -8,70 +8,4 @@
 //
 
//===--===//
 
-#ifndef _LIBCPP_EXPERIMENTAL_RATIO
-#define _LIBCPP_EXPERIMENTAL_RATIO
-
-/**
-experimental/ratio synopsis
-C++1y
-#include 
-
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-
-  // See C++14 20.11.5, ratio comparison
-  template  constexpr bool ratio_equal_v
-= ratio_equal::value;
-  template  constexpr bool ratio_not_equal_v
-= ratio_not_equal::value;
-  template  constexpr bool ratio_less_v
-= ratio_less::value;
-  template  constexpr bool ratio_less_equal_v
-= ratio_less_equal::value;
-  template  constexpr bool ratio_greater_v
-= ratio_greater::value;
-  template  constexpr bool ratio_greater_equal_v
-= ratio_greater_equal::value;
-
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
-*/
-
-#include 
-
-#if _LIBCPP_STD_VER > 11
-
-#include 
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS
-
-#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
-
-template  _LIBCPP_CONSTEXPR bool ratio_equal_v
-= ratio_equal<_R1, _R2>::value;
-
-template  _LIBCPP_CONSTEXPR bool ratio_not_equal_v
-= ratio_not_equal<_R1, _R2>::value;
-
-template  _LIBCPP_CONSTEXPR bool ratio_less_v
-= ratio_less<_R1, _R2>::value;
-
-template  _LIBCPP_CONSTEXPR bool ratio_less_equal_v
-= ratio_less_equal<_R1, _R2>::value;
-
-template  _LIBCPP_CONSTEXPR bool ratio_greater_v
-= ratio_greater<_R1, _R2>::value;
-
-template  _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
-= ratio_greater_equal<_R1, _R2>::value;
-
-#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
-
-_LIBCPP_END_NAMESPACE_LFTS
-
-#endif /* _LIBCPP_STD_VER > 11 */
-
-#endif // _LIBCPP_EXPERIMENTAL_RATIO
+#error " has been removed. Use  i

[libcxx] r324503 - Comment on 'Review' issues

2018-02-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb  7 11:24:37 2018
New Revision: 324503

URL: http://llvm.org/viewvc/llvm-project?rev=324503&view=rev
Log:
Comment on 'Review' issues

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324503&r1=324502&r2=324503&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Feb  7 11:24:37 2018
@@ -32,7 +32,7 @@
 
 
   
-  libc++ Upcoming Metting Status
+  libc++ Upcoming Meeting Status
   
 
   This is a temporary page; please check the c++1z status here
@@ -97,7 +97,7 @@
 Issues to "Review"
 
 Issue #Issue NameMeetingStatus
-https://wg21.link/LWG2412";>2412promise::set_value() 
and promise::get_future() should not 
raceJacksonville
+https://wg21.link/LWG2412";>2412promise::set_value() 
and promise::get_future() should not 
raceJacksonvilleComplete
 https://wg21.link/LWG2682";>2682filesystem::copy()
 won't create a symlink to a directoryJacksonville
 https://wg21.link/LWG2697";>2697[concurr.ts] 
Behavior of future/shared_future unwrapping constructor when given an 
invalid futureJacksonville
 https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending()
 is incorrectly specifiedJacksonville
@@ -143,14 +143,14 @@
 
 Comments about the "Review" issues
 
- 2412 - 
- 2682 - 
- 2697 - 
- 2708 - 
- 2936 - 
+ 2412 - I think we do this already
+ 2682 - Eric - don't we do this already? 
+ 2697 - No concurrency TS implementation yet
+ 2708 - Eric? 
+ 2936 - Eric - don't we do this already?
 
 
-Last Updated: 5-Feb-2018
+Last Updated: 7-Feb-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324531 - Fix PR#31454 - 'basic_string::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. Thi

2018-02-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb  7 13:30:17 2018
New Revision: 324531

URL: http://llvm.org/viewvc/llvm-project?rev=324531&view=rev
Log:
Fix PR#31454 - 'basic_string::push_back() crashes if sizeof(T)>sizeof(long 
long)'. We were mishandling the small-string optimization calculations for very 
large 'characters'. This may be an ABI change (change the size of) strings of 
very large 'characters', but since they never worked, I'm not too concerned.

Modified:
libcxx/trunk/include/string

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=324531&r1=324530&r2=324531&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Feb  7 13:30:17 2018
@@ -1363,9 +1363,13 @@ private:
 enum {__alignment = 16};
 static _LIBCPP_INLINE_VISIBILITY
 size_type __recommend(size_type __s) _NOEXCEPT
-{return (__s < __min_cap ? static_cast(__min_cap) :
- __align_it (__s+1)) - 1;}
+{
+if (__s < __min_cap) return static_cast(__min_cap) - 1;
+size_type __guess = __align_it (__s+1) - 1;
+if (__guess == __min_cap) ++__guess;
+return __guess;
+}
 
 inline
 void __init(const value_type* __s, size_type __sz, size_type __reserve);

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp?rev=324531&r1=324530&r2=324531&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
 Wed Feb  7 13:30:17 2018
@@ -48,7 +48,7 @@ int main()
 test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
 }
 #endif
-#if 0
+
 {
 // https://bugs.llvm.org/show_bug.cgi?id=31454
 std::basic_string s;
@@ -57,5 +57,4 @@ int main()
 s.push_back(vl);
 s.push_back(vl);
 }
-#endif
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324566 - Improve a test. NFC

2018-02-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb  7 21:47:40 2018
New Revision: 324566

URL: http://llvm.org/viewvc/llvm-project?rev=324566&view=rev
Log:
Improve a test. NFC

Modified:
libcxx/trunk/test/libcxx/memory/is_allocator.pass.cpp

Modified: libcxx/trunk/test/libcxx/memory/is_allocator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/memory/is_allocator.pass.cpp?rev=324566&r1=324565&r2=324566&view=diff
==
--- libcxx/trunk/test/libcxx/memory/is_allocator.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/memory/is_allocator.pass.cpp Wed Feb  7 21:47:40 
2018
@@ -26,6 +26,7 @@
 template 
 void test_allocators()
 {
+   static_assert(!std::__is_allocator::value, "" );
static_assert( std::__is_allocator>::value, "" );
static_assert( std::__is_allocator>::value, "" );
static_assert( std::__is_allocator>::value, "" );


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324569 - Implement deduction guide for basic_string as described in P0433

2018-02-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb  7 22:34:03 2018
New Revision: 324569

URL: http://llvm.org/viewvc/llvm-project?rev=324569&view=rev
Log:
Implement deduction guide for basic_string as described in P0433

Added:
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
Modified:
libcxx/trunk/include/string
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=324569&r1=324568&r2=324569&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Wed Feb  7 22:34:03 2018
@@ -311,6 +311,13 @@ public:
 bool __invariants() const;
 };
 
+template::value_type>>
+basic_string(InputIterator, InputIterator, Allocator = Allocator())
+   -> basic_string::value_type,
+  char_traits::value_type>,
+  Allocator>;   // C++17
+
 template
 basic_string
 operator+(const basic_string& lhs,
@@ -1485,6 +1492,18 @@ private:
 friend basic_string operator+<>(const basic_string&, value_type);
 };
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template::value_type,
+ class _Allocator = allocator<_CharT>,
+ class = typename 
enable_if<__is_input_iterator<_InputIterator>::value, void>::type,
+ class = typename enable_if<__is_allocator<_Allocator>::value, 
void>::type
+ >
+basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
+  -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
+#endif
+
+  
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 void

Added: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp?rev=324569&view=auto
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
(added)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
Wed Feb  7 22:34:03 2018
@@ -0,0 +1,54 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template::value_type>>
+//  basic_string(InputIterator, InputIterator, Allocator = Allocator())
+//-> basic_string::value_type,
+// char_traits::value_type>,
+// Allocator>;
+//
+//  The deduction guide shall not participate in overload resolution if 
InputIterator
+//  is a type that does not qualify as an input iterator, or if Allocator is a 
type
+//  that does not qualify as an allocator.
+
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+class NotAnItertor {};
+
+template 
+struct NotAnAllocator { typedef T value_type; };
+
+int main()
+{
+{ // Not an iterator at all
+std::basic_string s1{NotAnItertor{}, NotAnItertor{}, 
std::allocator{}}; // expected-error {{no viable constructor or deduction 
guide for deduction of template arguments of 'basic_string'}}
+}
+{ // Not an input iterator
+const char16_t* s = u"12345678901234";
+std::basic_string s0;
+std::basic_string s1{std::back_insert_iterator(s0), //  expected-error 
{{no viable constructor or deduction guide for deduction of template arguments 
of 'basic_string'}}
+ std::back_insert_iterator(s0),
+ std::allocator{}};
+}
+{ // Not an allocator
+const wchar_t* s = L"12345678901234";
+std::basic_string s1{s, s+10, NotAnAllocator{}}; // 
expected-error {{no viable constructor or deduction guide for deduction of 
template arguments of 'basic_string'}}
+}
+
+}

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp?rev=324569&r1=324568&r2=324569&view=diff
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
Wed Feb  7 22:34:03 2018
@@ -13,6 +13,18 @@
 //   basic_string(InputIterator begin, InputIterator end,
 //   const Allocator& a = Allocator());
 
+// template::value_type>>
+//  basic_string(InputIterator, InputIterator, Allocator = Allocator())
+//-> basic_string::value_type,
+// char_traits::value_type>,
+//

[libcxx] r324573 - Temporarily comment out deduction guide tests while I figure out what to do with old bots

2018-02-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb  7 23:20:45 2018
New Revision: 324573

URL: http://llvm.org/viewvc/llvm-project?rev=324573&view=rev
Log:
Temporarily comment out deduction guide tests while I figure out what to do 
with old bots

Modified:
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp?rev=324573&r1=324572&r2=324573&view=diff
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
Wed Feb  7 23:20:45 2018
@@ -9,6 +9,7 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: c++17
 
 // template::value_type>>

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp?rev=324573&r1=324572&r2=324573&view=diff
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
Wed Feb  7 23:20:45 2018
@@ -129,6 +129,7 @@ int main()
 }
 #endif
 
+#if 0
 //  Test deduction guides
 #if TEST_STD_VER > 14
 {
@@ -172,4 +173,5 @@ int main()
 assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
 }
 #endif
+#endif
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324609 - Update the status of removed components

2018-02-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Feb  8 06:51:22 2018
New Revision: 324609

URL: http://llvm.org/viewvc/llvm-project?rev=324609&view=rev
Log:
Update the status of removed components

Modified:
libcxx/trunk/www/TS_deprecation.html

Modified: libcxx/trunk/www/TS_deprecation.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/TS_deprecation.html?rev=324609&r1=324608&r2=324609&view=diff
==
--- libcxx/trunk/www/TS_deprecation.html (original)
+++ libcxx/trunk/www/TS_deprecation.html Thu Feb  8 06:51:22 2018
@@ -48,22 +48,22 @@
 
 SectionFeatureshipped instdTo 
be removed fromstd::experimentalNotes
 2.1uses_allocator 
construction5.07.0
-3.1.2erased_typen/aNot
 part of C++17
-3.2.1tuple_size_v5.07.0
-3.2.2apply5.07.0
-3.3.1All of the '_v' traits in 
5.07.0
+3.1.2erased_typen/aNot
 part of C++17
+3.2.1tuple_size_v5.07.0Removed
+3.2.2apply5.07.0Removed
+3.3.1All of the '_v' traits in 
5.07.0Removed
 3.3.2invocation_type and 
raw_invocation_typen/aNot
 part of C++17
-3.3.3Logical operator 
traits5.07.0
+3.3.3Logical operator 
traits5.07.0Removed
 3.3.3Detection 
Idiom5.0Only partially in 
C++17
-3.4.1All of the '_v' traits in 
5.07.0
-3.5.1All of the '_v' traits in 
5.07.0
-3.6.1All of the '_v' traits in 
5.07.0
+3.4.1All of the '_v' traits in 
5.07.0Removed
+3.5.1All of the '_v' traits in 
5.07.0Removed
+3.6.1All of the '_v' traits in 
5.07.0Removed
 
3.7propagate_constn/aNot
 part of C++17
 4.2Enhancements to functionNot 
yet
 
4.3searchers7.09.0
-5optional5.07.0
-6any5.07.0
-7string_view5.07.0
+5optional5.07.0Removed
+6any5.07.0Removed
+7string_view5.07.0Removed
 8.2.1shared_ptr enhancementsNot 
yetNever added
 8.2.2weak_ptr enhancementsNot 
yetNever added
 8.5memory_resourceNot 
yet
@@ -77,9 +77,9 @@
 
11.2promisen/aNot
 part of C++17
 
11.3packaged_taskn/aNot
 part of C++17
 
12.2search7.09.0
-12.3sample5.07.0
+12.3sample5.07.0Removed
 12.4shuffleNot part of 
C++17
-13.1gcd and 
lcm5.07.0
+13.1gcd and 
lcm5.07.0Removed
 13.2Random number generationNot part 
of C++17
 14Reflection LibraryNot part of 
C++17
 
@@ -132,7 +132,7 @@
 
 
   
-  Last Updated: 8-Jan-2018
+  Last Updated: 8-Feb-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324619 - Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode

2018-02-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Feb  8 08:25:57 2018
New Revision: 324619

URL: http://llvm.org/viewvc/llvm-project?rev=324619&view=rev
Log:
Clean up string's deduction guides tests. Mark old versions of clang as 
unsupported, b/c they don't have deduction guides, even in C++17 mode

Added:

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
  - copied, changed from r324618, 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
Removed:
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
Modified:
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp

Removed: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp?rev=324618&view=auto
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp 
(removed)
@@ -1,55 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// 
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: c++17
-
-// template::value_type>>
-//  basic_string(InputIterator, InputIterator, Allocator = Allocator())
-//-> basic_string::value_type,
-// char_traits::value_type>,
-// Allocator>;
-//
-//  The deduction guide shall not participate in overload resolution if 
InputIterator
-//  is a type that does not qualify as an input iterator, or if Allocator is a 
type
-//  that does not qualify as an allocator.
-
-
-#include 
-#include 
-#include 
-#include 
-
-#include "test_macros.h"
-
-class NotAnItertor {};
-
-template 
-struct NotAnAllocator { typedef T value_type; };
-
-int main()
-{
-{ // Not an iterator at all
-std::basic_string s1{NotAnItertor{}, NotAnItertor{}, 
std::allocator{}}; // expected-error {{no viable constructor or deduction 
guide for deduction of template arguments of 'basic_string'}}
-}
-{ // Not an input iterator
-const char16_t* s = u"12345678901234";
-std::basic_string s0;
-std::basic_string s1{std::back_insert_iterator(s0), //  expected-error 
{{no viable constructor or deduction guide for deduction of template arguments 
of 'basic_string'}}
- std::back_insert_iterator(s0),
- std::allocator{}};
-}
-{ // Not an allocator
-const wchar_t* s = L"12345678901234";
-std::basic_string s1{s, s+10, NotAnAllocator{}}; // 
expected-error {{no viable constructor or deduction guide for deduction of 
template arguments of 'basic_string'}}
-}
-
-}

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp?rev=324619&r1=324618&r2=324619&view=diff
==
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
(original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp 
Thu Feb  8 08:25:57 2018
@@ -13,17 +13,6 @@
 //   basic_string(InputIterator begin, InputIterator end,
 //   const Allocator& a = Allocator());
 
-// template::value_type>>
-//  basic_string(InputIterator, InputIterator, Allocator = Allocator())
-//-> basic_string::value_type,
-// char_traits::value_type>,
-// Allocator>;
-//
-// The deduction guide shall not participate in overload resolution if 
InputIterator
-//  is a type that does not qualify as an input iterator, or if Allocator is a 
type
-//  that does not qualify as an allocator.
-
 
 #include 
 #include 
@@ -128,50 +117,4 @@ int main()
 test(input_iterator(s), input_iterator(s+50), 
A());
 }
 #endif
-
-#if 0
-//  Test deduction guides
-#if TEST_STD_VER > 14
-{
-const char* s = "12345678901234";
-std::basic_string s1{s, s+10, std::allocator{}};
-using S = decltype(s1); // what type did we get?
-static_assert(std::is_same_v,  
"");
-static_assert(std::is_same_v>, 
"");
-static_assert(std::is_same_v>, 
"");
-assert(s1.size() == 10);
-assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
-}
-{
-const wchar_t* s = L"12345678901234";
-std::basic_string s1{s, s+10, test_allocator{}};
-using S = decltype(s1); // what type did we get?
-

[libcxx] r324624 - Once more, with feeling. Spell 'clang-4.0' correctly this time

2018-02-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Feb  8 09:06:08 2018
New Revision: 324624

URL: http://llvm.org/viewvc/llvm-project?rev=324624&view=rev
Log:
Once more, with feeling. Spell 'clang-4.0' correctly this time

Modified:

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp?rev=324624&r1=324623&r2=324624&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
 Thu Feb  8 09:06:08 2018
@@ -9,7 +9,7 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang.4-0
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang-4.0
 
 // template::value_type>>

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp?rev=324624&r1=324623&r2=324624&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 Thu Feb  8 09:06:08 2018
@@ -9,7 +9,7 @@
 
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang.4-0
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang-4.0
 
 // template
 //   basic_string(InputIterator begin, InputIterator end,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324640 - The apple versions of clang don't support deduction guides yet.

2018-02-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Feb  8 11:33:03 2018
New Revision: 324640

URL: http://llvm.org/viewvc/llvm-project?rev=324640&view=rev
Log:
The apple versions of clang don't support deduction guides yet.

Modified:

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp?rev=324640&r1=324639&r2=324640&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
 Thu Feb  8 11:33:03 2018
@@ -10,6 +10,7 @@
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang-4.0
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0
 
 // template::value_type>>

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp?rev=324640&r1=324639&r2=324640&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 Thu Feb  8 11:33:03 2018
@@ -10,6 +10,7 @@
 // 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8, clang-3.9, clang-4.0
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0
 
 // template
 //   basic_string(InputIterator begin, InputIterator end,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324851 - Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch

2018-02-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Feb 11 13:51:49 2018
New Revision: 324851

URL: http://llvm.org/viewvc/llvm-project?rev=324851&view=rev
Log:
Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch

Modified:
libcxx/trunk/include/utility

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=324851&r1=324850&r2=324851&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Sun Feb 11 13:51:49 2018
@@ -52,7 +52,7 @@ template 
 >::type
 move_if_noexcept(T& x) noexcept; // constexpr in C++14
 
-template  constexpr add_const_t& as_const(T& t) noexcept;  // 
C++17
+template  constexpr add_const_t& as_const(T& t) noexcept;  // 
C++17
 template   void as_const(const T&&) = delete; // 
C++17
 
 template  typename add_rvalue_reference::type declval() noexcept;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324895 - While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented

2018-02-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb 12 07:41:25 2018
New Revision: 324895

URL: http://llvm.org/viewvc/llvm-project?rev=324895&view=rev
Log:
While implementing P0777 - preventing unnecessary decay, I found some 
non-public uses of decay that could be replaced by __uncvref. NFC intented

Modified:
libcxx/trunk/include/experimental/functional
libcxx/trunk/include/variant

Modified: libcxx/trunk/include/experimental/functional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/functional?rev=324895&r1=324894&r2=324895&view=diff
==
--- libcxx/trunk/include/experimental/functional (original)
+++ libcxx/trunk/include/experimental/functional Mon Feb 12 07:41:25 2018
@@ -241,8 +241,8 @@ public:
 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
 {
 static_assert ( std::is_same<
-typename std::decay::value_type>::type, 
-typename std::decay::value_type>::type
+typename std::__uncvref::value_type>::type, 
+typename std::__uncvref::value_type>::type
 >::value,
 "Corpus and Pattern iterators must point to the same type" );
 
@@ -394,8 +394,8 @@ public:
 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
 {
 static_assert ( std::is_same<
-typename std::decay::value_type>::type, 
-typename std::decay::value_type>::type
+typename std::__uncvref::value_type>::type, 
+typename std::__uncvref::value_type>::type
 >::value,
 "Corpus and Pattern iterators must point to the same type" );
 

Modified: libcxx/trunk/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=324895&r1=324894&r2=324895&view=diff
==
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Mon Feb 12 07:41:25 2018
@@ -476,8 +476,8 @@ private:
   template 
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto __make_farray(_Fs&&... __fs) {
-__std_visit_visitor_return_type_check...>();
-using __result = array...>, sizeof...(_Fs)>;
+__std_visit_visitor_return_type_check<__uncvref_t<_Fs>...>();
+using __result = array...>, sizeof...(_Fs)>;
 return __result{{_VSTD::forward<_Fs>(__fs)...}};
   }
 
@@ -514,8 +514,8 @@ private:
   template 
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto __make_fdiagonal() {
-constexpr size_t _Np = decay_t<_Vp>::__size();
-static_assert(__all<(_Np == decay_t<_Vs>::__size())...>::value);
+constexpr size_t _Np = __uncvref_t<_Vp>::__size();
+static_assert(__all<(_Np == __uncvref_t<_Vs>::__size())...>::value);
 return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{});
   }
 
@@ -538,7 +538,7 @@ private:
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto __make_fmatrix() {
 return __make_fmatrix_impl<_Fp, _Vs...>(
-index_sequence<>{}, make_index_sequence::__size()>{}...);
+index_sequence<>{}, 
make_index_sequence<__uncvref_t<_Vs>::__size()>{}...);
   }
 };
 
@@ -756,7 +756,7 @@ _LIBCPP_VARIANT_DESTRUCTOR(
   if (!this->valueless_by_exception()) {
 __visitation::__base::__visit_alt(
 [](auto& __alt) noexcept {
-  using __alt_type = decay_t;
+  using __alt_type = __uncvref_t;
   __alt.~__alt_type();
 },
 *this);
@@ -1564,7 +1564,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<
? 299792458 // Random value chosen by the universe upon creation
: __variant::__visit_alt(
  [](const auto& __alt) {
-   using __alt_type = decay_t;
+   using __alt_type = __uncvref_t;
using __value_type = remove_const_t<
  typename __alt_type::__value_type>;
return hash<__value_type>{}(__alt.__value);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324911 - Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that)

2018-02-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb 12 09:26:40 2018
New Revision: 324911

URL: http://llvm.org/viewvc/llvm-project?rev=324911&view=rev
Log:
Implement LWG#2908 - The less-than operator for shared pointers could do more, 
and mark 2878 as complete as well (we already do that)

Modified:
libcxx/trunk/include/memory
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=324911&r1=324910&r2=324911&view=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Mon Feb 12 09:26:40 2018
@@ -4805,8 +4805,13 @@ inline _LIBCPP_INLINE_VISIBILITY
 bool
 operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
 {
+#if _LIBCPP_STD_VER <= 11
 typedef typename common_type<_Tp*, _Up*>::type _Vp;
 return less<_Vp>()(__x.get(), __y.get());
+#else
+return less<>()(__x.get(), __y.get());
+#endif
+
 }
 
 template

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=324911&r1=324910&r2=324911&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Feb 12 09:26:40 2018
@@ -483,13 +483,13 @@
https://wg21.link/LWG2874";>2874Constructor 
shared_ptr::shared_ptr(Y*) should be constrainedKona
https://wg21.link/LWG2875";>2875shared_ptr::shared_ptr(Y*, D, 
[…]) constructors should be constrainedKona
https://wg21.link/LWG2876";>2876shared_ptr::shared_ptr(const 
weak_ptr&) constructor should be 
constrainedKona
-   https://wg21.link/LWG2878";>2878Missing 
DefaultConstructible requirement for istream_iterator default 
constructorKona
+   https://wg21.link/LWG2878";>2878Missing 
DefaultConstructible requirement for istream_iterator default 
constructorKonaComplete
https://wg21.link/LWG2890";>2890The 
definition of 'object state' applies only to class 
typesKonaComplete
https://wg21.link/LWG2900";>2900The copy 
and move constructors of optional are not 
constexprKonaComplete
https://wg21.link/LWG2903";>2903The form 
of initialization for the emplace-constructors is not 
specifiedKonaComplete
https://wg21.link/LWG2904";>2904Make 
variant move-assignment more exception 
safeKonaComplete
https://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy 
constructibleKonaComplete
-   https://wg21.link/LWG2908";>2908The 
less-than operator for shared pointers could do 
moreKona
+   https://wg21.link/LWG2908";>2908The 
less-than operator for shared pointers could do 
moreKonaComplete
https://wg21.link/LWG2911";>2911An 
is_aggregate type trait is neededKonaComplete
https://wg21.link/LWG2921";>2921packaged_task and type-erased 
allocatorsKonaComplete
https://wg21.link/LWG2934";>2934optional 
doesn't compare with TKonaComplete
@@ -504,7 +504,7 @@
 
   
 
-  Last Updated: 25-Jan-2018
+  Last Updated: 12-Feb-2018
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r324923 - Implement LWG 2835 - fix

2018-02-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Feb 12 11:13:24 2018
New Revision: 324923

URL: http://llvm.org/viewvc/llvm-project?rev=324923&view=rev
Log:
Implement LWG 2835 - fix 

Modified:
libcxx/trunk/include/tgmath.h
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/tgmath.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tgmath.h?rev=324923&r1=324922&r2=324923&view=diff
==
--- libcxx/trunk/include/tgmath.h (original)
+++ libcxx/trunk/include/tgmath.h Mon Feb 12 11:13:24 2018
@@ -14,16 +14,24 @@
 /*
 tgmath.h synopsis
 
-#include 
-#include 
+#include 
 
 */
 
-#include 
-#include 
+#include <__config>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
+#ifdef __cplusplus
+
+#include 
+
+#else  // __cplusplus
+
+#include_next 
+
+#endif  // __cplusplus
+
 #endif  // _LIBCPP_TGMATH_H

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=324923&r1=324922&r2=324923&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Feb 12 11:13:24 2018
@@ -467,7 +467,7 @@
https://wg21.link/LWG2824";>2824list::sort 
should say that the order of elements is unspecified if an exception is 
thrownKonaComplete
https://wg21.link/LWG2826";>2826string_view iterators use old 
wordingKonaComplete
https://wg21.link/LWG2834";>2834Resolution 
LWG 2223 is missing wording about end 
iteratorsKonaComplete
-   https://wg21.link/LWG2835";>2835LWG 2536 
seems to misspecify Kona
+   https://wg21.link/LWG2835";>2835LWG 2536 
seems to misspecify KonaComplete
https://wg21.link/LWG2837";>2837gcd and 
lcm should support a wider range of input 
valuesKonaComplete
https://wg21.link/LWG2838";>2838is_literal_type specification 
needs a little cleanupKonaComplete
https://wg21.link/LWG2842";>2842in_place_t 
check for optional::optional(U&&) should decay 
UKonaComplete


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r325147 - Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)

2018-02-14 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb 14 10:05:25 2018
New Revision: 325147

URL: http://llvm.org/viewvc/llvm-project?rev=325147&view=rev
Log:
Add a catch for std::length_error for the case where the string can't handle 
2GB. (like say 32-bit big-endian)


Modified:

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp

Modified: 
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp?rev=325147&r1=325146&r2=325147&view=diff
==
--- 
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
 Wed Feb 14 10:05:25 2018
@@ -32,12 +32,13 @@ int main()
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try {
 #endif
-   std::string str(2147483648, 'a');
-   SB sb;
-   sb.str(str);
-   assert(sb.pubpbase() <= sb.pubpptr());
+std::string str(2147483648, 'a');
+SB sb;
+sb.str(str);
+assert(sb.pubpbase() <= sb.pubpptr());
 #ifndef TEST_HAS_NO_EXCEPTIONS
-   }
-   catch (const std::bad_alloc &) {}
+}
+catch (const std::length_error &) {} // maybe the string can't take 2GB
+catch (const std::bad_alloc&) {} // maybe we don't have enough RAM
 #endif
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r325740 - Add another test case to the deduction guide for basic_string.

2018-02-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Feb 21 21:14:20 2018
New Revision: 325740

URL: http://llvm.org/viewvc/llvm-project?rev=325740&view=rev
Log:
Add another test case to the deduction guide for basic_string.

Modified:

libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp?rev=325740&r1=325739&r2=325740&view=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
 Wed Feb 21 21:14:20 2018
@@ -41,6 +41,17 @@ int main()
 {
 {
 const char* s = "12345678901234";
+std::basic_string s1(s, s+10);  // Can't use {} here
+using S = decltype(s1); // what type did we get?
+static_assert(std::is_same_v,  
"");
+static_assert(std::is_same_v>, 
"");
+static_assert(std::is_same_v>, 
"");
+assert(s1.size() == 10);
+assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
+}
+
+{
+const char* s = "12345678901234";
 std::basic_string s1{s, s+10, std::allocator{}};
 using S = decltype(s1); // what type did we get?
 static_assert(std::is_same_v,  
"");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r324290 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-24 Thread Marshall Clow via cfe-commits
On Thu, Feb 22, 2018 at 7:06 AM, Nico Weber  wrote:

> Out of interest, do you know why the non-experimental version doesn't have
> to_string()? What are folks supposed to use instead?
>

std::string has an (explicit) constructor from string_view.

-- Marshall
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r323971 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-24 Thread Marshall Clow via cfe-commits
On Thu, Feb 22, 2018 at 7:58 AM, Nico Weber  wrote:

> I have a small personal project where I used to use this. I tried
> switching to  instead, but that apparently requires -std=c++17.
> With that, things build fine with my locally-built clang, but latest Xcode
> clang doesn't accept that flag yet. So I tried -std=c++1z, but latest Xcode
> (9.2) doesn't even include the  header yet. So now I have no way
> of being able to build my project with both trunk clang and Xcode clang.
> Maybe a one-year deprecation period is too short?
>

Nico --

I'm sorry you were caught out by this.

(It's not a huge deal, I have a optional<> implementation in my project for
> platforms that don't ship it yet, but things used to be fine on mac until
> this change at least. It's also not an important project, I just thought
> I'd point out that this makes life more complicated than it would be if the
> deletion period was longer.)
>

Yes, but it also makes life less complicated also.

In fact, optional was the poster child for removing stuff from experimental.
experimental::optional and std::optional have diverged, and are
significantly different today (and only going to get more different in the
future)

The cost for someone to move to std::optional will never be lower than it
is now. (they're only going to become more different).

I really didn't (and don't) want to maintain two closely related (but
different, and slowly diverging) code bases - and (repeatedly) explain to
people the difference between them.

As for Apple not shipping std::optional, I too am dismayed by that, but I
have no control over that. :-(  I don't know when Apple will ship
std::optional (they don't share their product plans with me), but it
requires an update to libc++.dylib, and in the past they have gone *years*
without updating the dylib.   Hopefully they will update before LLVM 7
ships in August.

-- Marshall
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303824 - Add some constexpr tests for optional's move/copy ctor

2017-05-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed May 24 19:22:33 2017
New Revision: 303824

URL: http://llvm.org/viewvc/llvm-project?rev=303824&view=rev
Log:
Add some constexpr tests for optional's move/copy ctor

Modified:

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp?rev=303824&r1=303823&r2=303824&view=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
 Wed May 24 19:22:33 2017
@@ -32,6 +32,16 @@ void test(InitArgs&&... args)
 assert(*lhs == *rhs);
 }
 
+template 
+constexpr bool constexpr_test(InitArgs&&... args)
+{
+static_assert( std::is_trivially_copy_constructible_v, ""); // 
requirement
+const optional rhs(std::forward(args)...);
+optional lhs = rhs;
+return (lhs.has_value() == rhs.has_value()) &&
+   (lhs.has_value() ? *lhs == *rhs : true);
+}
+
 void test_throwing_ctor() {
 #ifndef TEST_HAS_NO_EXCEPTIONS
 struct Z {
@@ -108,6 +118,9 @@ int main()
 {
 test();
 test(3);
+static_assert(constexpr_test(), "" );
+static_assert(constexpr_test(3), "" );
+
 {
 const optional o(42);
 optional o2(o);

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp?rev=303824&r1=303823&r2=303824&view=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
 Wed May 24 19:22:33 2017
@@ -41,6 +41,17 @@ void test(InitArgs&&... args)
 assert(*lhs == *orig);
 }
 
+template 
+constexpr bool constexpr_test(InitArgs&&... args)
+{
+static_assert( std::is_trivially_copy_constructible_v, ""); // 
requirement
+const optional orig(std::forward(args)...);
+optional rhs(orig);
+optional lhs = std::move(rhs);
+return (lhs.has_value() == orig.has_value()) &&
+   (lhs.has_value() ? *lhs == *orig : true);
+}
+
 void test_throwing_ctor() {
 #ifndef TEST_HAS_NO_EXCEPTIONS
 struct Z {
@@ -144,6 +155,9 @@ int main()
 {
 test();
 test(3);
+static_assert(constexpr_test(), "" );
+static_assert(constexpr_test(3), "" );
+   
 {
 optional o(42);
 optional o2(std::move(o));


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303833 - Add non-parallel version of for_each_n (+tests) from the Parallelism TS

2017-05-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed May 24 21:29:54 2017
New Revision: 303833

URL: http://llvm.org/viewvc/llvm-project?rev=303833&view=rev
Log:
Add non-parallel version of for_each_n (+tests) from the Parallelism TS

Added:

libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=303833&r1=303832&r2=303833&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Wed May 24 21:29:54 2017
@@ -35,6 +35,9 @@ template 
+InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17
+
 template 
 InputIterator
 find(InputIterator first, InputIterator last, const T& value);
@@ -961,6 +964,24 @@ for_each(_InputIterator __first, _InputI
 return __f;
 }
 
+// for_each_n
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
+{
+typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+_IntegralSize __n = __orig_n;
+while (__n > 0)
+{
+ __f(*__first);
+ ++__first;
+ --__n;
+}
+return __first;
+}
+
 // find
 
 template 

Added: 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp?rev=303833&view=auto
==
--- 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
 Wed May 24 21:29:54 2017
@@ -0,0 +1,61 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template
+//InputIterator for_each_n(InputIterator first, Size n, Function f);
+
+
+#include 
+#include 
+
+#include "test_iterators.h"
+
+struct for_each_test
+{
+for_each_test(int c) : count(c) {}
+int count;
+void operator()(int& i) {++i; ++count;}
+};
+
+int main()
+{
+typedef input_iterator Iter;
+int ia[] = {0, 1, 2, 3, 4, 5};
+const unsigned s = sizeof(ia)/sizeof(ia[0]);
+
+{
+auto f = for_each_test(0);
+Iter it = std::for_each_n(Iter(ia), 0, std::ref(f));
+assert(it == Iter(ia));
+assert(f.count == 0);
+}
+
+{
+auto f = for_each_test(0);
+Iter it = std::for_each_n(Iter(ia), s, std::ref(f));
+
+assert(it == Iter(ia+s));
+assert(f.count == s);
+for (unsigned i = 0; i < s; ++i)
+assert(ia[i] == static_cast(i+1));
+}
+
+{
+auto f = for_each_test(0);
+Iter it = std::for_each_n(Iter(ia), 1, std::ref(f));
+
+assert(it == Iter(ia+1));
+assert(f.count == 1);
+for (unsigned i = 0; i < 1; ++i)
+assert(ia[i] == static_cast(i+2));
+}
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303856 - Make for_each_n only avaliable on C++17

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 08:40:57 2017
New Revision: 303856

URL: http://llvm.org/viewvc/llvm-project?rev=303856&view=rev
Log:
Make for_each_n only avaliable on C++17

Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=303856&r1=303855&r2=303856&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu May 25 08:40:57 2017
@@ -964,6 +964,7 @@ for_each(_InputIterator __first, _InputI
 return __f;
 }
 
+#if _LIBCPP_STD_VER > 14
 // for_each_n
 
 template 
@@ -981,6 +982,7 @@ for_each_n(_InputIterator __first, _Size
 }
 return __first;
 }
+#endif
 
 // find
 
@@ -1758,7 +1760,7 @@ __unwrap_iter(_Iter __i)
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1772,7 +1774,7 @@ __unwrap_iter(move_iterator<_Tp*> __i)
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1786,7 +1788,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303862 - Last commit included some extra constexpr; remove them

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 09:20:26 2017
New Revision: 303862

URL: http://llvm.org/viewvc/llvm-project?rev=303862&view=rev
Log:
Last commit included some extra constexpr; remove them

Modified:
libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=303862&r1=303861&r2=303862&view=diff
==
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu May 25 09:20:26 2017
@@ -1760,7 +1760,7 @@ __unwrap_iter(_Iter __i)
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1774,7 +1774,7 @@ __unwrap_iter(move_iterator<_Tp*> __i)
 #if _LIBCPP_DEBUG_LEVEL < 2
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,
@@ -1788,7 +1788,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
 #else
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 is_trivially_copy_assignable<_Tp>::value,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303876 - Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)

2017-05-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 25 11:05:54 2017
New Revision: 303876

URL: http://llvm.org/viewvc/llvm-project?rev=303876&view=rev
Log:
Mark LWG#2900 as complete - we already do this, and I checked the tests in a 
couple days ago (r303268 & r303824)

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=303876&r1=303875&r2=303876&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 25 11:05:54 2017
@@ -475,7 +475,7 @@
http://wg21.link/LWG2876";>2876shared_ptr::shared_ptr(const 
weak_ptr&) constructor should be 
constrainedKona
http://wg21.link/LWG2878";>2878Missing 
DefaultConstructible requirement for istream_iterator default 
constructorKona
http://wg21.link/LWG2890";>2890The 
definition of 'object state' applies only to class 
typesKonaComplete
-   http://wg21.link/LWG2900";>2900The copy 
and move constructors of optional are not 
constexprKona
+   http://wg21.link/LWG2900";>2900The copy 
and move constructors of optional are not 
constexprKonaComplete
http://wg21.link/LWG2903";>2903The form of 
initialization for the emplace-constructors is not 
specifiedKona
http://wg21.link/LWG2904";>2904Make 
variant move-assignment more exception safeKona
http://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy 
constructibleKonaComplete
@@ -489,7 +489,7 @@
 
   
 
-  Last Updated: 23-May-2017
+  Last Updated: 25-May-2017
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304617 - Fix some undefined behavior in __hash_table. Thanks to vsk for the report and the patch. Reviewed as https://reviews.llvm.org/D33588.

2017-06-02 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Jun  2 19:08:32 2017
New Revision: 304617

URL: http://llvm.org/viewvc/llvm-project?rev=304617&view=rev
Log:
Fix some undefined behavior in __hash_table. Thanks to vsk for the report and 
the patch. Reviewed as https://reviews.llvm.org/D33588.

Added:
libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp
Modified:
libcxx/trunk/include/__hash_table

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=304617&r1=304616&r2=304617&view=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Fri Jun  2 19:08:32 2017
@@ -137,7 +137,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 size_t
 __next_hash_pow2(size_t __n)
 {
-return size_t(1) << (std::numeric_limits::digits - __clz(__n-1));
+return __n < 2 ? __n : (size_t(1) << (std::numeric_limits::digits 
- __clz(__n-1)));
 }
 
 

Added: libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp?rev=304617&view=auto
==
--- libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp Fri Jun  2 
19:08:32 2017
@@ -0,0 +1,80 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// REQUIRES: long_tests
+
+// Not a portable test
+
+// <__hash_table>
+
+// size_t __next_hash_pow2(size_t n);
+
+// If n <= 1, return n. If n is a power of 2, return n.
+// Otherwise, return the next power of 2.
+
+#include <__hash_table>
+#include 
+#include 
+
+#include 
+
+bool
+is_power_of_two(unsigned long n)
+{
+return __builtin_popcount(n) == 1;
+}
+
+void
+test_next_pow2()
+{
+assert(!is_power_of_two(0));
+assert(is_power_of_two(1));
+assert(is_power_of_two(2));
+assert(!is_power_of_two(3));
+
+assert(std::__next_hash_pow2(0) == 0);
+assert(std::__next_hash_pow2(1) == 1);
+
+for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n)
+{
+std::size_t pow2 = 1ULL << n;
+assert(std::__next_hash_pow2(pow2) == pow2);
+}
+
+for (std::size_t n : {3, 7, 9, 15, 127, 129})
+{
+std::size_t npow2 = std::__next_hash_pow2(n);
+assert(is_power_of_two(npow2) && npow2 > n);
+}
+}
+
+// Note: this is only really useful when run with -fsanitize=undefined.
+void
+fuzz_unordered_map_reserve(unsigned num_inserts,
+   unsigned num_reserve1,
+   unsigned num_reserve2)
+{
+std::unordered_map m;
+m.reserve(num_reserve1);
+for (unsigned I = 0; I < num_inserts; ++I) m[I] = 0;
+m.reserve(num_reserve2);
+assert(m.bucket_count() >= num_reserve2);
+}
+
+int main()
+{
+test_next_pow2();
+
+for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts)
+for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1)
+for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2)
+fuzz_unordered_map_reserve(num_inserts, num_reserve1, 
num_reserve2);
+
+return 0;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304629 - Fix the recently introduced test to work on C++03

2017-06-02 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Jun  2 20:21:29 2017
New Revision: 304629

URL: http://llvm.org/viewvc/llvm-project?rev=304629&view=rev
Log:
Fix the recently introduced test to work on C++03

Modified:
libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp

Modified: libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp?rev=304629&r1=304628&r2=304629&view=diff
==
--- libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/containers/unord/next_pow2.pass.cpp Fri Jun  2 
20:21:29 2017
@@ -8,6 +8,7 @@
 
//===--===//
 //
 // REQUIRES: long_tests
+// UNSUPPORTED: c++98, c++03
 
 // Not a portable test
 
@@ -30,6 +31,12 @@ is_power_of_two(unsigned long n)
 return __builtin_popcount(n) == 1;
 }
 
+void test_next_pow2_val(size_t n)
+{
+std::size_t npow2 = std::__next_hash_pow2(n);
+assert(is_power_of_two(npow2) && npow2 > n);
+}
+
 void
 test_next_pow2()
 {
@@ -47,11 +54,12 @@ test_next_pow2()
 assert(std::__next_hash_pow2(pow2) == pow2);
 }
 
-for (std::size_t n : {3, 7, 9, 15, 127, 129})
-{
-std::size_t npow2 = std::__next_hash_pow2(n);
-assert(is_power_of_two(npow2) && npow2 > n);
-}
+   test_next_pow2_val(3);
+   test_next_pow2_val(7);
+   test_next_pow2_val(9);
+   test_next_pow2_val(15);
+   test_next_pow2_val(127);
+   test_next_pow2_val(129);
 }
 
 // Note: this is only really useful when run with -fsanitize=undefined.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r305136 - Implement the non-parallel versions of exclusive_scan and transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.

2017-06-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Jun  9 21:22:13 2017
New Revision: 305136

URL: http://llvm.org/viewvc/llvm-project?rev=305136&view=rev
Log:
Implement the non-parallel versions of exclusive_scan and 
transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.

Added:
libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/

libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp

libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp
libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/

libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp
Modified:
libcxx/trunk/include/numeric

Modified: libcxx/trunk/include/numeric
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=305136&r1=305135&r2=305136&view=diff
==
--- libcxx/trunk/include/numeric (original)
+++ libcxx/trunk/include/numeric Fri Jun  9 21:22:13 2017
@@ -42,6 +42,23 @@ template 
+OutputIterator
+exclusive_scan(InputIterator first, InputIterator last,
+   OutputIterator result, T init); // C++17
+   
+template
+OutputIterator
+exclusive_scan(InputIterator first, InputIterator last, 
+   OutputIterator result, T init, BinaryOperation binary_op); 
// C++17
+
+template
+OutputIterator
+transform_exclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, T init,
+ BinaryOperation binary_op, UnaryOperation 
unary_op);  // C++17
+
 template 
 OutputIterator
 adjacent_difference(InputIterator first, InputIterator last, 
OutputIterator result);
@@ -66,6 +83,7 @@ template 
 #include <__config>
 #include 
 #include  // for numeric_limits
+#include 
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -154,6 +172,59 @@ partial_sum(_InputIterator __first, _Inp
 return __result;
 }
 
+#if _LIBCPP_STD_VER > 14
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+exclusive_scan(_InputIterator __first, _InputIterator __last, 
+   _OutputIterator __result, _Tp __init, _BinaryOp __b)
+{
+if (__first != __last)
+{
+_Tp __saved = __init;
+do
+{
+__init = __b(__init, *__first);
+*__result = __saved;
+__saved = __init;
+++__result;
+} while (++__first != __last);
+}
+return __result;
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+exclusive_scan(_InputIterator __first, _InputIterator __last, 
+   _OutputIterator __result, _Tp __init)
+{
+return _VSTD::exclusive_scan(__first, __last, __result, __init, 
_VSTD::plus<>());
+}
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+_OutputIterator
+transform_exclusive_scan(_InputIterator __first, _InputIterator __last, 
+   _OutputIterator __result, _Tp __init,
+   _BinaryOp __b, _UnaryOp __u)
+{
+if (__first != __last)
+{
+_Tp __saved = __init;
+do
+{
+__init = __b(__init, __u(*__first));
+*__result = __saved;
+__saved = __init;
+++__result;
+} while (++__first != __last);
+}
+return __result;
+}
+#endif
+
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator

Added: 
libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp?rev=305136&view=auto
==
--- 
libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp
 Fri Jun  9 21:22:13 2017
@@ -0,0 +1,97 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template
+// OutputIterator exclusive_scan(InputIterator first, InputIterator last,
+//   OutputIterator result, T init);
+// 
+
+#include 
+#include 
+#include 
+
+#include "test_iterators.h"
+
+template 
+void
+test(Iter1 first, Iter1 last, T init, Iter2 rFirst, Iter2 rLast)
+{
+std::vector::value_type> v;
+
+//  Not in place
+

[libcxx] r305191 - [array.tuple]/1 says that instantiating tuple_element> is ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that

2017-06-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Jun 12 09:41:37 2017
New Revision: 305191

URL: http://llvm.org/viewvc/llvm-project?rev=305191&view=rev
Log:
[array.tuple]/1 says that instantiating tuple_element> is 
ill-formed if N >= M.  We didn't do that. Add a static_assert to cause a 
failure, and a test that checks that we failed

Added:

libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
Modified:
libcxx/trunk/include/array

Modified: libcxx/trunk/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=305191&r1=305190&r2=305191&view=diff
==
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Mon Jun 12 09:41:37 2017
@@ -296,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size
 class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
 {
+static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> 
(std::array)");
 public:
 typedef _Tp type;
 };

Added: 
libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp?rev=305191&view=auto
==
--- 
libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
 Mon Jun 12 09:41:37 2017
@@ -0,0 +1,35 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// tuple_element >::type
+
+// Prevent -Warray-bounds from issuing a diagnostic when testing with clang 
verify.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Warray-bounds"
+#endif
+
+#include 
+#include 
+
+
+// std::array is explicitly allowed to be initialized with A a = { init-list 
};.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+int main()
+{
+{
+typedef double T;
+typedef std::array C;
+std::tuple_element<3, C> foo; // expected-note {{requested here}}
+// expected-error@array:* {{static_assert failed "Index out of bounds 
in std::tuple_element<> (std::array)"}}
+}
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r305196 - Make tuple_element static_assert in pair if the index is out of range. Also, add a message to variant_alternative<> in the similar case (it already asserted). Add tests for this

2017-06-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Jun 12 11:13:17 2017
New Revision: 305196

URL: http://llvm.org/viewvc/llvm-project?rev=305196&view=rev
Log:
Make tuple_element static_assert in pair if the index is out of range. Also, 
add a message to variant_alternative<> in the similar case (it already 
asserted). Add tests for this

Added:

libcxx/trunk/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
Modified:
libcxx/trunk/include/utility
libcxx/trunk/include/variant

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=305196&r1=305195&r2=305196&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Mon Jun 12 11:13:17 2017
@@ -653,6 +653,12 @@ template 
   class _LIBCPP_TEMPLATE_VIS tuple_size >
 : public integral_constant {};
 
+template 
+class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
+{
+static_assert(_Ip < 2, "Index out of bounds in 
std::tuple_element>");
+};
+
 template 
 class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
 {

Modified: libcxx/trunk/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=305196&r1=305195&r2=305196&view=diff
==
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Mon Jun 12 11:13:17 2017
@@ -278,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alte
 
 template 
 struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
-  static_assert(_Ip < sizeof...(_Types));
+  static_assert(_Ip < sizeof...(_Types), "Index out of bounds in 
std::variant_alternative<>");
   using type = __type_pack_element<_Ip, _Types...>;
 };
 

Added: 
libcxx/trunk/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp?rev=305196&view=auto
==
--- 
libcxx/trunk/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
 Mon Jun 12 11:13:17 2017
@@ -0,0 +1,25 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template  struct pair
+
+// tuple_element >::type
+
+#include 
+
+int main()
+{
+{
+typedef std::pair P;
+std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
+// expected-error@utility:* {{static_assert failed "Index out of 
bounds in std::tuple_element>"}}
+}
+}

Added: 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp?rev=305196&view=auto
==
--- 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
 Mon Jun 12 11:13:17 2017
@@ -0,0 +1,34 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template  struct variant_alternative; // undefined
+// template  struct variant_alternative;
+// template  struct variant_alternative;
+// template  struct variant_alternative;
+// template 
+//   using variant_alternative_t = typename variant_alternative::type;
+//
+// template 
+//struct variant_alternative>;
+
+
+#include 
+#include 
+
+
+int main()
+{
+{
+typedef std::variant T;
+std::variant_alternative<2, T>::type foo; // expected-note {{requested 
here}}
+// expected-error@variant:* {{static_assert failed "Index out of 
bounds in std::variant_alternative<>"}}
+}
+}


___
cfe-commits mailing list
cfe-commits@li

  1   2   3   4   5   6   7   8   9   10   >