summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakuto Ikuta <tikuta@google.com>2024-04-23 22:11:39 +0900
committerGitHub <noreply@github.com>2024-04-23 09:11:39 -0400
commitb926f75e89c025afeb040cbd245ce2ba9cce9fce (patch)
treea86b9c21bc02e234c03eb148e91a8414302d7658
parent70d3ddb280ea47066349eed1cd99bc0348bf4186 (diff)
[libc++] Add some private headers to libcxx.imp (#89568)
https://github.com/llvm/llvm-project/pull/78295 dropped private headers in top level directory from libcxx.imp. This PR re-adds them to libcxx.imp.
-rw-r--r--libcxx/utils/libcxx/header_information.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index bccae353b0c6..e2165d6ab80b 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 in header and not header.startswith("ext/")
+
+
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 @@ test = pathlib.Path(os.path.join(libcxx_root, "test"))
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 @@ public_headers = toplevel_headers + experimental_headers
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"]
]