[libcxx-commits] [libcxx] c36870c - [libc++] Removes unneeded includes.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 13 08:56:54 PDT 2022


Author: Mark de Wever
Date: 2022-06-13T17:56:50+02:00
New Revision: c36870c8e79c1690432076c69cb98a879555efa8

URL: https://github.com/llvm/llvm-project/commit/c36870c8e79c1690432076c69cb98a879555efa8
DIFF: https://github.com/llvm/llvm-project/commit/c36870c8e79c1690432076c69cb98a879555efa8.diff

LOG: [libc++] Removes unneeded includes.

This removes all "TODO: remove these headers" comments from our headers.

Note there seem to be more headers that can be removed, that will be
done in separate commits.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D127592

Added: 
    

Modified: 
    libcxx/docs/ReleaseNotes.rst
    libcxx/include/iterator
    libcxx/include/optional
    libcxx/include/string
    libcxx/include/tuple
    libcxx/include/typeindex
    libcxx/include/variant
    libcxx/include/vector
    libcxx/test/std/ranges/range.adaptors/range.join.view/types.h
    libcxx/test/std/utilities/utility/utility.intcmp/intcmp.in_range/in_range.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 8c77f2e3cff6a..362e0cedbb77c 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -97,7 +97,10 @@ API Changes
 - Some libc++ headers no longer transitively include all of:
     - ``<algorithm>``
     - ``<chrono>``
+    - ``<exception>``
     - ``<functional>``
+    - ``<new>``
+    - ``<typeinfo>``
     - ``<utility>``
 
   If, after updating libc++, you see compiler errors related to missing declarations

diff  --git a/libcxx/include/iterator b/libcxx/include/iterator
index 30c9a10139ffb..f0bcff96ad01a 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -723,13 +723,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <__memory/allocator_arg_t.h>
-#include <__memory/uses_allocator.h>
-#include <exception>
-#include <new>
-#include <typeinfo>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/optional b/libcxx/include/optional
index b1e014efd2c1c..ec01af47684bf 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -178,11 +178,6 @@ template<class T>
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <__memory/allocator_arg_t.h>
-#include <__memory/uses_allocator.h>
-#include <typeinfo>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/string b/libcxx/include/string
index 7229a568a2a10..9cfbb5f2ff547 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -553,10 +553,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <new>
-#include <typeinfo>
-
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
 #  include <cwchar>
 #endif

diff  --git a/libcxx/include/tuple b/libcxx/include/tuple
index cc08d8c2af326..8c5b24e7ad6ce 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -184,11 +184,6 @@ template <class... Types>
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <exception>
-#include <new>
-#include <typeinfo>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index 8da8f58c53b5a..a92375ab75174 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -51,11 +51,6 @@ struct hash<type_index>
 #include <typeinfo>
 #include <version>
 
-// TODO: remove these headers
-#include <__memory/allocator_arg_t.h>
-#include <__memory/uses_allocator.h>
-#include <new>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/variant b/libcxx/include/variant
index 16fcede8756ff..f15d600a6fd5d 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -220,11 +220,6 @@ namespace std {
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <__memory/allocator_arg_t.h>
-#include <__memory/uses_allocator.h>
-#include <typeinfo>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/vector b/libcxx/include/vector
index f3710ea680597..73806b906f59a 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -307,9 +307,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred);    // C++20
 #include <type_traits>
 #include <version>
 
-// TODO: remove these headers
-#include <typeinfo>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.join.view/types.h b/libcxx/test/std/ranges/range.adaptors/range.join.view/types.h
index 4dd3cf7cfda43..6cc7d8cc2dc28 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.join.view/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.join.view/types.h
@@ -10,6 +10,7 @@
 #define TEST_STD_RANGES_RANGE_ADAPTORS_RANGE_JOIN_TYPES_H
 
 #include <concepts>
+#include <cstdint>
 #include <tuple>
 
 #include "test_macros.h"

diff  --git a/libcxx/test/std/utilities/utility/utility.intcmp/intcmp.in_range/in_range.pass.cpp b/libcxx/test/std/utilities/utility/utility.intcmp/intcmp.in_range/in_range.pass.cpp
index b8606fb12808d..1efa3d965a7f3 100644
--- a/libcxx/test/std/utilities/utility/utility.intcmp/intcmp.in_range/in_range.pass.cpp
+++ b/libcxx/test/std/utilities/utility/utility.intcmp/intcmp.in_range/in_range.pass.cpp
@@ -18,6 +18,7 @@
 #include <numeric>
 #include <tuple>
 #include <cassert>
+#include <cstdint>
 
 #include "test_macros.h"
 


        


More information about the libcxx-commits mailing list