[libcxx-commits] [libcxx] Add some private headers to libcxx.imp (PR #89568)

Takuto Ikuta via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 21 21:28:01 PDT 2024


https://github.com/atetubou created https://github.com/llvm/llvm-project/pull/89568

https://github.com/llvm/llvm-project/pull/78295 dropped private header in top level directory.

This PR re-adds them to libcxx.imp.

>From 3971b55e6f80fe157a4aafe19dacd084f034807e Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Thu, 18 Apr 2024 17:54:19 +0900
Subject: [PATCH 1/2] add top level headers starting from __ in libcxx.imp

---
 libcxx/include/libcxx.imp                 | 13 +++++++++++++
 libcxx/utils/libcxx/header_information.py |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
index a4e2690fc55c9a..6eb466f8a68a10 100644
--- a/libcxx/include/libcxx.imp
+++ b/libcxx/include/libcxx.imp
@@ -253,6 +253,8 @@
   { include: [ "<__bit/invert_if.h>", "private", "<bit>", "public" ] },
   { include: [ "<__bit/popcount.h>", "private", "<bit>", "public" ] },
   { include: [ "<__bit/rotate.h>", "private", "<bit>", "public" ] },
+  { include: [ "<__bit_reference>", "private", "<bitset>", "public" ] },
+  { include: [ "<__bit_reference>", "private", "<vector>", "public" ] },
   { include: [ "<__charconv/chars_format.h>", "private", "<charconv>", "public" ] },
   { include: [ "<__charconv/from_chars_integral.h>", "private", "<charconv>", "public" ] },
   { include: [ "<__charconv/from_chars_result.h>", "private", "<charconv>", "public" ] },
@@ -443,6 +445,8 @@
   { include: [ "<__fwd/subrange.h>", "private", "<ranges>", "public" ] },
   { include: [ "<__fwd/tuple.h>", "private", "<tuple>", "public" ] },
   { include: [ "<__fwd/vector.h>", "private", "<vector>", "public" ] },
+  { include: [ "<__hash_table>", "private", "<unordered_map>", "public" ] },
+  { include: [ "<__hash_table>", "private", "<unordered_set>", "public" ] },
   { include: [ "<__ios/fpos.h>", "private", "<ios>", "public" ] },
   { include: [ "<__iterator/access.h>", "private", "<iterator>", "public" ] },
   { include: [ "<__iterator/advance.h>", "private", "<iterator>", "public" ] },
@@ -486,6 +490,7 @@
   { include: [ "<__iterator/sortable.h>", "private", "<iterator>", "public" ] },
   { include: [ "<__iterator/unreachable_sentinel.h>", "private", "<iterator>", "public" ] },
   { include: [ "<__iterator/wrap_iter.h>", "private", "<iterator>", "public" ] },
+  { include: [ "<__locale>", "private", "<locale>", "public" ] },
   { include: [ "<__locale_dir/locale_base_api.h>", "private", "<locale>", "public" ] },
   { include: [ "<__locale_dir/locale_base_api/android.h>", "private", "<locale>", "public" ] },
   { include: [ "<__locale_dir/locale_base_api/bsd_locale_defaults.h>", "private", "<locale>", "public" ] },
@@ -562,6 +567,10 @@
   { include: [ "<__mutex/once_flag.h>", "private", "<mutex>", "public" ] },
   { include: [ "<__mutex/tag_types.h>", "private", "<mutex>", "public" ] },
   { include: [ "<__mutex/unique_lock.h>", "private", "<mutex>", "public" ] },
+  { include: [ "<__node_handle>", "private", "<map>", "public" ] },
+  { include: [ "<__node_handle>", "private", "<set>", "public" ] },
+  { include: [ "<__node_handle>", "private", "<unordered_map>", "public" ] },
+  { include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] },
   { include: [ "<__numeric/accumulate.h>", "private", "<numeric>", "public" ] },
   { include: [ "<__numeric/adjacent_difference.h>", "private", "<numeric>", "public" ] },
   { include: [ "<__numeric/exclusive_scan.h>", "private", "<numeric>", "public" ] },
@@ -658,6 +667,8 @@
   { include: [ "<__ranges/view_interface.h>", "private", "<ranges>", "public" ] },
   { include: [ "<__ranges/views.h>", "private", "<ranges>", "public" ] },
   { include: [ "<__ranges/zip_view.h>", "private", "<ranges>", "public" ] },
+  { include: [ "<__split_buffer>", "private", "<deque>", "public" ] },
+  { include: [ "<__split_buffer>", "private", "<vector>", "public" ] },
   { include: [ "<__stop_token/atomic_unique_lock.h>", "private", "<stop_token>", "public" ] },
   { include: [ "<__stop_token/intrusive_list_view.h>", "private", "<stop_token>", "public" ] },
   { include: [ "<__stop_token/intrusive_shared_ptr.h>", "private", "<stop_token>", "public" ] },
@@ -700,6 +711,8 @@
   { include: [ "<__thread/this_thread.h>", "private", "<thread>", "public" ] },
   { include: [ "<__thread/thread.h>", "private", "<thread>", "public" ] },
   { include: [ "<__thread/timed_backoff_policy.h>", "private", "<thread>", "public" ] },
+  { include: [ "<__tree>", "private", "<map>", "public" ] },
+  { include: [ "<__tree>", "private", "<set>", "public" ] },
   { include: [ "<__tuple/find_index.h>", "private", "<tuple>", "public" ] },
   { include: [ "<__tuple/make_tuple_types.h>", "private", "<tuple>", "public" ] },
   { include: [ "<__tuple/sfinae_helpers.h>", "private", "<tuple>", "public" ] },
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index bccae353b0c6bd..57f14d62fc5225 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -192,10 +192,10 @@ def is_modulemap_header(header):
 assert libcxx_root.exists()
 
 all_headers = sorted(
-    p.relative_to(include).as_posix() for p in include.rglob("[a-z]*") if is_header(p)
+    p.relative_to(include).as_posix() for p in include.rglob("[_a-z]*") if is_header(p)
 )
 toplevel_headers = sorted(
-    p.relative_to(include).as_posix() for p in include.glob("[a-z]*") if is_header(p)
+    p.relative_to(include).as_posix() for p in include.glob("[_a-z]*") if is_header(p)
 )
 experimental_headers = sorted(
     p.relative_to(include).as_posix()

>From 3dcc3b7750395a05c943ecb5f065acfae1046e49 Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Thu, 18 Apr 2024 18:17:00 +0900
Subject: [PATCH 2/2] underscore

---
 libcxx/utils/libcxx/header_information.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index 57f14d62fc5225..6ace7c10cd9537 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -202,7 +202,7 @@ def is_modulemap_header(header):
     for p in include.glob("experimental/[a-z]*")
     if is_header(p)
 )
-public_headers = toplevel_headers + experimental_headers
+public_headers = list(filter(lambda x: not x.startswith("__"), toplevel_headers + experimental_headers))
 
 # The headers used in the std and std.compat modules.
 #
@@ -211,6 +211,7 @@ def is_modulemap_header(header):
     header
     for header in toplevel_headers
     if not header.endswith(".h")
+    and not header.startswith("__")
     # These headers have been removed in C++20 so are never part of a module.
     and not header in ["ccomplex", "ciso646", "cstdbool", "ctgmath"]
 ]



More information about the libcxx-commits mailing list