[libcxx-commits] [libcxx] 3ea717b - [libc++] Add missing includes in the locale headers (#213035)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 3 05:54:27 PDT 2026


Author: Louis Dionne
Date: 2026-08-03T08:54:22-04:00
New Revision: 3ea717b891a05dd00006b51e506b30198d57f763

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

LOG: [libc++] Add missing includes in the locale headers (#213035)

Several headers use entities from `<__locale>` but rely on picking them
up transitively, in most cases through `<ios>`. Fix this in preparation
for splitting up `<__locale>`.

Added: 
    

Modified: 
    libcxx/include/__filesystem/path.h
    libcxx/include/__locale
    libcxx/include/__locale_dir/num.h
    libcxx/include/__locale_dir/time.h
    libcxx/include/__locale_dir/wbuffer_convert.h
    libcxx/include/sstream

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index f89c829505d61..3e4e228017e14 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -29,7 +29,8 @@
 #include <string_view>
 
 #if _LIBCPP_HAS_LOCALIZATION
-#  include <iomanip> // for quoted
+#  include <__locale> // for __narrow_to_utf8 and __widen_from_utf8
+#  include <iomanip>  // for quoted
 #endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__locale b/libcxx/include/__locale
index f48fd85805919..d5dafc6c65f30 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -16,6 +16,7 @@
 
 #if _LIBCPP_HAS_LOCALIZATION
 
+#  include <__fwd/ios.h>
 #  include <__locale_dir/locale_base_api.h>
 #  include <__memory/addressof.h>
 #  include <__memory/shared_count.h>
@@ -27,6 +28,7 @@
 #  include <clocale>
 #  include <cstdint>
 #  include <cstdlib>
+#  include <stdexcept>
 #  include <string>
 #  include <text_encoding>
 

diff  --git a/libcxx/include/__locale_dir/num.h b/libcxx/include/__locale_dir/num.h
index d50d0e9ba4ab8..3c341c7779ab1 100644
--- a/libcxx/include/__locale_dir/num.h
+++ b/libcxx/include/__locale_dir/num.h
@@ -18,6 +18,7 @@
 #include <__config>
 #include <__iterator/istreambuf_iterator.h>
 #include <__iterator/ostreambuf_iterator.h>
+#include <__locale>
 #include <__locale_dir/check_grouping.h>
 #include <__locale_dir/get_c_locale.h>
 #include <__locale_dir/pad_and_output.h>

diff  --git a/libcxx/include/__locale_dir/time.h b/libcxx/include/__locale_dir/time.h
index 7db1cc660cd30..4c082e0e40944 100644
--- a/libcxx/include/__locale_dir/time.h
+++ b/libcxx/include/__locale_dir/time.h
@@ -11,6 +11,7 @@
 
 #include <__algorithm/copy.h>
 #include <__config>
+#include <__locale>
 #include <__locale_dir/get_c_locale.h>
 #include <__locale_dir/scan_keyword.h>
 #include <ios>

diff  --git a/libcxx/include/__locale_dir/wbuffer_convert.h b/libcxx/include/__locale_dir/wbuffer_convert.h
index 9c87fac6cf193..08df30a1183f0 100644
--- a/libcxx/include/__locale_dir/wbuffer_convert.h
+++ b/libcxx/include/__locale_dir/wbuffer_convert.h
@@ -11,6 +11,7 @@
 
 #include <__algorithm/reverse.h>
 #include <__config>
+#include <__locale>
 #include <__string/char_traits.h>
 #include <ios>
 #include <streambuf>

diff  --git a/libcxx/include/sstream b/libcxx/include/sstream
index d13ba265b4674..0c1aa65904241 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -320,6 +320,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
 #  if _LIBCPP_HAS_LOCALIZATION
 
 #    include <__fwd/sstream.h>
+#    include <__locale>
 #    include <__ostream/basic_ostream.h>
 #    include <__type_traits/is_convertible.h>
 #    include <__utility/swap.h>


        


More information about the libcxx-commits mailing list