diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py index bccae353b0c6b..e2165d6ab80b0 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 @@ 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"] ]