aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-04-07 20:04:53 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-05-14 11:46:39 +0000
commit53683b95ef66a12337999587cd98302b1b425920 (patch)
treebb554eaa9acca4a76025359cdfaee8701ada3725
parentdbc822f3bc537e0d8350f63178397156bc163b1c (diff)
downloadsrc-53683b95ef66a12337999587cd98302b1b425920.tar.gz
src-53683b95ef66a12337999587cd98302b1b425920.zip
Apply libc++ fix for <ranges> not compiling at all
Merge commit 44cdca37c01a from llvm git (by Arthur O'Dwyer): [libc++] Define `namespace views` in its own detail header. Discovered in the comments on D118748: we would like this namespace to exist anytime Ranges exists, regardless of whether concepts syntax is supported. Also, we'd like to fully granularize the <ranges> header, which means not putting any loose declarations at the top level. Differential Revision: https://reviews.llvm.org/D118809
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/views.h35
-rw-r--r--contrib/llvm-project/libcxx/include/module.modulemap1
-rw-r--r--contrib/llvm-project/libcxx/include/ranges11
-rw-r--r--lib/libc++/Makefile1
4 files changed, 38 insertions, 10 deletions
diff --git a/contrib/llvm-project/libcxx/include/__ranges/views.h b/contrib/llvm-project/libcxx/include/__ranges/views.h
new file mode 100644
index 000000000000..8cc5ba3d2aca
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__ranges/views.h
@@ -0,0 +1,35 @@
+// -*- 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_VIEWS
+#define _LIBCPP___RANGES_VIEWS
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+namespace ranges {
+
+namespace views { }
+
+} // namespace ranges
+
+namespace views = ranges::views;
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___RANGES_VIEWS
diff --git a/contrib/llvm-project/libcxx/include/module.modulemap b/contrib/llvm-project/libcxx/include/module.modulemap
index 749c17f8bc08..9e3643faee09 100644
--- a/contrib/llvm-project/libcxx/include/module.modulemap
+++ b/contrib/llvm-project/libcxx/include/module.modulemap
@@ -817,6 +817,7 @@ module std [system] {
export functional.__functional.perfect_forward
}
module view_interface { private header "__ranges/view_interface.h" }
+ module views { private header "__ranges/views.h" }
}
}
module ratio {
diff --git a/contrib/llvm-project/libcxx/include/ranges b/contrib/llvm-project/libcxx/include/ranges
index 82ad7f4d507f..9b831160d683 100644
--- a/contrib/llvm-project/libcxx/include/ranges
+++ b/contrib/llvm-project/libcxx/include/ranges
@@ -223,6 +223,7 @@ namespace std::ranges {
#include <__ranges/take_view.h>
#include <__ranges/transform_view.h>
#include <__ranges/view_interface.h>
+#include <__ranges/views.h>
#include <compare> // Required by the standard.
#include <initializer_list> // Required by the standard.
#include <iterator> // Required by the standard.
@@ -233,14 +234,4 @@ namespace std::ranges {
#pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace views = ranges::views;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-
#endif // _LIBCPP_RANGES
diff --git a/lib/libc++/Makefile b/lib/libc++/Makefile
index 5f4db2fd595c..e5bf55e37804 100644
--- a/lib/libc++/Makefile
+++ b/lib/libc++/Makefile
@@ -670,6 +670,7 @@ RNG_HEADERS+= subrange.h
RNG_HEADERS+= take_view.h
RNG_HEADERS+= transform_view.h
RNG_HEADERS+= view_interface.h
+RNG_HEADERS+= views.h
.for hdr in ${RNG_HEADERS}
RNG+= ${HDRDIR}/__ranges/${hdr}
.endfor