aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/any
diff options
context:
space:
mode:
authorMark de Wever <koraq@xs4all.nl>2022-08-20 10:34:26 +0200
committerMark de Wever <koraq@xs4all.nl>2022-08-31 19:50:03 +0200
commit8ff2d6af6906261567d8c10be62711ce899fb485 (patch)
tree55959ae8f6971650d7800ccbfd765e24e1f89aeb /libcxx/include/any
parent9ac66f0650dfb7d7bca733e4b68bbb6be455faab (diff)
downloadllvm-8ff2d6af6906261567d8c10be62711ce899fb485.zip
llvm-8ff2d6af6906261567d8c10be62711ce899fb485.tar.gz
llvm-8ff2d6af6906261567d8c10be62711ce899fb485.tar.bz2
[libc++] Reduces the number of transitive includes.
This defines a new policy for removal of transitive includes. The goal of the policy it to make it relatively easy to remove headers when needed, but avoid breaking developers using and vendors shipping libc++. The method used is to guard transitive includes based on the C++ language version. For the upcoming C++23 we can remove headers when we want, but for other language versions we try to keep it to a minimum. In this code the transitive include of `<chrono>` is removed since D128577 introduces a header cycle between `<format>` and `<chrono>`. This cycle is indirectly required by the Standard. Our cycle dependency tool basically is a grep based tool, so it needs some hints to ignore cycles. With the input of our transitive include tests we can create a better tool. However that's out of the scope of this patch. Note the flag `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` remains unchanged. So users can still opt-out of transitives includes entirely. Reviewed By: #libc, ldionne, philnik Differential Revision: https://reviews.llvm.org/D132284
Diffstat (limited to 'libcxx/include/any')
-rw-r--r--libcxx/include/any4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/include/any b/libcxx/include/any
index b256630..cd704a9 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -94,8 +94,8 @@ namespace std {
#include <typeinfo>
#include <version>
-#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
-# include <chrono>
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)