Skip to content

Commit b926f75

Browse files
authored
[libc++] Add some private headers to libcxx.imp (#89568)
#78295 dropped private headers in top level directory from libcxx.imp. This PR re-adds them to libcxx.imp.
1 parent 70d3ddb commit b926f75

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

libcxx/utils/libcxx/header_information.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def is_header(file):
161161
]
162162

163163

164+
def is_public_header(header):
165+
return "__" not in header and not header.startswith("ext/")
166+
167+
164168
def is_modulemap_header(header):
165169
"""Returns whether a header should be listed in the modulemap"""
166170
# TODO: Should `__config_site` be in the modulemap?
@@ -192,25 +196,26 @@ def is_modulemap_header(header):
192196
assert libcxx_root.exists()
193197

194198
all_headers = sorted(
195-
p.relative_to(include).as_posix() for p in include.rglob("[a-z]*") if is_header(p)
199+
p.relative_to(include).as_posix() for p in include.rglob("[_a-z]*") if is_header(p)
196200
)
197201
toplevel_headers = sorted(
198-
p.relative_to(include).as_posix() for p in include.glob("[a-z]*") if is_header(p)
202+
p.relative_to(include).as_posix() for p in include.glob("[_a-z]*") if is_header(p)
199203
)
200204
experimental_headers = sorted(
201205
p.relative_to(include).as_posix()
202206
for p in include.glob("experimental/[a-z]*")
203207
if is_header(p)
204208
)
205-
public_headers = toplevel_headers + experimental_headers
209+
210+
public_headers = [p for p in all_headers if is_public_header(p)]
206211

207212
# The headers used in the std and std.compat modules.
208213
#
209214
# This is the set of all C++23-and-later headers, excluding C compatibility headers.
210215
module_headers = [
211216
header
212217
for header in toplevel_headers
213-
if not header.endswith(".h")
218+
if not header.endswith(".h") and is_public_header(header)
214219
# These headers have been removed in C++20 so are never part of a module.
215220
and not header in ["ccomplex", "ciso646", "cstdbool", "ctgmath"]
216221
]

0 commit comments

Comments
 (0)