Skip to content

[libc++] Add some private headers to libcxx.imp #89568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

atetubou
Copy link
Contributor

@atetubou atetubou commented Apr 22, 2024

#78295 dropped private headers in top level directory from libcxx.imp.

This PR re-adds them to libcxx.imp.

@atetubou atetubou requested a review from a team as a code owner April 22, 2024 04:27
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 22, 2024

@llvm/pr-subscribers-libcxx

Author: Takuto Ikuta (atetubou)

Changes

#78295 dropped private headers in top level directory from libcxx.imp.

This PR re-adds them to libcxx.imp.


Full diff: https://github.com/llvm/llvm-project/pull/89568.diff

2 Files Affected:

  • (modified) libcxx/include/libcxx.imp (+13)
  • (modified) libcxx/utils/libcxx/header_information.py (+4-3)
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..6ace7c10cd9537 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -192,17 +192,17 @@ 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()
     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"]
 ]

@atetubou
Copy link
Contributor Author

@ldionne @philnik777 could you take a look this PR?

Copy link

github-actions bot commented Apr 22, 2024

✅ With the latest revision this PR passed the Python code formatter.

@atetubou atetubou force-pushed the update_libcxx_imp branch from 3dcc3b7 to 0ac78d7 Compare April 22, 2024 07:54
@atetubou atetubou changed the title Add some private headers to libcxx.imp [libc++] Add some private headers to libcxx.imp Apr 22, 2024
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase onto main, I just landed a change this morning that doesn't check-in the .imp file anymore.

Thanks for the patch and noticing this issue!

@atetubou atetubou force-pushed the update_libcxx_imp branch from 0ac78d7 to 274337a Compare April 23, 2024 08:26
f9a8c46
git squash commit for update_libcxx_imp.

e0c4b64
git squash commit for update_libcxx_imp.

3971b55
add top level headers starting from __ in libcxx.imp

3dcc3b7
underscore

0ac78d7
fmt

274337a
is_public_header
@atetubou atetubou force-pushed the update_libcxx_imp branch from 274337a to 7fbdb14 Compare April 23, 2024 08:53
@@ -161,6 +161,10 @@ def is_header(file):
]


def is_public_header(header):
return "__" not in header and not header.startswith("ext/")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not header.startswith("ext/") is to prevent appearing ext/* headers in
https://github.com/llvm/llvm-project/blob/main/libcxx/include/__std_clang_module

But I'm not sure that is intentional or not.

@ldionne ldionne merged commit b926f75 into llvm:main Apr 23, 2024
@atetubou
Copy link
Contributor Author

Thank you for review!

@atetubou atetubou deleted the update_libcxx_imp branch April 23, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants