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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 22 07:12:46 PDT 2024


================
@@ -192,25 +192,27 @@ 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.
 #
 # This is the set of all C++23-and-later headers, excluding C compatibility headers.
 module_headers = [
     header
     for header in toplevel_headers
-    if not header.endswith(".h")
+    if not header.endswith(".h") and not header.startswith("__")
----------------
ldionne wrote:

I would suggest introducing

```
def is_public_header(header):
  return not header.startswith("__")
```

Then, `public_headers` becomes `public_headers = [p for p in all_headers if is_public_header(p)]` and the definition of `module_headers` will also read more naturally.

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


More information about the libcxx-commits mailing list