[libcxx-commits] [libcxx] [libc++] Remove <string> and <vector> includes from <flat_map> (PR #114876)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 5 05:05:31 PST 2024


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/114876

>From ecb1593f034bac9b810f351820d3661cdaad657d Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 4 Nov 2024 22:49:37 +0100
Subject: [PATCH] [libc++] Remove <string> and <vector> includes from
 <flat_map>

---
 libcxx/include/__flat_map/flat_map.h             | 10 ++++++++--
 libcxx/test/libcxx/transitive_includes/cxx03.csv | 14 --------------
 libcxx/test/libcxx/transitive_includes/cxx11.csv | 14 --------------
 libcxx/test/libcxx/transitive_includes/cxx14.csv | 15 ---------------
 libcxx/test/libcxx/transitive_includes/cxx17.csv | 14 --------------
 libcxx/test/libcxx/transitive_includes/cxx20.csv | 14 --------------
 libcxx/test/libcxx/transitive_includes/cxx23.csv | 11 -----------
 libcxx/test/libcxx/transitive_includes/cxx26.csv | 11 -----------
 8 files changed, 8 insertions(+), 95 deletions(-)

diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index 5c14c0ac693b08..fee9299d19552c 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -11,6 +11,7 @@
 #define _LIBCPP___FLAT_MAP_FLAT_MAP_H
 
 #include <__algorithm/lexicographical_compare_three_way.h>
+#include <__algorithm/min.h>
 #include <__algorithm/ranges_adjacent_find.h>
 #include <__algorithm/ranges_equal.h>
 #include <__algorithm/ranges_inplace_merge.h>
@@ -19,11 +20,13 @@
 #include <__algorithm/ranges_stable_sort.h>
 #include <__algorithm/ranges_unique.h>
 #include <__algorithm/ranges_upper_bound.h>
+#include <__algorithm/remove_if.h>
 #include <__compare/synth_three_way.h>
 #include <__concepts/convertible_to.h>
 #include <__concepts/swappable.h>
 #include <__config>
 #include <__cstddef/byte.h>
+#include <__cstddef/ptrdiff_t.h>
 #include <__flat_map/sorted_unique.h>
 #include <__functional/invoke.h>
 #include <__functional/is_transparent.h>
@@ -34,13 +37,17 @@
 #include <__iterator/next.h>
 #include <__iterator/ranges_iterator_traits.h>
 #include <__iterator/reverse_iterator.h>
+#include <__memory/addressof.h>
 #include <__memory/allocator_traits.h>
 #include <__memory/uses_allocator.h>
 #include <__memory/uses_allocator_construction.h>
+#include <__ranges/access.h>
 #include <__ranges/concepts.h>
 #include <__ranges/container_compatible_range.h>
 #include <__ranges/drop_view.h>
+#include <__ranges/from_range.h>
 #include <__ranges/ref_view.h>
+#include <__ranges/size.h>
 #include <__ranges/subrange.h>
 #include <__ranges/zip_view.h>
 #include <__type_traits/conjunction.h>
@@ -52,10 +59,9 @@
 #include <__type_traits/maybe_const.h>
 #include <__utility/exception_guard.h>
 #include <__utility/pair.h>
+#include <__vector/vector.h>
 #include <initializer_list>
 #include <stdexcept>
-#include <string>
-#include <vector>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index ae4254183fc84e..d70541290023b2 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -683,18 +683,12 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map algorithm
-flat_map array
 flat_map atomic
-flat_map bit
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map cmath
 flat_map compare
 flat_map concepts
-flat_map cstdarg
 flat_map cstddef
 flat_map cstdint
 flat_map cstdio
@@ -705,27 +699,19 @@ flat_map cwchar
 flat_map cwctype
 flat_map exception
 flat_map initializer_list
-flat_map ios
 flat_map iosfwd
 flat_map iterator
 flat_map limits
-flat_map locale
 flat_map memory
-flat_map mutex
 flat_map new
 flat_map optional
 flat_map ratio
 flat_map stdexcept
-flat_map streambuf
-flat_map string
-flat_map string_view
-flat_map system_error
 flat_map tuple
 flat_map type_traits
 flat_map typeinfo
 flat_map utility
 flat_map variant
-flat_map vector
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index ae4254183fc84e..d70541290023b2 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -683,18 +683,12 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map algorithm
-flat_map array
 flat_map atomic
-flat_map bit
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map cmath
 flat_map compare
 flat_map concepts
-flat_map cstdarg
 flat_map cstddef
 flat_map cstdint
 flat_map cstdio
@@ -705,27 +699,19 @@ flat_map cwchar
 flat_map cwctype
 flat_map exception
 flat_map initializer_list
-flat_map ios
 flat_map iosfwd
 flat_map iterator
 flat_map limits
-flat_map locale
 flat_map memory
-flat_map mutex
 flat_map new
 flat_map optional
 flat_map ratio
 flat_map stdexcept
-flat_map streambuf
-flat_map string
-flat_map string_view
-flat_map system_error
 flat_map tuple
 flat_map type_traits
 flat_map typeinfo
 flat_map utility
 flat_map variant
-flat_map vector
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index f14b3170003705..90bff887eb2781 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -701,18 +701,12 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map algorithm
-flat_map array
 flat_map atomic
-flat_map bit
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map cmath
 flat_map compare
 flat_map concepts
-flat_map cstdarg
 flat_map cstddef
 flat_map cstdint
 flat_map cstdio
@@ -722,29 +716,20 @@ flat_map ctime
 flat_map cwchar
 flat_map cwctype
 flat_map exception
-flat_map execution
 flat_map initializer_list
-flat_map ios
 flat_map iosfwd
 flat_map iterator
 flat_map limits
-flat_map locale
 flat_map memory
-flat_map mutex
 flat_map new
 flat_map optional
 flat_map ratio
 flat_map stdexcept
-flat_map streambuf
-flat_map string
-flat_map string_view
-flat_map system_error
 flat_map tuple
 flat_map type_traits
 flat_map typeinfo
 flat_map utility
 flat_map variant
-flat_map vector
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index d4bc0a38c16439..2f908e7f78ec15 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -707,18 +707,12 @@ filesystem utility
 filesystem variant
 filesystem vector
 filesystem version
-flat_map algorithm
-flat_map array
 flat_map atomic
-flat_map bit
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map cmath
 flat_map compare
 flat_map concepts
-flat_map cstdarg
 flat_map cstddef
 flat_map cstdint
 flat_map cstdio
@@ -729,27 +723,19 @@ flat_map cwchar
 flat_map cwctype
 flat_map exception
 flat_map initializer_list
-flat_map ios
 flat_map iosfwd
 flat_map iterator
 flat_map limits
-flat_map locale
 flat_map memory
-flat_map mutex
 flat_map new
 flat_map optional
 flat_map ratio
 flat_map stdexcept
-flat_map streambuf
-flat_map string
-flat_map string_view
-flat_map system_error
 flat_map tuple
 flat_map type_traits
 flat_map typeinfo
 flat_map utility
 flat_map variant
-flat_map vector
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 304166547abf32..1a198aa4562fdd 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -703,18 +703,12 @@ filesystem utility
 filesystem variant
 filesystem vector
 filesystem version
-flat_map algorithm
-flat_map array
 flat_map atomic
-flat_map bit
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map cmath
 flat_map compare
 flat_map concepts
-flat_map cstdarg
 flat_map cstddef
 flat_map cstdint
 flat_map cstdio
@@ -725,27 +719,19 @@ flat_map cwchar
 flat_map cwctype
 flat_map exception
 flat_map initializer_list
-flat_map ios
 flat_map iosfwd
 flat_map iterator
 flat_map limits
-flat_map locale
 flat_map memory
-flat_map mutex
 flat_map new
 flat_map optional
 flat_map ratio
 flat_map stdexcept
-flat_map streambuf
-flat_map string
-flat_map string_view
-flat_map system_error
 flat_map tuple
 flat_map type_traits
 flat_map typeinfo
 flat_map utility
 flat_map variant
-flat_map vector
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 48d4425c0333ff..854ad1b5df6f1e 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -361,30 +361,19 @@ filesystem string_view
 filesystem tuple
 filesystem typeinfo
 filesystem version
-flat_map array
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map compare
-flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
 flat_map cstring
 flat_map cwchar
 flat_map cwctype
 flat_map initializer_list
-flat_map iosfwd
 flat_map limits
 flat_map new
 flat_map optional
 flat_map stdexcept
-flat_map string
-flat_map string_view
 flat_map tuple
-flat_map typeinfo
-flat_map vector
 flat_map version
 format array
 format cctype
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 944002f4974d0c..ba2faaee5e3757 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -361,30 +361,19 @@ filesystem string_view
 filesystem tuple
 filesystem typeinfo
 filesystem version
-flat_map array
 flat_map cctype
-flat_map cerrno
 flat_map climits
-flat_map clocale
 flat_map compare
-flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
 flat_map cstring
 flat_map cwchar
 flat_map cwctype
 flat_map initializer_list
-flat_map iosfwd
 flat_map limits
 flat_map new
 flat_map optional
 flat_map stdexcept
-flat_map string
-flat_map string_view
 flat_map tuple
-flat_map typeinfo
-flat_map vector
 flat_map version
 format array
 format cctype



More information about the libcxx-commits mailing list