[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-14 Thread Louis Dionne via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG71a16e40f78a: [libcxx] 
ostream{,buf}_iterator::difference_type changes in C++20 (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

Files:
  libcxx/include/iterator
  libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
  libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp

Index: libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //   typedef basic_ostream   ostream_type;
 //   ...
 
+#include 
 #include 
 #include 
 #include 
@@ -34,7 +35,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -50,7 +55,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 // typedef basic_istream istream_type;
 // ...
 
+#include 
 #include 
 #include 
 
@@ -33,7 +34,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -47,7 +52,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: libcxx/include/iterator
===
--- libcxx/include/iterator
+++ libcxx/include/iterator
@@ -1052,9 +1052,19 @@
 : public iterator
 {
 public:
-typedef _CharT char_type;
-typedef _Traits traits_type;
-typedef basic_ostream<_CharT,_Traits> ostream_type;
+typedef output_iterator_tag iterator_category;
+typedef voidvalue_type;
+#if _LIBCPP_STD_VER > 17
+typedef std::ptrdiff_t  difference_type;
+#else
+typedef voiddifference_type;
+#endif
+typedef voidpointer;
+typedef voidreference;
+typedef _CharT  char_type;
+typedef _Traits traits_type;
+typedef basic_ostream<_CharT, _Traits>  ostream_type;
+
 private:
 ostream_type* __out_stream_;
 const char_type* __delim_;
@@ -1151,10 +1161,20 @@
 : public iterator
 {
 public:
-typedef _CharT  char_type;
-typedef _Traits traits_type;
-typedef basic_streambuf<_CharT,_Traits> streambuf_type;
-typedef basic_ostream<_CharT,_Traits>   ostream_type;
+typedef output_iterator_tag iterator_category;
+typedef voidvalue_type;
+#if _LIBCPP_STD_VER > 17
+typedef std::ptrdiff_t  difference_type;
+#else
+typedef voiddifference_type;
+#endif
+typedef voidpointer;
+typedef voidreference;
+typedef _CharT  char_type;
+typedef _Traits traits_type;
+typedef basic_streambuf<_CharT, _Traits>streambuf_type;
+typedef basic_ostream<_CharT, _Traits>  ostream_type;
+
 private:
 streambuf_type* __sbuf_;
 public:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-11 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter accepted this revision.
CaseyCarter added a comment.

LGTM!




Comment at: libcxx/include/iterator:1052
 class _LIBCPP_TEMPLATE_VIS ostream_iterator
 : public iterator
 {

`std::iterator` has been deprecated since C++17. Should this inheritance be 
dependent on `_LIBCPP_STD_VER < 17`? It's unnecessary now that the member types 
are defined directly. (Also on line 1161.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-11 Thread Louis Dionne via Phabricator via cfe-commits
ldionne updated this revision to Diff 291213.
ldionne added a comment.

Implement the changes for libc++.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

Files:
  libcxx/include/iterator
  libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
  libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp

Index: libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //   typedef basic_ostream   ostream_type;
 //   ...
 
+#include 
 #include 
 #include 
 #include 
@@ -34,7 +35,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -50,7 +55,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 // typedef basic_istream istream_type;
 // ...
 
+#include 
 #include 
 #include 
 
@@ -33,7 +34,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -47,7 +52,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: libcxx/include/iterator
===
--- libcxx/include/iterator
+++ libcxx/include/iterator
@@ -1052,9 +1052,19 @@
 : public iterator
 {
 public:
-typedef _CharT char_type;
-typedef _Traits traits_type;
-typedef basic_ostream<_CharT,_Traits> ostream_type;
+typedef output_iterator_tag iterator_category;
+typedef voidvalue_type;
+#if _LIBCPP_STD_VER > 17
+typedef std::ptrdiff_t  difference_type;
+#else
+typedef voiddifference_type;
+#endif
+typedef voidpointer;
+typedef voidreference;
+typedef _CharT  char_type;
+typedef _Traits traits_type;
+typedef basic_ostream<_CharT, _Traits>  ostream_type;
+
 private:
 ostream_type* __out_stream_;
 const char_type* __delim_;
@@ -1151,10 +1161,20 @@
 : public iterator
 {
 public:
-typedef _CharT  char_type;
-typedef _Traits traits_type;
-typedef basic_streambuf<_CharT,_Traits> streambuf_type;
-typedef basic_ostream<_CharT,_Traits>   ostream_type;
+typedef output_iterator_tag iterator_category;
+typedef voidvalue_type;
+#if _LIBCPP_STD_VER > 17
+typedef std::ptrdiff_t  difference_type;
+#else
+typedef voiddifference_type;
+#endif
+typedef voidpointer;
+typedef voidreference;
+typedef _CharT  char_type;
+typedef _Traits traits_type;
+typedef basic_streambuf<_CharT, _Traits>streambuf_type;
+typedef basic_ostream<_CharT, _Traits>  ostream_type;
+
 private:
 streambuf_type* __sbuf_;
 public:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Louis Dionne via Phabricator via cfe-commits
ldionne commandeered this revision.
ldionne edited reviewers, added: CaseyCarter; removed: ldionne.
ldionne added a comment.
Herald added a subscriber: jkorous.

In D87459#2265875 , @CaseyCarter wrote:

>> Ah, I see it. I'll add that bit to libc++ so we don't need special casing in 
>> the tests.
>
> Feel free to steal this for your test changes. Shall I close this 
> differential then?

No need, I'll steal it by commandeering.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter added a comment.

> Ah, I see it. I'll add that bit to libc++ so we don't need special casing in 
> the tests.

Feel free to steal this for your test changes. Shall I close this differential 
then?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In D87459#2265871 , @CaseyCarter wrote:

> In D87459#2265864 , @ldionne wrote:
>
>> What paper is this? I searched but failed to find a paper this falls off 
>> from.
>
> P0896R4 "The One Ranges Proposal" - Ranges demands that all iterators have 
> useful difference types.

Ah, I see it. I'll add that bit to libc++ so we don't need special casing in 
the tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter added a comment.

In D87459#2265864 , @ldionne wrote:

> What paper is this? I searched but failed to find a paper this falls off from.

P0896R4 "The One Ranges Proposal" - Ranges demands that all iterators have 
useful difference types.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

What paper is this? I searched but failed to find a paper this falls off from.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87459/new/

https://reviews.llvm.org/D87459

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


[PATCH] D87459: [libcxx][test] ostream{,buf}_iterator::difference_type changes in C++20

2020-09-10 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: ldionne, mclow.lists, EricWF.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.
Herald added a reviewer: libc++.
CaseyCarter requested review of this revision.

Although libc++ doesn't yet implement this change, these tests should expect 
the difference type of `std::ostream_iterator` and `std::ostreambuf_iterator` 
specializations to be `std::ptrdiff_t` instead of `void` when testing C++ 
versions greater than 17 if the library under test is not libc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87459

Files:
  libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
  libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp


Index: 
libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
===
--- 
libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
+++ 
libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //   typedef basic_ostream   ostream_type;
 //   ...
 
+#include 
 #include 
 #include 
 #include 
@@ -34,7 +35,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), 
"");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -50,7 +55,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), 
"");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: 
libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 // typedef basic_istream istream_type;
 // ...
 
+#include 
 #include 
 #include 
 
@@ -33,7 +34,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), 
"");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -47,7 +52,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), 
"");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif


Index: libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //   typedef basic_ostream   ostream_type;
 //   ...
 
+#include 
 #include 
 #include 
 #include 
@@ -34,7 +35,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
@@ -50,7 +55,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
 static_assert((std::is_same::value), "");
+#else
+static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 #endif
Index: libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
===
--- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 // typedef basic_istream istream_type;
 // ...
 
+#include 
 #include 
 #include 
 
@@ -33,7 +34,11 @@
 #else
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)