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

Takuto Ikuta via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 01:53:54 PDT 2024


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

>From ec2d5fd161d8bc1e5a80745ab873b4c784ceb5e5 Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Tue, 23 Apr 2024 17:38:00 +0900
Subject: [PATCH 1/2] git squash commit for update_libcxx_imp.

f9a8c469008f905ab65ff3a2df38ed223e4d3bfd
git squash commit for update_libcxx_imp.

e0c4b64298c1552ba5c260875be13922d8fa2707
git squash commit for update_libcxx_imp.

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

3dcc3b7750395a05c943ecb5f065acfae1046e49
underscore

0ac78d763c4a1c019c3e92385d30da64d35b6134
fmt

274337a1e3b910f316662714b96bc155537b9227
is_public_header
---
 libcxx/utils/libcxx/header_information.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index bccae353b0c6bd..a970007210ac79 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -161,6 +161,10 @@ def is_header(file):
     ]
 
 
+def is_public_header(header):
+    return not header.startswith("__")
+
+
 def is_modulemap_header(header):
     """Returns whether a header should be listed in the modulemap"""
     # TODO: Should `__config_site` be in the modulemap?
@@ -192,17 +196,18 @@ 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 = [p for p in all_headers if is_public_header(p)]
 
 # The headers used in the std and std.compat modules.
 #
@@ -210,7 +215,7 @@ def is_modulemap_header(header):
 module_headers = [
     header
     for header in toplevel_headers
-    if not header.endswith(".h")
+    if not header.endswith(".h") and is_public_header(header)
     # These headers have been removed in C++20 so are never part of a module.
     and not header in ["ccomplex", "ciso646", "cstdbool", "ctgmath"]
 ]

>From 7fbdb14dd1af02ee869a0c6fa7bd3c168fe791df Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Tue, 23 Apr 2024 17:53:33 +0900
Subject: [PATCH 2/2] hear

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

diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index a970007210ac79..e2165d6ab80b01 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -162,7 +162,7 @@ def is_header(file):
 
 
 def is_public_header(header):
-    return not header.startswith("__")
+    return "__" not in header and not header.startswith("ext/")
 
 
 def is_modulemap_header(header):



More information about the libcxx-commits mailing list