[Lldb-commits] [flang] [compiler-rt] [lldb] [libc] [openmp] [libcxx] [llvm] [libcxxabi] [clang-tools-extra] [mlir] [lld] [clang] [libc++] Fix `take_view::__sentinel`'s `operator==` (PR #74655)

2023-12-08 Thread Hristo Hristov via lldb-commits


@@ -8,10 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 
-// sentinel() = default;
-// constexpr explicit sentinel(sentinel_t end);
-// constexpr sentinel(sentinel s)
-//   requires Const && convertible_to, sentinel_t>;
+// constexpr sentinel_t base() const;

Zingam wrote:

Maybe that's already encoded in the parent directory as all other tests use 
just "sentinel" and "iterator"

https://github.com/llvm/llvm-project/pull/74655
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [libc] [libcxx] [flang] [compiler-rt] [mlir] [clang-tools-extra] [openmp] [clang] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-11 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/11] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [compiler-rt] [flang] [clang-tools-extra] [llvm] [libcxx] [clang] [mlir] [lldb] [libc] [openmp] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-11 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/12] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [lldb] [llvm] [libc] [libcxx] [flang] [compiler-rt] [mlir] [clang-tools-extra] [openmp] [clang] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-11 Thread Hristo Hristov via lldb-commits


@@ -343,6 +345,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
+  if (__index >= size()) {

H-G-Hristov wrote:

Done! Sorry I missed that.

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [libc] [compiler-rt] [flang] [mlir] [lldb] [clang-tools-extra] [llvm] [clang] [libcxx] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-16 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/14] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [openmp] [libc] [compiler-rt] [flang] [mlir] [lldb] [clang-tools-extra] [llvm] [clang] [libcxx] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-16 Thread Hristo Hristov via lldb-commits




H-G-Hristov wrote:

Thank you for noticing. Somehow what should have been ignored snuck in back 
again.

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [libc] [flang] [clang] [openmp] [llvm] [lldb] [mlir] [libcxx] [compiler-rt] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/15] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [clang-tools-extra] [libc] [flang] [clang] [openmp] [llvm] [lldb] [mlir] [libcxx] [compiler-rt] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/15] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [mlir] [lldb] [clang] [flang] [clang-tools-extra] [llvm] [compiler-rt] [openmp] [libc] [libcxx] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/16] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [mlir] [openmp] [libcxx] [compiler-rt] [llvm] [lldb] [libc] [clang] [clang-tools-extra] [flang] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-17 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

> Thanks for the fixes, LGTM!

