[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:26:55 PDT 2024
https://github.com/atetubou updated https://github.com/llvm/llvm-project/pull/89568
>From f9a8c469008f905ab65ff3a2df38ed223e4d3bfd Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Tue, 23 Apr 2024 13:08:34 +0900
Subject: [PATCH 1/2] 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
---
libcxx/utils/libcxx/header_information.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index bccae353b0c6bd..f4083f1f725171 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -192,17 +192,19 @@ 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.
#
@@ -210,7 +212,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 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"]
]
>From 274337a1e3b910f316662714b96bc155537b9227 Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta at google.com>
Date: Tue, 23 Apr 2024 17:26:30 +0900
Subject: [PATCH 2/2] is_public_header
---
libcxx/utils/libcxx/header_information.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index f4083f1f725171..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?
@@ -202,9 +206,8 @@ def is_modulemap_header(header):
for p in include.glob("experimental/[a-z]*")
if is_header(p)
)
-public_headers = list(
- filter(lambda x: not x.startswith("__"), 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.
#
@@ -212,7 +215,7 @@ def is_modulemap_header(header):
module_headers = [
header
for header in toplevel_headers
- if not header.endswith(".h") and not header.startswith("__")
+ 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"]
]
More information about the libcxx-commits
mailing list