Revert "[libc++] Remove unused headers from <filesystem>"

This reverts commit 352945dd36c64fd68b4c73fcc393ee5828da639a.

NOKEYCHECK=True
GitOrigin-RevId: fcc0964ed43ed6430dec42ad89526463d08dc1d4
diff --git a/include/filesystem b/include/filesystem
index 6203b9a..09d9061 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -254,9 +254,32 @@
 #include<__filesystem/recursive_directory_iterator.h>
 #include<__filesystem/space_info.h>
 #include<__filesystem/u8path.h>
+
+#include <__availability>
+#include <__config>
+#include <__debug>
+#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/enable_view.h>
+#include <__utility/forward.h>
+#include <chrono>
 #include <compare>
+#include <cstddef>
+#include <cstdlib>
+#include <iosfwd>
+#include <iterator>
+#include <memory>
+#include <stack>
+#include <string>
+#include <string_view>
+#include <system_error>
+#include <utility>
 #include <version>
 
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# include <locale>
+# include <iomanip> // for quoted
+#endif
+
 #if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
 # error "The Filesystem library is not supported since libc++ has been configured with LIBCXX_ENABLE_FILESYSTEM disabled"
 #endif
diff --git a/src/filesystem/directory_iterator.cpp b/src/filesystem/directory_iterator.cpp
index 90b255d..6219cea 100644
--- a/src/filesystem/directory_iterator.cpp
+++ b/src/filesystem/directory_iterator.cpp
@@ -6,9 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "__config"
 #include "filesystem"
-#include "stack"
+#include "__config"
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN
 #define NOMINMAX
diff --git a/src/filesystem/filesystem_common.h b/src/filesystem/filesystem_common.h
index 717894e..a2c340e 100644
--- a/src/filesystem/filesystem_common.h
+++ b/src/filesystem/filesystem_common.h
@@ -17,7 +17,6 @@
 #include "cstdlib"
 #include "ctime"
 #include "filesystem"
-#include "system_error"
 
 #if !defined(_LIBCPP_WIN32API)
 # include <unistd.h>
diff --git a/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp b/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
index bbeaedd..f93737c 100644
--- a/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
+++ b/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
@@ -14,13 +14,12 @@
 
 // ADDITIONAL_COMPILE_FLAGS: -I %S/../../../../src/filesystem
 
-#include <cassert>
-#include <chrono>
-#include <cstddef>
 #include <filesystem>
-#include <limits>
-#include <string>
+#include <chrono>
 #include <type_traits>
+#include <limits>
+#include <cstddef>
+#include <cassert>
 
 #include "filesystem_common.h"
 
diff --git a/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp
index f7e5770..e71d4e2 100644
--- a/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp
+++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp
@@ -19,10 +19,10 @@
 // bool operator> (directory_entry const&) const noexcept;
 // bool operator>=(directory_entry const&) const noexcept;
 
+
 #include "filesystem_include.h"
-#include <cassert>
 #include <type_traits>
-#include <utility>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
index 403d1ae..97b5d23 100644
--- a/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
+++ b/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
@@ -19,9 +19,8 @@
 // typedef ... iterator_category
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <iterator>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp b/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
index 8fd23b6..3c0ae5d 100644
--- a/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
+++ b/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
@@ -21,10 +21,8 @@
 // const path& path2() const noexcept;
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
-#include <system_error>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
index 9044b2f..a718255 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
@@ -15,9 +15,8 @@
 // path& operator=(path const&);
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
index 0f3e474..69dff08 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
@@ -17,9 +17,8 @@
 // path& operator=(path&&) noexcept
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 #include "count_new.h"
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
index 1155b7c..31d00ff 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
@@ -15,9 +15,8 @@
 // path(path const&)
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
index 9f575ba..40a8c54 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
@@ -16,9 +16,8 @@
 // path(path&&) noexcept
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 #include "count_new.h"
diff --git a/test/std/input.output/filesystems/class.path/synop.pass.cpp b/test/std/input.output/filesystems/class.path/synop.pass.cpp
index ab18399..e9e0a99 100644
--- a/test/std/input.output/filesystems/class.path/synop.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/synop.pass.cpp
@@ -17,9 +17,8 @@
 // static constexpr value_type preferred_separator = ...;
 
 #include "filesystem_include.h"
-#include <cassert>
-#include <string>
 #include <type_traits>
+#include <cassert>
 
 #include "test_macros.h"
 
diff --git a/test/support/filesystem_test_helper.h b/test/support/filesystem_test_helper.h
index 44a0164..00f4701 100644
--- a/test/support/filesystem_test_helper.h
+++ b/test/support/filesystem_test_helper.h
@@ -14,10 +14,9 @@
 #endif
 
 #include <cassert>
-#include <chrono>
 #include <cstdio> // for printf
 #include <string>
-#include <system_error>
+#include <chrono>
 #include <vector>
 
 #include "make_string.h"