Thank you!

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [clang-tools-extra] [clang] [libcxx] [libc] [mlir] [llvm] [flang] [lldb] [compiler-rt] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-19 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/17] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [libc] [openmp] [llvm] [mlir] [clang-tools-extra] [lldb] [libcxx] [flang] [clang] [compiler-rt] [libc++][span] P2821R5: `span.at()` (PR #74994)

2023-12-25 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libc] [openmp] [llvm] [mlir] [clang-tools-extra] [lldb] [libcxx] [flang] [lld] [clang] [compiler-rt] [libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction (PR #73

2023-12-25 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/73618
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [flang] [compiler-rt] [lldb] [clang] [llvm] [clang-tools-extra] [libc] [libc++][variant] P2637R3: Member `visit` (PR #76447)

2023-12-27 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [flang] [clang] [compiler-rt] [lldb] [clang-tools-extra] [libc] [libcxx] [libc++][variant] P2637R3: Member `visit` (PR #76447)

2023-12-28 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam edited https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang] [libcxx] [compiler-rt] [libc] [clang-tools-extra] [llvm] [flang] [libc++][variant] P2637R3: Member `visit` (for `variant`) (PR #76447)

2023-12-28 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam edited https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang] [libcxx] [compiler-rt] [libc] [clang-tools-extra] [llvm] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-28 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam edited https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [clang] [libc] [lldb] [libcxx] [clang-tools-extra] [llvm] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-29 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [clang] [libc] [lldb] [libcxx] [clang-tools-extra] [llvm] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-29 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [libc] [llvm] [flang] [lldb] [libcxx] [clang] [compiler-rt] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-30 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [flang] [clang-tools-extra] [llvm] [libc] [clang] [lldb] [compiler-rt] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-30 Thread Hristo Hristov via lldb-commits


@@ -26,7 +26,7 @@ template 
 void test_call_operator_forwarding() {
   using Fn = ForwardingCallObject;
   Fn obj{};
-  const Fn &cobj = obj;

Zingam wrote:

The reason for reformatting both files is that the CI format check failed for 
nearly every line in the previous commit:
https://github.com/llvm/llvm-project/actions/runs/7362740090/job/20041480045

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libcxx] [lldb] [clang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits


@@ -26,7 +26,7 @@ template 
 void test_call_operator_forwarding() {
   using Fn = ForwardingCallObject;
   Fn obj{};
-  const Fn &cobj = obj;

H-G-Hristov wrote:

Restored original file and name. But now the tests are not sorted.

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libcxx] [lldb] [clang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits


@@ -17,27 +17,28 @@
 #include "test_macros.h"
 
 struct Incomplete;
-template struct Holder { T t; };

H-G-Hristov wrote:

Same as above.

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libcxx] [lldb] [clang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libcxx] [lldb] [clang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// class variant;
+
+// template
+//   constexpr decltype(auto) visit(this Self&&, Visitor&&); // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "variant_test_helpers.h"
+
+void test_call_operator_forwarding() {
+  using Fn = ForwardingCallObject;
+  Fn obj{};
+  const Fn& cobj = obj;
+
+  { // test call operator forwarding - no variant
+// non-member
+{
+  std::visit(obj);
+  assert(Fn::check_call<>(CT_NonConst | CT_LValue));
+  std::visit(cobj);
+  assert(Fn::check_call<>(CT_Const | CT_LValue));
+  std::visit(std::move(obj));
+  assert(Fn::check_call<>(CT_NonConst | CT_RValue));
+  std::visit(std::move(cobj));
+  assert(Fn::check_call<>(CT_Const | CT_RValue));
+}
+  }
+  { // test call operator forwarding - single variant, single arg
+using V = std::variant;
+V v(42);
+
+v.visit(obj);
+assert(Fn::check_call(CT_NonConst | CT_LValue));
+v.visit(cobj);
+assert(Fn::check_call(CT_Const | CT_LValue));
+v.visit(std::move(obj));
+assert(Fn::check_call(CT_NonConst | CT_RValue));
+v.visit(std::move(cobj));
+assert(Fn::check_call(CT_Const | CT_RValue));
+  }
+  { // test call operator forwarding - single variant, multi arg
+using V = std::variant;
+V v(42L);
+
+v.visit(obj);
+assert(Fn::check_call(CT_NonConst | CT_LValue));
+v.visit(cobj);
+assert(Fn::check_call(CT_Const | CT_LValue));
+v.visit(std::move(obj));
+assert(Fn::check_call(CT_NonConst | CT_RValue));
+v.visit(std::move(cobj));
+assert(Fn::check_call(CT_Const | CT_RValue));
+  }
+}
+
+// Applies to non-member `std::visit` only.
+void test_argument_forwarding() {
+  using Fn = ForwardingCallObject;
+  Fn obj{};
+  const auto val = CT_LValue | CT_NonConst;
+
+  { // single argument - value type
+using V = std::variant;
+V v(42);
+const V& cv = v;
+
+v.visit(obj);
+assert(Fn::check_call(val));
+cv.visit(obj);
+assert(Fn::check_call(val));
+std::move(v).visit(obj);
+assert(Fn::check_call(val));
+std::move(cv).visit(obj);
+assert(Fn::check_call(val));
+  }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+  { // single argument - lvalue reference
+using V = std::variant;
+int x   = 42;
+V v(x);
+const V& cv = v;
+
+v.visit(obj);
+assert(Fn::check_call(val));
+cv.visit(obj);
+assert(Fn::check_call(val));
+std::move(v).visit(obj);
+assert(Fn::check_call(val));
+std::move(cv).visit(obj);
+assert(Fn::check_call(val));
+assert(false);
+  }
+  { // single argument - rvalue reference
+using V = std::variant;
+int x   = 42;
+V v(std::move(x));
+const V& cv = v;
+
+v.visit(obj);
+assert(Fn::check_call(val));
+cvstd::visit(obj);
+assert(Fn::check_call(val));
+std::move(v).visit(obj);
+assert(Fn::check_call(val));
+std::move(cv).visit(obj);
+assert(Fn::check_call(val));
+  }
+#endif
+}
+
+void test_return_type() {
+  using Fn = ForwardingCallObject;
+  Fn obj{};
+  const Fn& cobj = obj;
+
+  { // test call operator forwarding - single variant, single arg
+using V = std::variant;
+V v(42);
+
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+  }
+  { // test call operator forwarding - single variant, multi arg
+using V = std::variant;
+V v(42L);
+
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
+  }
+}
+
+void test_constexpr() {
+  constexpr ReturnFirst obj{};
+
+  {
+using V = std::variant;
+constexpr V v(42);
+
+static_assert(v.visit(obj) == 42);
+  }
+  {
+using V = std::variant;
+constexpr V v(42L);
+
+static_assert(v.visit(obj) == 42);
+  }
+}
+
+void test_exceptions() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+  ReturnArity obj{};
+
+  auto test = [&](auto&& v) {
+try {
+  v.visit(obj);
+} catch (const std::bad_variant_access&) {
+  return true;
+} catch (...) {
+}
+return false;
+  };
+
+  {
+using V = std::variant;
+V v;
+makeEmpty(v);
+
+assert(test(v));
+  }
+#endif
+}
+
+// See https://llvm.org/PR31916
+void test_caller_accepts_nonconst() {
+  struct A {};
+  struct Visitor {
+void operator()(A&) {}
+  };
+  std::variant v;
+
+  v.visit(Visitor{});
+}
+
+struct MyVariant : std::variant {};
+
+n

[Lldb-commits] [compiler-rt] [llvm] [lldb] [clang-tools-extra] [clang] [libc] [flang] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [llvm] [lldb] [clang-tools-extra] [clang] [libc] [flang] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2023-12-31 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

> Thanks for working on this!

Thank you for reviewing!

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [lldb] [libcxx] [clang-tools-extra] [clang] [compiler-rt] [mlir] [libc] [openmp] [llvm] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-01 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/17] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [flang] [lldb] [libcxx] [clang-tools-extra] [clang] [compiler-rt] [mlir] [libc] [openmp] [llvm] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-01 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

@philnik777  a gentle ping 
...and Happy New Year!

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [openmp] [libc] [libcxx] [clang-tools-extra] [mlir] [flang] [clang] [compiler-rt] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-01 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/18] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [lldb] [llvm] [openmp] [libc] [libcxx] [clang-tools-extra] [mlir] [flang] [clang] [compiler-rt] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-01 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,136 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+constexpr void testSpanAt(auto span, int idx, int expectedValue) {
+  // non-const
+  {
+std::same_as decltype(auto) elem = 
span.at(idx);
+assert(elem == expectedValue);
+  }
+
+  // const
+  {
+std::same_as decltype(auto) elem = 
std::as_const(span).at(idx);
+assert(elem == expectedValue);
+  }
+}
+
+constexpr bool test() {
+  // With static extent
+  {
+std::array arr{0, 1, 2, 3, 4, 5, 9084};
+std::span arrSpan{arr};
+
+assert(std::dynamic_extent != arrSpan.extent);
+
+testSpanAt(arrSpan, 0, 0);
+testSpanAt(arrSpan, 1, 1);
+testSpanAt(arrSpan, 6, 9084);
+  }
+
+  // With dynamic extent
+  {
+std::vector vec{0, 1, 2, 3, 4, 5, 9084};
+std::span vecSpan{vec};
+
+assert(std::dynamic_extent == vecSpan.extent);
+
+testSpanAt(vecSpan, 0, 0);
+testSpanAt(vecSpan, 1, 1);
+testSpanAt(vecSpan, 6, 9084);
+  }
+
+  return true;
+}
+
+void test_exceptions() {

H-G-Hristov wrote:

Sorry, I missed your comment!

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [llvm] [openmp] [mlir] [libcxx] [libc] [lldb] [compiler-rt] [clang-tools-extra] [flang] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-01 Thread Hristo Hristov via lldb-commits

Zingam wrote:

Thank you very much for the review. I'll wait a few days for addional feedback 
before I land this PR.

https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [libc] [lldb] [mlir] [clang] [llvm] [lld] [libcxx] [compiler-rt] [flang] [openmp] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-03 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

> I did a full review. There are a number of comments, once these are addressed 
> the patch is ready.

Thank you for the detailed review and patience! 

I believe the failing tests are unrelated to this patch.

https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [libcxx] [openmp] [clang] [llvm] [libc] [flang] [mlir] [lldb] [clang-tools-extra] [lld] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-03 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,101 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+#define TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 26
+
+#  include 
+#  include 
+#  include 
+#  include 
+#  include 
+#  include 
+#  include 
+
+#  if defined(_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#include 
+#include 
+#  else
+#include 
+#  endif
+
+#  include "check_assertion.h"
+#  include "platform_support.h"
+#  include "types.h"
+
+inline bool is_handle_valid(NativeHandleT handle) {

H-G-Hristov wrote:

I admit this looks ugly :)

Or I could move `if TEST_STD_VER >= 26` right before `#  include 
"check_assertion.h"`, where it is needed:}

```c++
#else
#include 
#endif

#include "test_macros.h"

#if TEST_STD_VER >= 26

#  include "check_assertion.h"
#  include "platform_support.h"
#  include "types.h"

inline bool is_handle_valid(NativeHandleT handle) {
```

https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [libcxx] [openmp] [clang] [llvm] [libc] [flang] [mlir] [lldb] [clang-tools-extra] [lld] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-03 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang] [llvm] [lld] [compiler-rt] [libcxx] [flang] [libc] [clang-tools-extra] [libc++][ranges] P2116R9: Implements `views::enumerate` (PR #73617)

2024-01-04 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

> Thanks for working on this! There's a fair bit that I've provided comments 
> for, but I think you're off to a great start, and I would like to see this 
> merged in January, if at all possible.
> 
> Some comments are short and repetitive: those are usually coupled with a 
> starter comment that explains my perspective, and then I just flag the others 
> as I see them in a (hopefully) non-intrusive way.

Thank you very much for the review!

https://github.com/llvm/llvm-project/pull/73617
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [clang] [flang] [libc] [libcxx] [libc++][ranges] P2116R9: Implements `views::enumerate` (PR #73617)

2024-01-04 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,333 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___RANGES_ENUMERATE_VIEW_H
+#define _LIBCPP___RANGES_ENUMERATE_VIEW_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/access.h>
+#include <__ranges/all.h>
+#include <__ranges/concepts.h>
+#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/range_adaptor.h>
+#include <__ranges/size.h>
+#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+// [concept.object]
+
+template 
+concept __range_with_movable_references =
+ranges::input_range<_Rp> && 
std::move_constructible> &&
+std::move_constructible>;
+
+// [range.enumerate.view]
+
+template 
+  requires __range_with_movable_references<_View>
+class enumerate_view : public view_interface> {
+  _View __base_ = _View();
+
+  // [range.enumerate.iterator]
+  template 
+  class __iterator;
+
+  // [range.enumerate.sentinel]
+  template 
+  class __sentinel;
+
+  template 
+  _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_current(const 
__iterator<_AnyConst>& __iter) {
+return (__iter.__current_);
+  }
+
+public:
+  _LIBCPP_HIDE_FROM_ABI constexpr enumerate_view()
+requires(default_initializable<_View>)
+  = default;
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit enumerate_view(_View __base) : 
__base_(std::move(__base)){};
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+requires(!__simple_view<_View>)
+  {
+return __iterator(ranges::begin(__base_), 0);
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+requires __range_with_movable_references
+  {
+return __iterator(ranges::begin(__base_), 0);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+requires(!__simple_view<_View>)
+  {
+if constexpr (common_range<_View> && sized_range<_View>)
+  return __iterator(ranges::end(__base_), 
ranges::distance(__base_));
+else
+  return __sentinel(ranges::end(__base_));
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+requires __range_with_movable_references
+  {
+if constexpr (common_range && sized_range)
+  return __iterator(ranges::end(__base_), ranges::distance(__base_));
+else
+  return __sentinel(ranges::end(__base_));
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+requires sized_range<_View>
+  {
+return ranges::size(__base_);
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+requires sized_range
+  {
+return ranges::size(__base_);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+requires copy_constructible<_View>
+  {
+return __base_;
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); 
}
+};
+
+template 
+enumerate_view(_Range&&) -> enumerate_view>;
+
+// [range.enumerate.iterator]
+
+template 
+  requires __range_with_movable_references<_View>
+template 
+class enumerate_view<_View>::__iterator {
+  using _Base = __maybe_const<_Const, _View>;
+
+  static consteval auto __get_iterator_concept() {
+if constexpr (random_access_range<_Base>) {
+  return random_access_iterator_tag{};
+} else if constexpr (bidirectional_range<_Base>) {
+  return bidirectional_iterator_tag{};
+} else if constexpr (forward_range<_Base>) {
+  return forward_iterator_tag{};
+} else {
+  return input_iterator_tag{};
+}
+  }
+
+  friend class enumerate_view<_View>;
+
+public:
+  using iterator_category = input_iterator_tag;
+  using iterator_concept  = decltype(__get_iterator_concept());
+  using difference_type   = range_difference_t<_Base>;
+  using value_type= tuple>;
+
+private:
+  using __reference_type   = tuple>;
+  iterator_t<_Base> __current_ = iterator_t<_Base>();
+  difference_type __pos_   = 0;
+
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> 
__current, difference_type __pos)
+  : __current_(std::move(__current)), __pos_(__pos) {}
+
+public:
+  _LIBCPP_HIDE_FROM_ABI __iterator()
+requires(default_initializable>)
+  = default;
+  _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator __i)
+requires _Const && convertible_to, iterator_t<_Base>>
+  : __current_(std::move(__i.__current_)), __pos_(__i.__pos_) {}
+
+  _L

[Lldb-commits] [clang] [compiler-rt] [flang] [clang-tools-extra] [libc] [lld] [lldb] [llvm] [libcxx] [libc++][ranges] P2116R9: Implements `views::enumerate` (PR #73617)

2024-01-04 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,333 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___RANGES_ENUMERATE_VIEW_H
+#define _LIBCPP___RANGES_ENUMERATE_VIEW_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/access.h>
+#include <__ranges/all.h>
+#include <__ranges/concepts.h>
+#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/range_adaptor.h>
+#include <__ranges/size.h>
+#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+// [concept.object]
+
+template 
+concept __range_with_movable_references =
+ranges::input_range<_Rp> && 
std::move_constructible> &&
+std::move_constructible>;
+
+// [range.enumerate.view]
+
+template 
+  requires __range_with_movable_references<_View>
+class enumerate_view : public view_interface> {
+  _View __base_ = _View();
+
+  // [range.enumerate.iterator]
+  template 
+  class __iterator;
+
+  // [range.enumerate.sentinel]
+  template 
+  class __sentinel;
+
+  template 
+  _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_current(const 
__iterator<_AnyConst>& __iter) {
+return (__iter.__current_);
+  }
+
+public:
+  _LIBCPP_HIDE_FROM_ABI constexpr enumerate_view()
+requires(default_initializable<_View>)
+  = default;
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit enumerate_view(_View __base) : 
__base_(std::move(__base)){};
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+requires(!__simple_view<_View>)
+  {
+return __iterator(ranges::begin(__base_), 0);
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+requires __range_with_movable_references
+  {
+return __iterator(ranges::begin(__base_), 0);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+requires(!__simple_view<_View>)
+  {
+if constexpr (common_range<_View> && sized_range<_View>)
+  return __iterator(ranges::end(__base_), 
ranges::distance(__base_));
+else
+  return __sentinel(ranges::end(__base_));
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+requires __range_with_movable_references
+  {
+if constexpr (common_range && sized_range)
+  return __iterator(ranges::end(__base_), ranges::distance(__base_));
+else
+  return __sentinel(ranges::end(__base_));
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+requires sized_range<_View>
+  {
+return ranges::size(__base_);
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+requires sized_range
+  {
+return ranges::size(__base_);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+requires copy_constructible<_View>
+  {
+return __base_;
+  }
+  _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); 
}
+};
+
+template 
+enumerate_view(_Range&&) -> enumerate_view>;
+
+// [range.enumerate.iterator]
+
+template 
+  requires __range_with_movable_references<_View>
+template 
+class enumerate_view<_View>::__iterator {
+  using _Base = __maybe_const<_Const, _View>;
+
+  static consteval auto __get_iterator_concept() {
+if constexpr (random_access_range<_Base>) {
+  return random_access_iterator_tag{};
+} else if constexpr (bidirectional_range<_Base>) {
+  return bidirectional_iterator_tag{};
+} else if constexpr (forward_range<_Base>) {
+  return forward_iterator_tag{};
+} else {
+  return input_iterator_tag{};
+}
+  }
+
+  friend class enumerate_view<_View>;
+
+public:
+  using iterator_category = input_iterator_tag;
+  using iterator_concept  = decltype(__get_iterator_concept());
+  using difference_type   = range_difference_t<_Base>;
+  using value_type= tuple>;
+
+private:
+  using __reference_type   = tuple>;
+  iterator_t<_Base> __current_ = iterator_t<_Base>();
+  difference_type __pos_   = 0;
+
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> 
__current, difference_type __pos)
+  : __current_(std::move(__current)), __pos_(__pos) {}
+
+public:
+  _LIBCPP_HIDE_FROM_ABI __iterator()
+requires(default_initializable>)
+  = default;
+  _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator __i)
+requires _Const && convertible_to, iterator_t<_Base>>
+  : __current_(std::move(__i.__current_)), __pos_(__i.__pos_) {}
+
+  _L

[Lldb-commits] [flang] [lld] [lldb] [openmp] [compiler-rt] [libc] [mlir] [clang] [clang-tools-extra] [llvm] [libcxx] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-04 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,97 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+#define TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#if defined(_WIN32)
+#  include 
+#  include 
+#else
+#  include 
+#endif
+
+#include "platform_support.h"
+#include "test_macros.h"
+#include "types.h"
+
+#if TEST_STD_VER >= 26
+
+#  include "check_assertion.h"
+
+inline bool is_handle_valid(NativeHandleT handle) {
+#  if defined(_WIN32)
+  BY_HANDLE_FILE_INFORMATION fileInformation;
+  return GetFileInformationByHandle(handle, &fileInformation));
+#  elif __has_include() // POSIX
+  return fcntl(handle, F_GETFL) != -1 || errno != EBADF;
+#  else
+#error "Provide a native file handle!"
+#  endif
+}
+
+template 
+inline void test_native_handle() {
+  static_assert(
+  std::is_same_v::native_handle_type, 
typename StreamT::native_handle_type>);
+
+  StreamT f;
+  std::filesystem::path p = get_temp_file_name();
+
+  // non-const
+  {
+f.open(p);
+std::same_as decltype(auto) handle = f.native_handle();
+assert(is_handle_valid(handle));
+assert(f.rdbuf()->native_handle() == handle);
+assert(std::as_const(f).rdbuf()->native_handle() == handle);
+f.close();
+assert(!is_handle_valid(handle));
+static_assert(noexcept(f.native_handle()));
+  }
+  // const
+  {
+f.open(p);
+std::same_as decltype(auto) const_handle = 
std::as_const(f).native_handle();
+assert(is_handle_valid(const_handle));
+assert(f.rdbuf()->native_handle() == const_handle);
+assert(std::as_const(f).rdbuf()->native_handle() == const_handle);
+f.close();
+assert(!is_handle_valid(const_handle));
+static_assert(noexcept(std::as_const(f).native_handle()));
+  }
+}
+
+template 
+inline void test_native_handle_assertion() {
+  StreamT f;
+
+  // non-const
+  { TEST_LIBCPP_ASSERT_FAILURE(f.native_handle(), "File must be opened"); }
+  // const
+  { TEST_LIBCPP_ASSERT_FAILURE(std::as_const(f).native_handle(), "File must be 
opened"); }

Zingam wrote:

```suggestion
  // non-const
  TEST_LIBCPP_ASSERT_FAILURE(f.native_handle(), "File must be opened");
  // const
  TEST_LIBCPP_ASSERT_FAILURE(std::as_const(f).native_handle(), "File must be 
opened");
```

https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [llvm] [libc] [mlir] [clang-tools-extra] [lldb] [compiler-rt] [openmp] [flang] [libcxx] [lld] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-04 Thread Hristo Hristov via lldb-commits

Zingam wrote:

> Thanks LGTM!

Thank you very much for the review!

https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [openmp] [compiler-rt] [libcxx] [llvm] [libc] [flang] [clang-tools-extra] [mlir] [clang] [libc++][span] P2821R5: `span.at()` (PR #74994)

2024-01-05 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/74994
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [openmp] [compiler-rt] [libcxx] [llvm] [libc] [flang] [lld] [clang-tools-extra] [mlir] [clang] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-05 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/76632
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxxabi] [lldb] [compiler-rt] [mlir] [flang] [libc] [clang-tools-extra] [llvm] [libcxx] [lld] [clang] [libc++][ranges] Implement ranges::contains_subrange (PR #66963)

2024-01-05 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

Just a gentle reminder. You should probably also update the release notes, the 
status page and the feature test macro: `#define __cpp_lib_ranges_contains 
20L // also in `

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libc] [clang] [lld] [mlir] [lldb] [compiler-rt] [clang-tools-extra] [llvm] [openmp] [flang] [libcxx] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

2024-01-06 Thread Hristo Hristov via lldb-commits

Zingam wrote:

> Hi, this change breaks libcxx test on Windows due to unable to find 
> "unistd.h" file (which doesn't exist on msvc based environment).
> 
> Failed test message and failed commandline:
> 
> ```
> 
> Failed Tests (8):
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/filebuf/types.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/fstream/types.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/ifstream/types.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp
>   llvm-libc++-static-clangcl.cfg.in :: 
> std/input.output/file.streams/fstreams/ofstream/types.pass.cpp
> ```
> 
> ```
> Exit Code: 1
> 
> Command Output (stdout):
> --
> # COMPILED WITH
> C:/b/s/w/ir/x/w/llvm_build/./bin/clang-cl.exe 
> C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\std\input.output\file.streams\fstreams\filebuf.members\native_handle.pass.cpp
>  --driver-mode=g++ --target=x86_64-pc-windows-msvc -fms-runtime-lib=static 
> -nostdinc++ -I C:/b/s/w/ir/x/w/llvm_build/include/c++/v1 -I 
> C:/b/s/w/ir/x/w/llvm_build/include/x86_64-pc-windows-msvc/c++/v1 -I 
> C:/b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/support 
> -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS 
> -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -std=c++26 -Werror -Wall 
> -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template 
> -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move 
> -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier 
> -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals 
> -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter 
> -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args 
> -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed 
> -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move 
> -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL 
> -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety 
> -Wuser-defined-warnings  -llibc++experimental -nostdlib -L 
> C:/b/s/w/ir/x/w/llvm_build/./lib/x86_64-pc-windows-msvc -llibc++ -llibcpmt -o 
> C:\b\s\w\ir\x\w\llvm_build\runtimes\runtimes-x86_64-pc-windows-msvc-bins\test\std\input.output\file.streams\fstreams\filebuf.members\Output\native_handle.pass.cpp.dir\t.tmp.exe
> # executed command: C:/b/s/w/ir/x/w/llvm_build/./bin/clang-cl.exe 
> 'C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\std\input.output\file.streams\fstreams\filebuf.members\native_handle.pass.cpp'
>  --driver-mode=g++ --target=x86_64-pc-windows-msvc -fms-runtime-lib=static 
> -nostdinc++ -I C:/b/s/w/ir/x/w/llvm_build/include/c++/v1 -I 
> C:/b/s/w/ir/x/w/llvm_build/include/x86_64-pc-windows-msvc/c++/v1 -I 
> C:/b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/support 
> -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS 
> -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -std=c++26 -Werror -Wall 
> -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template 
> -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move 
> -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier 
> -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals 
> -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter 
> -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args 
> -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed 
> -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move 
> -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL 
> -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety 
> -Wuser-defined-warnings -llibc++experimental -nostdlib -L 
> C:/b/s/w/ir/x/w/llvm_build/./lib/x86_64-pc-windows-msvc -llibc++ -llibcpmt -o 
> 'C:\b\s\w\ir\x\w\llvm_build\runtimes\runtimes-x86_64-pc-windows-msvc-bins\test\std\input.output\file.streams\fstreams\filebuf.members\Output\native_handle.pass.cpp.dir\t.tmp.exe'
> # .---command stderr
> # | In file included from 
> C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\std\input.output\file.streams\fstreams\filebuf.members\native_handle.pass.cpp:24:
> # | In file included from 
> C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\std\input.output\file.streams\fstreams\filebuf.members\../native_handle_test_helpers.h:33:
> # | 
> C:/b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/support\check_assertion.h:22:10:
>  fatal error: 'unistd.h'

[Lldb-commits] [llvm] [compiler-rt] [lld] [clang-tools-extra] [libc] [flang] [libcxx] [clang] [lldb] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-11 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [libcxx] [lldb] [lld] [clang] [compiler-rt] [flang] [llvm] [clang-tools-extra] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 1/4] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/C

[Lldb-commits] [lldb] [libcxx] [mlir] [clang-tools-extra] [compiler-rt] [flang] [clang] [llvm] [lld] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 1/5] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/C

[Lldb-commits] [compiler-rt] [llvm] [mlir] [clang] [lldb] [libcxx] [flang] [clang-tools-extra] [lld] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 1/6] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/C

[Lldb-commits] [lld] [mlir] [libcxx] [clang-tools-extra] [flang] [llvm] [compiler-rt] [lldb] [clang] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 1/7] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/C

[Lldb-commits] [clang] [lldb] [lld] [clang-tools-extra] [llvm] [compiler-rt] [libcxx] [mlir] [flang] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__type_traits/decay.h>
+#include <__utility/cmp.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+
+template 
+concept __libcpp_standard_integer = __libcpp_unsigned_integer> || 
__libcpp_signed_integer>;

H-G-Hristov wrote:

Pre-requisite added here: https://github.com/llvm/llvm-project/pull/78086
I'll update this patch after the above is merged.

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [lld] [clang-tools-extra] [llvm] [compiler-rt] [libcxx] [mlir] [flang] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

Thank you for the review!

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [lld] [clang-tools-extra] [llvm] [compiler-rt] [libcxx] [mlir] [flang] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [clang] [compiler-rt] [libcxx] [clang-tools-extra] [flang] [llvm] [lld] [lldb] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-13 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__type_traits/decay.h>
+#include <__utility/cmp.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+
+template 
+concept __libcpp_standard_integer = __libcpp_unsigned_integer> || 
__libcpp_signed_integer>;
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
+  if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum))

H-G-Hristov wrote:

> These builtins don't work with 128-bit integrals. @AaronBallman are you happy 
> to receive patches for this in Clang? If so what is the proper name for 
> `__builtin_uaddXX_overflow` and `builtin_saddXX_overflow`? Obviously 
> there should be patches for `sub` and `mul`.
> 
> @H-G-Hristov if acceptable for Clang do you want to do the work?

Yes, I could try to do the work. Please note I have no experience with Clang 
yet.

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [clang] [libcxx] [llvm] [clang-tools-extra] [mlir] [lldb] [flang] [lld] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-14 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 01/12] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status

[Lldb-commits] [compiler-rt] [clang] [libcxx] [llvm] [clang-tools-extra] [mlir] [lldb] [flang] [lld] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-14 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 01/13] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status

[Lldb-commits] [compiler-rt] [clang] [libcxx] [llvm] [clang-tools-extra] [mlir] [lldb] [flang] [lld] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-14 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/77967

>From 48c4463e8817c8ee0f00ffa7422e6fafbe838275 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 10 Jan 2024 13:46:19 +0200
Subject: [PATCH 01/13] [libc++][numeric] P0543R3: Saturation arithmetic

Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional notes:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1.5
- Clang builtins: 
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
---
 libcxx/docs/FeatureTestMacroTable.rst |   2 +-
 libcxx/docs/ReleaseNotes/18.rst   |   7 +-
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/CMakeLists.txt |   1 +
 .../include/__numeric/saturation_arithmetic.h | 135 ++
 libcxx/include/module.modulemap.in|   1 +
 libcxx/include/numeric|  13 ++
 libcxx/include/version|   2 +-
 libcxx/modules/std/numeric.inc|  10 ++
 .../numeric.version.compile.pass.cpp  |  16 +--
 .../version.version.compile.pass.cpp  |  16 +--
 .../numeric.ops.sat/add_sat.pass.cpp  | 129 +
 .../numeric.ops.sat/add_sat.verify.cpp|  39 +
 .../numeric.ops.sat/div_sat.assert.pass.cpp   |  53 +++
 .../numeric.ops.sat/div_sat.pass.cpp  | 108 ++
 .../numeric.ops.sat/div_sat.verify.cpp|  39 +
 .../numeric.ops.sat/mul_sat.pass.cpp  | 119 +++
 .../numeric.ops.sat/mul_sat.verify.cpp|  39 +
 .../numeric.ops.sat/saturate_cast.pass.cpp| 132 +
 .../numeric.ops.sat/saturate_cast.verify.cpp  |  44 ++
 .../numeric.ops.sat/sub_sat.pass.cpp  | 107 ++
 .../numeric.ops.sat/sub_sat.verify.cpp|  39 +
 .../generate_feature_test_macro_components.py |   5 +-
 23 files changed, 1026 insertions(+), 32 deletions(-)
 create mode 100644 libcxx/include/__numeric/saturation_arithmetic.h
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.assert.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.verify.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.verify.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index 893a3b13ca06e0..9dd9c0c023bc8a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -432,7 +432,7 @@ Status
 --- -
 ``__cpp_lib_rcu``   *unimplemented*
 --- -
-``__cpp_lib_saturation_arithmetic`` *unimplemented*
+``__cpp_lib_saturation_arithmetic`` ``202311L``
 --- -
 ``__cpp_lib_smart_ptr_owner_equality``  *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 6de7d07e454d34..877e387d9280fd 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -54,12 +54,13 @@ Implemented Papers
 - P2905R2 - Runtime format strings
 - P2918R2 - Runtime format strings II
 - P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
-- P2870R3 - Remove basic_string::reserve()
+- P2870R3 - Remove ``basic_string::reserve()``
 - P2909R4 - Fix formatting of code units as integers (Dude, where’s my 
``char``?)
-- P2821R5 - span.at()
-- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
+- P2821R5 - ``span.at()``
+- P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P0543R3 - Saturation arithmetic
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status

[Lldb-commits] [lld] [llvm] [compiler-rt] [libcxx] [libunwind] [flang] [clang] [mlir] [clang-tools-extra] [libc] [lldb] [libcxxabi] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-16 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__type_traits/decay.h>
+#include <__utility/cmp.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+
+template 
+concept __libcpp_standard_integer = __libcpp_unsigned_integer> || 
__libcpp_signed_integer>;
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
+  if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum))

H-G-Hristov wrote:

> `__builtin_add_overflow` already works with 128-bit integers: 
> https://godbolt.org/z/non8eMTfj, as well as bit-precise integers: 
> https://godbolt.org/z/dxs7h4G5b so I'm not certain there are Clang changes 
> needed?

Yeah, I added 128-bit integers to the tests and it seems to work. Thank you!

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [lldb] [llvm] [lld] [libunwind] [libcxxabi] [clang-tools-extra] [libc] [compiler-rt] [mlir] [libcxx] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-17 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__type_traits/decay.h>
+#include <__utility/cmp.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+
+template 
+concept __libcpp_standard_integer = __libcpp_unsigned_integer> || 
__libcpp_signed_integer>;
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
+  if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum))
+return __sum;
+  // Handle overflow
+  if constexpr (__libcpp_unsigned_integer<_Tp>) {
+return std::numeric_limits<_Tp>::max();
+  } else {
+// Signed addition overflow
+if (__x > 0)
+  // Overflows if (x > 0 && y > 0)
+  return std::numeric_limits<_Tp>::max();
+else
+  // Overflows if  (x < 0 && y < 0)
+  return std::numeric_limits<_Tp>::min();
+  }
+}
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
+  if (_Tp __sub; !__builtin_sub_overflow(__x, __y, &__sub))
+return __sub;
+  // Handle overflow
+  if constexpr (__libcpp_unsigned_integer<_Tp>) {
+// Overflows if (x < y)
+return std::numeric_limits<_Tp>::min();
+  } else {
+// Signed subtration overflow
+if (__x > 0)
+  // Overflows if (x > 0 && y < 0)
+  return std::numeric_limits<_Tp>::max();
+else
+  // Overflows if (x < 0 && y > 0)
+  return std::numeric_limits<_Tp>::min();
+  }
+}
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
+  if (_Tp __mul; !__builtin_mul_overflow(__x, __y, &__mul))
+return __mul;
+  // Handle overflow
+  if constexpr (__libcpp_unsigned_integer<_Tp>) {
+return std::numeric_limits<_Tp>::max();
+  } else {
+// Signed multiplication overflow
+if (__x > 0) {
+  if (__y > 0)
+// Overflows if (x > 0 && y > 0)
+return std::numeric_limits<_Tp>::max();
+  // Overflows if (x > 0 && y < 0)
+  return std::numeric_limits<_Tp>::min();
+}
+if (__y > 0)
+  // Overflows if (x < 0 && y > 0)
+  return std::numeric_limits<_Tp>::min();
+// Overflows if (x < 0 && y < 0)
+return std::numeric_limits<_Tp>::max();
+  }
+}
+
+template <__libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
+  _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined");
+  if constexpr (__libcpp_unsigned_integer<_Tp>) {
+return __x / __y;
+  } else {
+// Handle signed division overflow
+if (__x == std::numeric_limits<_Tp>::min() && __y == _Tp{-1})
+  return std::numeric_limits<_Tp>::max();
+return __x / __y;
+  }
+}
+
+template <__libcpp_standard_integer _Rp, __libcpp_standard_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {

H-G-Hristov wrote:

OK. I'll remove the optimization for now. On optimized builds the difference 
according to my quick, stupid benchmark is near zero and on unoptimized builds 
less than 10%.
https://quick-bench.com/q/QFdMFKaw_5OnmeDqB_BMkh0BaSg

Please comment if you disagree.

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxxabi] [flang] [llvm] [libc] [libunwind] [clang-tools-extra] [lld] [clang] [lldb] [compiler-rt] [mlir] [libcxx] [libc++][numeric] P0543R3: Saturation arithmetic (PR #77967)

2024-01-17 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

How do I fix the following generated files check error:

```diff
[8/9] cd 
/home/runner/work/llvm-project/llvm-project/build/check-generated-output/libcxx/utils
 && /usr/bin/python3.10 
/home/runner/work/llvm-project/llvm-project/libcxx/utils/generate_iwyu_mapping.py
[9/9] cd 
/home/runner/work/llvm-project/llvm-project/build/check-generated-output/libcxx/utils
 && /usr/bin/python3.10 
/home/runner/work/llvm-project/llvm-project/libcxx/utils/generate_escaped_output_table.py
 
/home/runner/work/llvm-project/llvm-project/libcxx/include/__format/escaped_output_table.h
diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
index 8616f9639..45fa4a954 100644
--- a/libcxx/include/libcxx.imp
+++ b/libcxx/include/libcxx.imp
@@ -559,6 +559,7 @@
   { include: [ "<__numeric/pstl_reduce.h>", "private", "", "public" ] 
},
   { include: [ "<__numeric/pstl_transform_reduce.h>", "private", "", 
"public" ] },
   { include: [ "<__numeric/reduce.h>", "private", "", "public" ] },
+  { include: [ "<__numeric/saturation_arithmetic.h>", "private", "", 
"public" ] },
   { include: [ "<__numeric/transform_exclusive_scan.h>", "private", 
"", "public" ] },
   { include: [ "<__numeric/transform_inclusive_scan.h>", "private", 
"", "public" ] },
   { include: [ "<__numeric/transform_reduce.h>", "private", "", 
"public" ] },
```

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir] [libc] [clang] [lld] [openmp] [clang-tools-extra] [compiler-rt] [flang] [llvm] [libcxx] [libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction (PR #73

2024-01-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/73618
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libc] [mlir] [clang-tools-extra] [lld] [openmp] [llvm] [libcxx] [clang] [compiler-rt] [lldb] [libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction (PR #73

2024-01-17 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,102 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___INOUT_PTR_H
+#define _LIBCPP___INOUT_PTR_H
+
+#include <__config>
+#include <__memory/addressof.h>
+#include <__memory/pointer_traits.h>
+#include <__memory/shared_ptr.h>
+#include <__memory/unique_ptr.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_specialization.h>
+#include <__type_traits/is_void.h>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+template 
+class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
+  static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> 
is not supported");
+
+public:
+  _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __s, _Args... __args)
+  : __s_(__s), __a_(std::forward<_Args>(__args)...), __p_([&__s] {
+  if constexpr (is_pointer_v<_Smart>) {
+return __s;
+  } else {
+return __s.get();
+  }
+}()) {
+if constexpr (requires { __s.release(); }) {
+  __s.release();
+} else {
+  __s = _Smart();
+}
+  }
+
+  _LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete;
+
+  _LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() {
+if constexpr (!is_pointer_v<_Smart>) {
+  if (!__p_) {
+return;
+  }
+}
+
+using _SP = __pointer_of_or_t<_Smart, _Pointer>;
+if constexpr (is_pointer_v<_Smart>) {
+  std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), 
std::forward<_Args>(__args)...); },
+ std::move(__a_));
+} else if constexpr (__resettable_smart_pointer_with_args<_Smart, 
_Pointer, _Args...>) {
+  std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), 
std::forward<_Args>(__args)...); },
+ std::move(__a_));
+} else if constexpr (is_constructible_v<_Smart, _SP, _Args...>) {
+  std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), 
std::forward<_Args>(__args)...); },
+ std::move(__a_));
+} else {
+  static_assert(is_pointer_v<_Smart> || 
__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
+is_constructible_v<_Smart, _SP, _Args...>);
+}
+  }
+
+  _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return 
std::addressof(const_cast<_Pointer&>(__p_)); }
+
+  _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
+requires(!is_same_v<_Pointer, void*>)
+  {
+static_assert(is_pointer_v<_Pointer>);
+
+return reinterpret_cast(static_cast<_Pointer*>(*this));
+  }
+
+private:
+  _Smart& __s_;
+  tuple<_Args...> __a_;
+  _Pointer __p_;
+};
+
+template 
+_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
+  using _Ptr = conditional_t, __pointer_of_t<_Smart>, 
_Pointer>;
+  return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, 
std::forward<_Args>(__args)...);

H-G-Hristov wrote:

Maybe I don't understand but the following fails to compile: 
https://godbolt.org/z/cseMEfdj5

> opt/compiler-explorer/gcc-trunk-20240117/include/c++/14.0.1/bits/out_ptr.h:212:42:
>  error: use of deleted function 'constexpr Foo& Foo::operator=(const Foo&)'
  212 |   _M_smart._M_t._M_deleter() = std::forward<_Del2>(_M_del);
  |   ~~~^

```c++
#include 
#include 

struct Foo {
Foo() = default;
Foo(Foo const&) = delete;  // not copyable
Foo(Foo&&) = delete;   // not movable either!

void operator()(int*) {};
};

int main() {
std::unique_ptr smart;
Foo arg;
// std::ignore = std::out_ptr(smart, arg);
std::ignore = std::inout_ptr(smart, arg);
}
```

https://github.com/llvm/llvm-project/pull/73618
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [libunwind] [libcxx] [clang] [flang] [libc] [lldb] [libcxxabi] [clang-tools-extra] [llvm] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

2024-01-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78157

>From 01f0ed005f2037fa4a4ec64ad5e1a114da1f5e99 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 10:42:55 +0200
Subject: [PATCH 1/9] [libc++][span] P2447R4: `std::span` over an initializer
 list

Implements: https://wg21.link/P2447R6
- https://eel.is/c++draft/span.syn
- https://eel.is/c++draft/span.overview
- https://eel.is/c++draft/span.cons
- https://eel.is/c++draft/diff
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/span   |  18 +++
 .../views/views.span/span.cons/array.pass.cpp |   4 +
 .../initializer_list.assert.pass.cpp  |  45 ++
 .../span.cons/initializer_list.pass.cpp   | 131 --
 .../span.cons/iterator_len.verify.cpp |  24 +++-
 .../generate_feature_test_macro_components.py |   1 -
 8 files changed, 204 insertions(+), 22 deletions(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.cons/initializer_list.assert.pass.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 62a1fec627d0ca..bf0ef8d447a3a5 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2447R6 - ``span`` over initializer list
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c..2a7ee46816e9d9 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -34,7 +34,7 @@
 "`P2918R2 `__","LWG","Runtime format strings 
II","Kona November 2023","|Complete|","18.0","|format|"
 "`P2909R4 `__","LWG","Fix formatting of code units 
as integers (Dude, where’s my ``char``?)","Kona November 
2023","|Complete|","18.0","|format| |DR|"
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
-"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
+"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","|Complete","18.0",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
 "`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
diff --git a/libcxx/include/span b/libcxx/include/span
index 007a32597f965b..7ce0faa9457099 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -68,6 +68,7 @@ public:
 constexpr span(const array& arr) noexcept;
 template
   constexpr explicit(Extent != dynamic_extent) span(R&& r);
+constexpr explicit(extent != dynamic_extent) 
span(std::initializer_list il); // Since C++26
 constexpr span(const span& other) noexcept = default;
 template 
 constexpr explicit(Extent != dynamic_extent) span(const 
span& s) noexcept;
@@ -228,6 +229,15 @@ public:
 requires(_Sz == 0)
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit 
span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()} {
+// static_assert(false, "constructor (static extent) called");
+_LIBCPP_ASSERT_INTERNAL(_Extent == __il.size(), "Size mismatch in span's 
constructor _Extent != __il.size().");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
@@ -397,6 +407,14 @@ public:
   // [span.cons], span constructors, copy, assignment, and destructor
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, 
__size_{0} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()}, __size_{__il.size()} {
+// static_assert(false, "constructor (dynamic extent) called");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
diff --git 
a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
index 8fa7692c3b6370..b01fdda84789ce 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
+++ b/libcxx

[Lldb-commits] [compiler-rt] [libunwind] [libcxx] [clang] [flang] [libc] [lldb] [libcxxabi] [clang-tools-extra] [llvm] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78215

>From 328c55879848d98a9bc068436d959b409b239bcc Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 09:46:26 +0200
Subject: [PATCH] [libc++][any] LWG3305: `any_cast`

Implements: https://wg21.link/LWG3305
- https://eel.is/c++draft/any.nonmembers
---
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/any|  7 
 .../any.nonmembers/any.cast/void.verify.cpp   | 34 +++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp

diff --git a/libcxx/docs/Status/Cxx2cIssues.csv 
b/libcxx/docs/Status/Cxx2cIssues.csv
index fe0f13f6e8cb2c..29f25b63ccb863 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -19,7 +19,7 @@
 "","","","","",""
 "`2392 `__","""character type"" is used but not 
defined","Kona November 2023","","",""
 "`3203 `__","``span`` element access 
invalidation","Kona November 2023","","",""
-"`3305 `__","``any_cast``","Kona November 
2023","","",""
+"`3305 `__","``any_cast``","Kona November 
2023","|Complete|","18.0",""
 "`3431 `__","``<=>`` for containers should require 
``three_way_comparable`` instead of ``<=>``","Kona November 2023","","",""
 "`3749 `__","``common_iterator`` should handle 
integer-class difference types","Kona November 2023","","",""
 "`3809 `__","Is 
``std::subtract_with_carry_engine`` supposed to work","Kona November 
2023","","",""
diff --git a/libcxx/include/any b/libcxx/include/any
index b9e0a8d94550cc..a157d763c63121 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -98,6 +98,7 @@ namespace std {
 #include <__type_traits/is_nothrow_move_constructible.h>
 #include <__type_traits/is_reference.h>
 #include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
@@ -555,6 +556,9 @@ inline _LIBCPP_HIDE_FROM_ABI 
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
 
 template 
 inline _LIBCPP_HIDE_FROM_ABI add_pointer_t> 
any_cast(any const* __any) _NOEXCEPT {
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   return std::any_cast<_ValueType>(const_cast(__any));
 }
@@ -572,6 +576,9 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType 
__pointer_or_func_cast(void*, /*IsFunction
 template 
 _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT 
{
   using __any_imp::_Action;
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   typedef add_pointer_t<_ValueType> _ReturnType;
   if (__any && __any->__h_) {
diff --git 
a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp 
b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
new file mode 100644
index 00..c0733e544dcb24
--- /dev/null
+++ b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// template
+// const T* any_cast(const any* operand) noexcept;
+
+// template
+// T* any_cast(any* operand) noexcept;
+
+#include 
+
+void test() {
+  {
+const std::any ca = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&ca); // expected-note {{requested here}}
+  }
+  {
+std::any a = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&a); // expected-note {{requested here}}
+  }
+}

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


[Lldb-commits] [clang] [libunwind] [llvm] [mlir] [lldb] [libc] [flang] [polly] [libcxx] [compiler-rt] [clang-tools-extra] [libcxxabi] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-17 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78215

>From 328c55879848d98a9bc068436d959b409b239bcc Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 09:46:26 +0200
Subject: [PATCH 1/2] [libc++][any] LWG3305: `any_cast`

Implements: https://wg21.link/LWG3305
- https://eel.is/c++draft/any.nonmembers
---
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/any|  7 
 .../any.nonmembers/any.cast/void.verify.cpp   | 34 +++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp

diff --git a/libcxx/docs/Status/Cxx2cIssues.csv 
b/libcxx/docs/Status/Cxx2cIssues.csv
index fe0f13f6e8cb2c2..29f25b63ccb863f 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -19,7 +19,7 @@
 "","","","","",""
 "`2392 `__","""character type"" is used but not 
defined","Kona November 2023","","",""
 "`3203 `__","``span`` element access 
invalidation","Kona November 2023","","",""
-"`3305 `__","``any_cast``","Kona November 
2023","","",""
+"`3305 `__","``any_cast``","Kona November 
2023","|Complete|","18.0",""
 "`3431 `__","``<=>`` for containers should require 
``three_way_comparable`` instead of ``<=>``","Kona November 2023","","",""
 "`3749 `__","``common_iterator`` should handle 
integer-class difference types","Kona November 2023","","",""
 "`3809 `__","Is 
``std::subtract_with_carry_engine`` supposed to work","Kona November 
2023","","",""
diff --git a/libcxx/include/any b/libcxx/include/any
index b9e0a8d94550ccd..a157d763c63121c 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -98,6 +98,7 @@ namespace std {
 #include <__type_traits/is_nothrow_move_constructible.h>
 #include <__type_traits/is_reference.h>
 #include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
@@ -555,6 +556,9 @@ inline _LIBCPP_HIDE_FROM_ABI 
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
 
 template 
 inline _LIBCPP_HIDE_FROM_ABI add_pointer_t> 
any_cast(any const* __any) _NOEXCEPT {
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   return std::any_cast<_ValueType>(const_cast(__any));
 }
@@ -572,6 +576,9 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType 
__pointer_or_func_cast(void*, /*IsFunction
 template 
 _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT 
{
   using __any_imp::_Action;
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   typedef add_pointer_t<_ValueType> _ReturnType;
   if (__any && __any->__h_) {
diff --git 
a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp 
b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
new file mode 100644
index 000..c0733e544dcb24c
--- /dev/null
+++ b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// template
+// const T* any_cast(const any* operand) noexcept;
+
+// template
+// T* any_cast(any* operand) noexcept;
+
+#include 
+
+void test() {
+  {
+const std::any ca = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&ca); // expected-note {{requested here}}
+  }
+  {
+std::any a = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&a); // expected-note {{requested here}}
+  }
+}

>From 80fc2ca1ce009aa892f148b319129356e2c818c4 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 17 Jan 2024 18:16:04 +0200
Subject: [PATCH 2/2] Addressed comments

---
 libcxx/include/any| 4 
 .../std/utilities/any/any.nonmembers/any.cast/void.verify.cpp | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/libcxx/include/any b/libcxx/include/any
index a157d763c63121c..378dfb6e21b5360 100644
--- a/libcxx/include

[Lldb-commits] [clang] [llvm] [libc] [mlir] [polly] [libcxx] [compiler-rt] [lldb] [flang] [clang-tools-extra] [libunwind] [libcxxabi] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78215

>From 328c55879848d98a9bc068436d959b409b239bcc Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 09:46:26 +0200
Subject: [PATCH 1/2] [libc++][any] LWG3305: `any_cast`

Implements: https://wg21.link/LWG3305
- https://eel.is/c++draft/any.nonmembers
---
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/any|  7 
 .../any.nonmembers/any.cast/void.verify.cpp   | 34 +++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp

diff --git a/libcxx/docs/Status/Cxx2cIssues.csv 
b/libcxx/docs/Status/Cxx2cIssues.csv
index fe0f13f6e8cb2c..29f25b63ccb863 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -19,7 +19,7 @@
 "","","","","",""
 "`2392 `__","""character type"" is used but not 
defined","Kona November 2023","","",""
 "`3203 `__","``span`` element access 
invalidation","Kona November 2023","","",""
-"`3305 `__","``any_cast``","Kona November 
2023","","",""
+"`3305 `__","``any_cast``","Kona November 
2023","|Complete|","18.0",""
 "`3431 `__","``<=>`` for containers should require 
``three_way_comparable`` instead of ``<=>``","Kona November 2023","","",""
 "`3749 `__","``common_iterator`` should handle 
integer-class difference types","Kona November 2023","","",""
 "`3809 `__","Is 
``std::subtract_with_carry_engine`` supposed to work","Kona November 
2023","","",""
diff --git a/libcxx/include/any b/libcxx/include/any
index b9e0a8d94550cc..a157d763c63121 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -98,6 +98,7 @@ namespace std {
 #include <__type_traits/is_nothrow_move_constructible.h>
 #include <__type_traits/is_reference.h>
 #include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
@@ -555,6 +556,9 @@ inline _LIBCPP_HIDE_FROM_ABI 
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
 
 template 
 inline _LIBCPP_HIDE_FROM_ABI add_pointer_t> 
any_cast(any const* __any) _NOEXCEPT {
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   return std::any_cast<_ValueType>(const_cast(__any));
 }
@@ -572,6 +576,9 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType 
__pointer_or_func_cast(void*, /*IsFunction
 template 
 _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT 
{
   using __any_imp::_Action;
+#  if _LIBCPP_STD_VER >= 26
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
+#  endif
   static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a 
reference.");
   typedef add_pointer_t<_ValueType> _ReturnType;
   if (__any && __any->__h_) {
diff --git 
a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp 
b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
new file mode 100644
index 00..c0733e544dcb24
--- /dev/null
+++ b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// template
+// const T* any_cast(const any* operand) noexcept;
+
+// template
+// T* any_cast(any* operand) noexcept;
+
+#include 
+
+void test() {
+  {
+const std::any ca = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&ca); // expected-note {{requested here}}
+  }
+  {
+std::any a = 1;
+
+// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may 
not be void.}}
+std::any_cast(&a); // expected-note {{requested here}}
+  }
+}

>From 80fc2ca1ce009aa892f148b319129356e2c818c4 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Wed, 17 Jan 2024 18:16:04 +0200
Subject: [PATCH 2/2] Addressed comments

---
 libcxx/include/any| 4 
 .../std/utilities/any/any.nonmembers/any.cast/void.verify.cpp | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/libcxx/include/any b/libcxx/include/any
index a157d763c63121..378dfb6e21b536 100644
--- a/libcxx/include/any
+++

[Lldb-commits] [libcxx] [flang] [libcxxabi] [clang-tools-extra] [libunwind] [lldb] [clang] [compiler-rt] [llvm] [libc] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78157

>From 01f0ed005f2037fa4a4ec64ad5e1a114da1f5e99 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 10:42:55 +0200
Subject: [PATCH 1/9] [libc++][span] P2447R4: `std::span` over an initializer
 list

Implements: https://wg21.link/P2447R6
- https://eel.is/c++draft/span.syn
- https://eel.is/c++draft/span.overview
- https://eel.is/c++draft/span.cons
- https://eel.is/c++draft/diff
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/span   |  18 +++
 .../views/views.span/span.cons/array.pass.cpp |   4 +
 .../initializer_list.assert.pass.cpp  |  45 ++
 .../span.cons/initializer_list.pass.cpp   | 131 --
 .../span.cons/iterator_len.verify.cpp |  24 +++-
 .../generate_feature_test_macro_components.py |   1 -
 8 files changed, 204 insertions(+), 22 deletions(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.cons/initializer_list.assert.pass.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 62a1fec627d0ca..bf0ef8d447a3a5 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2447R6 - ``span`` over initializer list
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c..2a7ee46816e9d9 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -34,7 +34,7 @@
 "`P2918R2 `__","LWG","Runtime format strings 
II","Kona November 2023","|Complete|","18.0","|format|"
 "`P2909R4 `__","LWG","Fix formatting of code units 
as integers (Dude, where’s my ``char``?)","Kona November 
2023","|Complete|","18.0","|format| |DR|"
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
-"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
+"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","|Complete","18.0",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
 "`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
diff --git a/libcxx/include/span b/libcxx/include/span
index 007a32597f965b..7ce0faa9457099 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -68,6 +68,7 @@ public:
 constexpr span(const array& arr) noexcept;
 template
   constexpr explicit(Extent != dynamic_extent) span(R&& r);
+constexpr explicit(extent != dynamic_extent) 
span(std::initializer_list il); // Since C++26
 constexpr span(const span& other) noexcept = default;
 template 
 constexpr explicit(Extent != dynamic_extent) span(const 
span& s) noexcept;
@@ -228,6 +229,15 @@ public:
 requires(_Sz == 0)
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit 
span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()} {
+// static_assert(false, "constructor (static extent) called");
+_LIBCPP_ASSERT_INTERNAL(_Extent == __il.size(), "Size mismatch in span's 
constructor _Extent != __il.size().");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
@@ -397,6 +407,14 @@ public:
   // [span.cons], span constructors, copy, assignment, and destructor
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, 
__size_{0} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()}, __size_{__il.size()} {
+// static_assert(false, "constructor (dynamic extent) called");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
diff --git 
a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
index 8fa7692c3b6370..b01fdda84789ce 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
+++ b/libcxx

[Lldb-commits] [libcxx] [flang] [libcxxabi] [clang-tools-extra] [libunwind] [lldb] [clang] [compiler-rt] [llvm] [libc] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78157

>From 01f0ed005f2037fa4a4ec64ad5e1a114da1f5e99 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 11 Jan 2024 10:42:55 +0200
Subject: [PATCH 01/10] [libc++][span] P2447R4: `std::span` over an initializer
 list

Implements: https://wg21.link/P2447R6
- https://eel.is/c++draft/span.syn
- https://eel.is/c++draft/span.overview
- https://eel.is/c++draft/span.cons
- https://eel.is/c++draft/diff
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/include/span   |  18 +++
 .../views/views.span/span.cons/array.pass.cpp |   4 +
 .../initializer_list.assert.pass.cpp  |  45 ++
 .../span.cons/initializer_list.pass.cpp   | 131 --
 .../span.cons/iterator_len.verify.cpp |  24 +++-
 .../generate_feature_test_macro_components.py |   1 -
 8 files changed, 204 insertions(+), 22 deletions(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.cons/initializer_list.assert.pass.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 62a1fec627d0ca..bf0ef8d447a3a5 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2447R6 - ``span`` over initializer list
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c..2a7ee46816e9d9 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -34,7 +34,7 @@
 "`P2918R2 `__","LWG","Runtime format strings 
II","Kona November 2023","|Complete|","18.0","|format|"
 "`P2909R4 `__","LWG","Fix formatting of code units 
as integers (Dude, where’s my ``char``?)","Kona November 
2023","|Complete|","18.0","|format| |DR|"
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
-"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
+"`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","|Complete","18.0",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
 "`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
diff --git a/libcxx/include/span b/libcxx/include/span
index 007a32597f965b..7ce0faa9457099 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -68,6 +68,7 @@ public:
 constexpr span(const array& arr) noexcept;
 template
   constexpr explicit(Extent != dynamic_extent) span(R&& r);
+constexpr explicit(extent != dynamic_extent) 
span(std::initializer_list il); // Since C++26
 constexpr span(const span& other) noexcept = default;
 template 
 constexpr explicit(Extent != dynamic_extent) span(const 
span& s) noexcept;
@@ -228,6 +229,15 @@ public:
 requires(_Sz == 0)
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit 
span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()} {
+// static_assert(false, "constructor (static extent) called");
+_LIBCPP_ASSERT_INTERNAL(_Extent == __il.size(), "Size mismatch in span's 
constructor _Extent != __il.size().");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
@@ -397,6 +407,14 @@ public:
   // [span.cons], span constructors, copy, assignment, and destructor
   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, 
__size_{0} {}
 
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list __il)
+requires is_const_v
+  : __data_{__il.begin()}, __size_{__il.size()} {
+// static_assert(false, "constructor (dynamic extent) called");
+  }
+#  endif
+
   constexpr span(const span&) noexcept= default;
   constexpr span& operator=(const span&) noexcept = default;
 
diff --git 
a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
index 8fa7692c3b6370..b01fdda84789ce 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
+++ b/libc

[Lldb-commits] [mlir] [clang] [llvm] [lldb] [flang] [libcxx] [libc] [clang-tools-extra] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_equal` (PR #78562)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78562

>From fadaafbf791d5fe78f6ac9ee3494b128339781ba Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 18 Jan 2024 09:47:40 +0200
Subject: [PATCH 1/3] [libc++][memory] P2868R1 - Removing deprecated typedef
 `std::allocator::is_always_equal`

Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170
---
 libcxx/.clang-format  |  1 +
 libcxx/docs/ReleaseNotes/18.rst   |  1 +
 libcxx/docs/Status/Cxx23Issues.csv|  2 +-
 libcxx/docs/Status/Cxx2cPapers.csv|  2 +-
 libcxx/docs/UsingLibcxx.rst   |  4 ++
 libcxx/include/__memory/allocator.h   |  8 +++-
 libcxx/include/memory |  2 +-
 ...cator_types.deprecated_in_cxx23.verify.cpp | 44 +++
 .../allocator_types.pass.cpp  |  2 +
 ...llocator_types.removed_in_cxx26.verify.cpp | 34 ++
 10 files changed, 95 insertions(+), 5 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp

diff --git a/libcxx/.clang-format b/libcxx/.clang-format
index 56bdf2b5f911659..39ae1322ffa8a63 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -28,6 +28,7 @@ AttributeMacros: [
   '_LIBCPP_DEPRECATED_IN_CXX14',
   '_LIBCPP_DEPRECATED_IN_CXX17',
   '_LIBCPP_DEPRECATED_IN_CXX20',
+  '_LIBCPP_DEPRECATED_IN_CXX23',
   '_LIBCPP_DEPRECATED',
   '_LIBCPP_DISABLE_EXTENTSION_WARNING',
   '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 77b7939a0c0ac96..3e2fb8727941d6b 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx23Issues.csv 
b/libcxx/docs/Status/Cxx23Issues.csv
index b24ecc5525a1497..70480b338205804 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -15,7 +15,7 @@
 "`2743 `__","P0083R3 ``node_handle`` private 
members missing ""exposition only"" comment","November 2020","|Nothing To 
Do|",""
 "`2820 `__","Clarify  
macros","November 2020","|Nothing To Do|",""
 "`3120 `__","Unclear behavior of 
``monotonic_buffer_resource::release()``","November 2020","",""
-"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","",""
+"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","|Complete|","18.0"
 "`3036 `__","``polymorphic_allocator::destroy`` is 
extraneous","November 2020","",""
 "`3171 `__","LWG2989 breaks ``directory_entry`` 
stream insertion","November 2020","|Complete|","14.0"
 "`3306 `__","``ranges::advance`` violates its 
preconditions","November 2020","|Complete|","14.0","|ranges|"
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c6..762cbc6d487c69d 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -36,7 +36,7 @@
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
 "`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
-"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
+"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2871R3 `__","LWG","Remove Deprecated Unicode 
Conversion Facets from C++26","Kona November 2023","|Complete|","18.0",""
 "`P2819R2 `__","LWG","Add tuple protocol to 
complex","Kon

[Lldb-commits] [mlir] [clang] [llvm] [lldb] [flang] [libcxx] [libc] [clang-tools-extra] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_equal` (PR #78562)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78562

>From fadaafbf791d5fe78f6ac9ee3494b128339781ba Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 18 Jan 2024 09:47:40 +0200
Subject: [PATCH 1/4] [libc++][memory] P2868R1 - Removing deprecated typedef
 `std::allocator::is_always_equal`

Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170
---
 libcxx/.clang-format  |  1 +
 libcxx/docs/ReleaseNotes/18.rst   |  1 +
 libcxx/docs/Status/Cxx23Issues.csv|  2 +-
 libcxx/docs/Status/Cxx2cPapers.csv|  2 +-
 libcxx/docs/UsingLibcxx.rst   |  4 ++
 libcxx/include/__memory/allocator.h   |  8 +++-
 libcxx/include/memory |  2 +-
 ...cator_types.deprecated_in_cxx23.verify.cpp | 44 +++
 .../allocator_types.pass.cpp  |  2 +
 ...llocator_types.removed_in_cxx26.verify.cpp | 34 ++
 10 files changed, 95 insertions(+), 5 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp

diff --git a/libcxx/.clang-format b/libcxx/.clang-format
index 56bdf2b5f911659..39ae1322ffa8a63 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -28,6 +28,7 @@ AttributeMacros: [
   '_LIBCPP_DEPRECATED_IN_CXX14',
   '_LIBCPP_DEPRECATED_IN_CXX17',
   '_LIBCPP_DEPRECATED_IN_CXX20',
+  '_LIBCPP_DEPRECATED_IN_CXX23',
   '_LIBCPP_DEPRECATED',
   '_LIBCPP_DISABLE_EXTENTSION_WARNING',
   '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 77b7939a0c0ac96..3e2fb8727941d6b 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx23Issues.csv 
b/libcxx/docs/Status/Cxx23Issues.csv
index b24ecc5525a1497..70480b338205804 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -15,7 +15,7 @@
 "`2743 `__","P0083R3 ``node_handle`` private 
members missing ""exposition only"" comment","November 2020","|Nothing To 
Do|",""
 "`2820 `__","Clarify  
macros","November 2020","|Nothing To Do|",""
 "`3120 `__","Unclear behavior of 
``monotonic_buffer_resource::release()``","November 2020","",""
-"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","",""
+"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","|Complete|","18.0"
 "`3036 `__","``polymorphic_allocator::destroy`` is 
extraneous","November 2020","",""
 "`3171 `__","LWG2989 breaks ``directory_entry`` 
stream insertion","November 2020","|Complete|","14.0"
 "`3306 `__","``ranges::advance`` violates its 
preconditions","November 2020","|Complete|","14.0","|ranges|"
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c6..762cbc6d487c69d 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -36,7 +36,7 @@
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
 "`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
-"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
+"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2871R3 `__","LWG","Remove Deprecated Unicode 
Conversion Facets from C++26","Kona November 2023","|Complete|","18.0",""
 "`P2819R2 `__","LWG","Add tuple protocol to 
complex","Kon

[Lldb-commits] [lldb] [libc] [mlir] [clang] [flang] [libcxx] [clang-tools-extra] [llvm] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_equal` (PR #78562)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78562

>From fadaafbf791d5fe78f6ac9ee3494b128339781ba Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 18 Jan 2024 09:47:40 +0200
Subject: [PATCH 1/5] [libc++][memory] P2868R1 - Removing deprecated typedef
 `std::allocator::is_always_equal`

Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170
---
 libcxx/.clang-format  |  1 +
 libcxx/docs/ReleaseNotes/18.rst   |  1 +
 libcxx/docs/Status/Cxx23Issues.csv|  2 +-
 libcxx/docs/Status/Cxx2cPapers.csv|  2 +-
 libcxx/docs/UsingLibcxx.rst   |  4 ++
 libcxx/include/__memory/allocator.h   |  8 +++-
 libcxx/include/memory |  2 +-
 ...cator_types.deprecated_in_cxx23.verify.cpp | 44 +++
 .../allocator_types.pass.cpp  |  2 +
 ...llocator_types.removed_in_cxx26.verify.cpp | 34 ++
 10 files changed, 95 insertions(+), 5 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp

diff --git a/libcxx/.clang-format b/libcxx/.clang-format
index 56bdf2b5f91165..39ae1322ffa8a6 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -28,6 +28,7 @@ AttributeMacros: [
   '_LIBCPP_DEPRECATED_IN_CXX14',
   '_LIBCPP_DEPRECATED_IN_CXX17',
   '_LIBCPP_DEPRECATED_IN_CXX20',
+  '_LIBCPP_DEPRECATED_IN_CXX23',
   '_LIBCPP_DEPRECATED',
   '_LIBCPP_DISABLE_EXTENTSION_WARNING',
   '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 77b7939a0c0ac9..3e2fb8727941d6 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx23Issues.csv 
b/libcxx/docs/Status/Cxx23Issues.csv
index b24ecc5525a149..70480b33820580 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -15,7 +15,7 @@
 "`2743 `__","P0083R3 ``node_handle`` private 
members missing ""exposition only"" comment","November 2020","|Nothing To 
Do|",""
 "`2820 `__","Clarify  
macros","November 2020","|Nothing To Do|",""
 "`3120 `__","Unclear behavior of 
``monotonic_buffer_resource::release()``","November 2020","",""
-"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","",""
+"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","|Complete|","18.0"
 "`3036 `__","``polymorphic_allocator::destroy`` is 
extraneous","November 2020","",""
 "`3171 `__","LWG2989 breaks ``directory_entry`` 
stream insertion","November 2020","|Complete|","14.0"
 "`3306 `__","``ranges::advance`` violates its 
preconditions","November 2020","|Complete|","14.0","|ranges|"
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c..762cbc6d487c69 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -36,7 +36,7 @@
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
 "`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
-"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
+"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2871R3 `__","LWG","Remove Deprecated Unicode 
Conversion Facets from C++26","Kona November 2023","|Complete|","18.0",""
 "`P2819R2 `__","LWG","Add tuple protocol to 
complex","Kona Novemb

[Lldb-commits] [flang] [clang] [lldb] [lld] [clang-tools-extra] [mlir] [libc] [compiler-rt] [llvm] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits


@@ -144,7 +144,8 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) 
__visit_format_arg(_Visitor&& __vis, basic_
   __libcpp_unreachable();
 }
 
-#  if _LIBCPP_STD_VER >= 26
+#  if _LIBCPP_STD_VER >= 26 && (!defined(_LIBCPP_COMPILER_CLANG_BASED) || 
_LIBCPP_CLANG_VER >= 1800)

H-G-Hristov wrote:

https://clang.llvm.org/docs/ReleaseNotes.html

> Implemented P0847R7: Deducing this. Some related core issues were also 
> implemented (CWG2553, CWG2554, CWG2653, CWG2687). Because the support for 
> this feature is still experimental, the feature test macro 
> __cpp_explicit_this_parameter was not set in this version.

I'll revert the change.

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libc] [clang-tools-extra] [libcxx] [lldb] [flang] [clang] [mlir] [llvm] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_equal` (PR #78562)

2024-01-18 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

Thank you for the review!

https://github.com/llvm/llvm-project/pull/78562
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

Thank you for the review!

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [compiler-rt] [clang-tools-extra] [libunwind] [libcxxabi] [flang] [libc] [llvm] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

2024-01-18 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

> > Thanks. The documentation build fails due to some CMake error consistently 
> > otherwise I believe I addressed all comments.
> > I think I fixed this a few days ago.
> 
> LGTM modulo 1 nit.

Thanx!

https://github.com/llvm/llvm-project/pull/78157
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits


@@ -24,14 +24,17 @@ void test(From value) {
   auto store = std::make_format_args(value);
   const std::basic_format_args format_args{store};
 
-  std::visit_format_arg(
-  [v = To(value)](auto a) {
-if constexpr (std::is_same_v)
-  assert(v == a);
-else
-  assert(false);
-  },
-  format_args.get(0));
+  auto visitor = [v = To(value)](auto a) {
+if constexpr (std::is_same_v)
+  assert(v == a);
+else
+  assert(false);
+  };
+#if _LIBCPP_STD_VER >= 26 && (!defined(TEST_COMPILER_CLANG) || TEST_CLANG_VER 
>= 1800)

H-G-Hristov wrote:

N.B. `TEST_CLANG_VER` is not defined for Apple Clang ???

```c++
#if defined(__apple_build_version__)
// Given AppleClang XX.Y.Z, TEST_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 
14.0.3 => 1403)
#define TEST_APPLE_CLANG_VER (__apple_build_version__ / 1)
#elif defined(__clang_major__)
#define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__
#elif defined(__GNUC__)
// Given GCC XX.YY.ZZ, TEST_GCC_VER is XXYYZZ
#define TEST_GCC_VER ((__GNUC__ * 1) + (__GNUC_MINOR__ * 100) + 
__GNUC_PATCHLEVEL__)
#endif
```

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov deleted 
https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits


@@ -144,7 +144,8 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) 
__visit_format_arg(_Visitor&& __vis, basic_
   __libcpp_unreachable();
 }
 
-#  if _LIBCPP_STD_VER >= 26
+#  if _LIBCPP_STD_VER >= 26 && (!defined(_LIBCPP_COMPILER_CLANG_BASED) || 
_LIBCPP_CLANG_VER >= 1800)

H-G-Hristov wrote:

Maybe something like:

```c++
#  if _LIBCPP_STD_VER >= 26 && (defined(__cpp_explicit_this_parameter) || 
!defined(_LIBCPP_COMPILER_CLANG_BASED) || _LIBCPP_CLANG_VER >= 1800)
...
#endif
```
or 

```c++
#if defined(__cpp_explicit_this_parameter) || 
!defined(_LIBCPP_COMPILER_CLANG_BASED) || _LIBCPP_CLANG_VER >= 1800
#define _LIBCPP_EXPLICIT_THIS_PARAMETER
#endif
```

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang-tools-extra] [openmp] [llvm] [lld] [compiler-rt] [mlir] [libc] [flang] [clang] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [libcxx] [mlir] [openmp] [compiler-rt] [clang-tools-extra] [flang] [libc] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [openmp] [clang] [mlir] [lldb] [compiler-rt] [clang-tools-extra] [lld] [llvm] [libc] [flang] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_eq

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/78562

>From fadaafbf791d5fe78f6ac9ee3494b128339781ba Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Thu, 18 Jan 2024 09:47:40 +0200
Subject: [PATCH 1/6] [libc++][memory] P2868R1 - Removing deprecated typedef
 `std::allocator::is_always_equal`

Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170
---
 libcxx/.clang-format  |  1 +
 libcxx/docs/ReleaseNotes/18.rst   |  1 +
 libcxx/docs/Status/Cxx23Issues.csv|  2 +-
 libcxx/docs/Status/Cxx2cPapers.csv|  2 +-
 libcxx/docs/UsingLibcxx.rst   |  4 ++
 libcxx/include/__memory/allocator.h   |  8 +++-
 libcxx/include/memory |  2 +-
 ...cator_types.deprecated_in_cxx23.verify.cpp | 44 +++
 .../allocator_types.pass.cpp  |  2 +
 ...llocator_types.removed_in_cxx26.verify.cpp | 34 ++
 10 files changed, 95 insertions(+), 5 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
 create mode 100644 
libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp

diff --git a/libcxx/.clang-format b/libcxx/.clang-format
index 56bdf2b5f911659..39ae1322ffa8a63 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -28,6 +28,7 @@ AttributeMacros: [
   '_LIBCPP_DEPRECATED_IN_CXX14',
   '_LIBCPP_DEPRECATED_IN_CXX17',
   '_LIBCPP_DEPRECATED_IN_CXX20',
+  '_LIBCPP_DEPRECATED_IN_CXX23',
   '_LIBCPP_DEPRECATED',
   '_LIBCPP_DISABLE_EXTENTSION_WARNING',
   '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 77b7939a0c0ac96..3e2fb8727941d6b 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -60,6 +60,7 @@ Implemented Papers
 - P0521R0 - Proposed Resolution for CA 14 (``shared_ptr`` ``use_count/unique``)
 - P1759R6 - Native handles and file streams
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 
 
 Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx23Issues.csv 
b/libcxx/docs/Status/Cxx23Issues.csv
index b24ecc5525a1497..70480b338205804 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -15,7 +15,7 @@
 "`2743 `__","P0083R3 ``node_handle`` private 
members missing ""exposition only"" comment","November 2020","|Nothing To 
Do|",""
 "`2820 `__","Clarify  
macros","November 2020","|Nothing To Do|",""
 "`3120 `__","Unclear behavior of 
``monotonic_buffer_resource::release()``","November 2020","",""
-"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","",""
+"`3170 `__","``is_always_equal`` added to 
``std::allocator`` makes the standard library treat derived types as always 
equal","November 2020","|Complete|","18.0"
 "`3036 `__","``polymorphic_allocator::destroy`` is 
extraneous","November 2020","",""
 "`3171 `__","LWG2989 breaks ``directory_entry`` 
stream insertion","November 2020","|Complete|","14.0"
 "`3306 `__","``ranges::advance`` violates its 
preconditions","November 2020","|Complete|","14.0","|ranges|"
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index 5701717f39766c6..762cbc6d487c69d 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -36,7 +36,7 @@
 "`P0952R2 `__","LWG","A new specification for 
``std::generate_canonical``","Kona November 2023","","",""
 "`P2447R6 `__","LWG","``std::span`` over an 
initializer list","Kona November 2023","","",""
 "`P2821R5 `__","LWG","``span.at()``","Kona November 
2023","|Complete|","18.0",""
-"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 2023","","",""
+"`P2868R3 `__","LWG","Remove Deprecated 
``std::allocator`` Typedef From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2870R3 `__","LWG","Remove 
``basic_string::reserve()`` From C++26","Kona November 
2023","|Complete|","18.0",""
 "`P2871R3 `__","LWG","Remove Deprecated Unicode 
Conversion Facets from C++26","Kona November 2023","|Complete|","18.0",""
 "`P2819R2 `__","LWG","Add tuple protocol to 
complex","Kon

[Lldb-commits] [flang] [lldb] [libcxxabi] [lld] [llvm] [libcxx] [clang] [polly] [clang-tools-extra] [libc] [mlir] [openmp] [compiler-rt] [libunwind] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-18 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov converted_to_draft 
https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [clang] [openmp] [libc] [lldb] [lld] [flang] [llvm] [compiler-rt] [libcxx] [mlir] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_eq

2024-01-19 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/78562
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [clang] [libc] [libunwind] [lldb] [polly] [flang] [llvm] [libcxxabi] [compiler-rt] [libcxx] [mlir] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-19 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/78215
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [clang] [libc] [libunwind] [lldb] [flang] [llvm] [libcxxabi] [compiler-rt] [libcxx] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

2024-01-19 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/78157
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [flang] [libc] [mlir] [clang-tools-extra] [openmp] [libcxx] [compiler-rt] [lldb] [lld] [llvm] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-19 Thread Hristo Hristov via lldb-commits


@@ -144,7 +144,8 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) 
__visit_format_arg(_Visitor&& __vis, basic_
   __libcpp_unreachable();
 }
 
-#  if _LIBCPP_STD_VER >= 26
+#  if _LIBCPP_STD_VER >= 26 && (!defined(_LIBCPP_COMPILER_CLANG_BASED) || 
_LIBCPP_CLANG_VER >= 1800)

H-G-Hristov wrote:

> I would go with with a new config variable 
> `_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER`
> 
> ```
> // Clang-18 has support for deducing this, but it does not set the FTM.
> #if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER ) 
> &&_LIBCPP_CLANG_VER >= 1800))
> #  define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
> #endif
> ```
> 
> This allows to easily add AppleClang when they support it. For the library we 
> only support GCC and Clang based compilers.

Thank you! Done!

I think we also need to disable the test on Apple Clang, so I added:
`// UNSUPPORTED: clang-16 || clang-17 || apple-clang`

I hope this is the way.

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [clang] [llvm] [libcxx] [openmp] [libc] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-20 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

This FreeBSD failure seems unrelated:
```
# .---command stderr
# | In file included from 
/usr/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/std/algorithms/numeric.ops/transform.reduce/pstl.exception_handling.pass.cpp:20:
# | 
/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:25:
 error: use of undeclared identifier 'SIGILL'
# |   if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) {
# | ^
# | 
/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:49:
 error: use of undeclared identifier 'SIGTRAP'
# |   if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) {
# | ^
# | 2 errors generated.
# `-
# error: command failed with exit status: 1
```

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [mlir] [clang] [llvm] [libcxx] [openmp] [libc] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-20 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

This FreeBSD failure seems unrelated, the same appears in `variant`:

```
# .---command stderr
# | In file included from 
/usr/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp:19:
# | 
/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:25:
 error: use of undeclared identifier 'SIGILL'
# |   if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) {
# | ^
# | 
/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:49:
 error: use of undeclared identifier 'SIGTRAP'
# |   if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) {
# | ^
# | 2 errors generated.
# `-
# error: command failed with exit status: 1

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [libc] [mlir] [lld] [llvm] [clang] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-20 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,357 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+// The tested functionality needs deducing this.
+// UNSUPPORTED: clang-16 || clang-17 || apple-clang
+
+// 
+
+// class variant;
+
+// template
+//   constexpr R visit(this Self&&, Visitor&&);  // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "variant_test_helpers.h"
+
+template 
+struct overloaded : Ts... {
+  using Ts::operator()...;
+};
+
+void test_overload_ambiguity() {
+  using V = std::variant;
+  using namespace std::string_literals;
+  V v{"baba"s};
+
+  v.visit(
+  overloaded{[]([[maybe_unused]] auto x) { assert(false); }, [](const 
std::string& x) { assert(x == "baba"s); }});
+  assert(std::get(v) == "baba"s);
+
+  // Test the constraint.
+  v = std::move(v).visit(overloaded{
+  []([[maybe_unused]] auto x) {
+assert(false);
+return 0;
+  },
+  [](const std::string& x) {
+assert(x == "baba"s);
+return x + " zmt"s;
+  }});
+  assert(std::get(v) == "baba zmt"s);
+}
+
+template 
+void test_call_operator_forwarding() {
+  using Fn = ForwardingCallObject;
+  Fn obj{};
+  const Fn& cobj = obj;
+
+  { // test call operator forwarding - no variant
+// non-member
+{
+  std::visit(obj);
+  assert(Fn::check_call<>(CT_NonConst | CT_LValue));
+  std::visit(cobj);
+  assert(Fn::check_call<>(CT_Const | CT_LValue));
+  std::visit(std::move(obj));
+  assert(Fn::check_call<>(CT_NonConst | CT_RValue));
+  std::visit(std::move(cobj));
+  assert(Fn::check_call<>(CT_Const | CT_RValue));
+}

H-G-Hristov wrote:

Good catch! Thank you!

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [libc] [mlir] [lld] [llvm] [clang] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-20 Thread Hristo Hristov via lldb-commits


@@ -1513,6 +1519,11 @@ 
__sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
 #  endif
 
+// Clang-18 has support for deducing this, but it does not set the FTM.
+#if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER ) 
&&_LIBCPP_CLANG_VER >= 1800)
+#  define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
+#endif
+

H-G-Hristov wrote:

Of course!

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [lld] [libcxx] [openmp] [llvm] [clang-tools-extra] [flang] [clang] [mlir] [libc] [lldb] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-20 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

@mordante Could you please have another look at the test/latest update.

https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [llvm] [clang-tools-extra] [lldb] [lld] [openmp] [compiler-rt] [libc] [mlir] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-20 Thread Hristo Hristov via lldb-commits

Zingam wrote:

The FreeBSD CI failure is unrelated and should be fixed upstream. Merging.

https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [llvm] [clang-tools-extra] [lldb] [lld] [openmp] [compiler-rt] [libc] [mlir] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-20 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [lldb] [mlir] [flang] [lld] [libcxx] [llvm] [openmp] [clang-tools-extra] [libc] [clang] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-21 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/76449
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lld] [llvm] [libcxx] [openmp] [flang] [libunwind] [libcxxabi] [compiler-rt] [clang-tools-extra] [polly] [libc] [clang] [mlir] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-21 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

I did some re-imagining of the tests, there is a some redundancy but it is 
cleared that nothing was missed.
I also used the Clang 18's "Placeholder variables with no name" to make the 
test a bit cleaner, so I disabled the unsupported compilers.
The tests are formatted in tabular form manually to make them easier to read.

If the above is unacceptable, it can be fixed easily. For now it makes it 
easier to read and review. 

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libunwind] [openmp] [libc] [flang] [mlir] [libcxxabi] [polly] [libcxx] [lldb] [lld] [clang] [compiler-rt] [clang-tools-extra] [llvm] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-21 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov ready_for_review 
https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [mlir] [clang-tools-extra] [openmp] [lld] [libc] [libcxxabi] [flang] [libunwind] [polly] [compiler-rt] [llvm] [libcxx] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-21 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,458 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+// The test uses "Placeholder variables with no name"
+// UNSUPPORTED: clang-17
+// XFAIL: apple-clang
+
+// 
+
+// template
+//   constexpr R saturate_cast(T x) noexcept; // 
freestanding
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// Smaller to larger
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+// Same type
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+// Larger to smaller
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+template 
+constexpr auto zero() {
+  return IntegerT{0};
+}
+
+constexpr bool test() {
+  // clang-format off
+
+#ifndef TEST_HAS_NO_INT128
+  using SIntT = __int128_t;
+  using UIntT = __uint128_t;
+#else
+  using SIntT = long long int;
+  using UIntT = unsigned long long int;
+#endif
+
+  // Constants: biggest numbers
+
+  constexpr auto big_sintMin  = std::numeric_limits::min();
+  constexpr auto big_sintZero =zero();
+  constexpr auto big_sintMax  = std::numeric_limits::max();

H-G-Hristov wrote:

These are needed specifically as these values can vary but I used the C integer 
constants wherever applicable.

https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [mlir] [clang-tools-extra] [openmp] [lld] [libc] [libcxxabi] [flang] [libunwind] [polly] [compiler-rt] [llvm] [libcxx] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-21 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,458 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+// The test uses "Placeholder variables with no name"
+// UNSUPPORTED: clang-17
+// XFAIL: apple-clang
+
+// 
+
+// template
+//   constexpr R saturate_cast(T x) noexcept; // 
freestanding
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// Smaller to larger
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+// Same type
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+// Larger to smaller
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+static_assert(noexcept(std::saturate_cast(std::numeric_limits::max(;
+
+template 
+constexpr auto zero() {
+  return IntegerT{0};
+}
+
+constexpr bool test() {
+  // clang-format off
+
+#ifndef TEST_HAS_NO_INT128
+  using SIntT = __int128_t;
+  using UIntT = __uint128_t;
+#else
+  using SIntT = long long int;
+  using UIntT = unsigned long long int;
+#endif
+
+  // Constants: biggest numbers
+
+  constexpr auto big_sintMin  = std::numeric_limits::min();
+  constexpr auto big_sintZero =zero();
+  constexpr auto big_sintMax  = std::numeric_limits::max();
+
+  constexpr auto big_uintMin  = std::numeric_limits::min();
+  constexpr auto big_uintZero =zero();
+  constexpr auto big_uintMax  = std::numeric_limits::max();
+
+  // Constants: numeric limits
+
+  constexpr auto std_scharMin  = std::numeric_limits::min();
+  constexpr auto std_scharZero =zero();
+  constexpr auto std_scharMax  = std::numeric_limits::max();
+
+  constexpr auto std_ucharMin  = std::numeric_limits::min();
+  constexpr auto std_ucharZero =zero();
+  constexpr auto std_ucharMax  = std::numeric_limits::max();
+
+  constexpr auto std_ssintMin  = std::numeric_limits::min();
+  constexpr auto std_ssintZero =zero();
+  constexpr auto std_ssintMax  = std::numeric_limits::max();
+
+  constexpr auto std_usintMin  = std::numeric_limits::min();
+  constexpr auto std_usintZero =zero();
+  constexpr auto std_usintMax  = std::numeric_limits::max();
+
+  constexpr auto std_sintMin   = std::numeric_limits::min();
+  constexpr auto std_sintZero  =zero();
+  constexpr auto std_sintMax   = std::numeric_limits::max();
+
+  constexpr auto std_uintMin   = std::numeric_limits::min();
+  constexpr auto std_uintZero  =zero();
+  constexpr auto std_uintMax   = std::numeric_limits::max();
+
+  constexpr auto std_slMin = std::numeric_limits::min();
+  constexpr auto std_slZero=zero();
+  constexpr auto std_slMax = std::numeric_limits::max();
+
+  constexpr auto std_ulMin = std::numeric_limits::min();
+  constexpr auto std_ulZero=zero();
+  constexpr auto std_ulMax = std::numeric_limits::max();
+
+  constexpr auto std_sllMin= std::numeric_limits::min();
+  constexpr auto std_sllZero   =zero();
+  constexpr auto std_sllMax= std::numeric_limits::max();
+
+  constexpr auto std_ullMin= std::numeric_limits::min();
+  constexpr auto std_ullZero   =zero();
+  constexpr auto std_ullMax= std::numeric_limits::max();
+  
+  // signed char
+
+  assert(std::saturate_cast(std_scharMin)  == std_scharMin);
+  assert(std::saturate_cast(std_scharZero) == std_scharZero);
+  assert(std::saturate_cast(std_scharMax)  == std_scharMax);
+
+  assert(std::saturate_cast(std_ucharMin)  == std_scharZero);
+  assert(std::saturate_cast(std_ucharZero) == std_scharZero);
+  assert(std::saturate_cast(std_ucharMax)  == std_scharMax);
+
+  assert(std::saturate_cast(big_sintMin)   == std_scharMin);  // 
saturated
+  assert(std::saturate_cast(big_sintZero)  == std_scharZero);
+  assert(std::saturate_cast(big_sintMax)   == std_scharMax);  // 
saturated
+
+  assert(std::saturate_cast(big_uintMin)   == std_scharZero);
+  assert(std::saturate_cast(big_uintZero)  == std_scharZero);
+  assert(std::saturate_cast(big_uintMax)   == std_scharMax);  // 
saturated
+
+  // short
+
+  std::same_as decltype(auto) _ = std::sat

[Lldb-commits] [flang] [lld] [mlir] [libcxx] [libunwind] [lldb] [compiler-rt] [clang-tools-extra] [clang] [libcxxabi] [openmp] [llvm] [libc] [polly] [libc++][numeric] P0543R3: Saturation arithmetic (P

2024-01-21 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov converted_to_draft 
https://github.com/llvm/llvm-project/pull/77967
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


  1   2   >