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

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 06:11:43 PDT 2024


Author: Takuto Ikuta
Date: 2024-04-23T09:11:39-04:00
New Revision: b926f75e89c025afeb040cbd245ce2ba9cce9fce

URL: https://github.com/llvm/llvm-project/commit/b926f75e89c025afeb040cbd245ce2ba9cce9fce
DIFF: https://github.com/llvm/llvm-project/commit/b926f75e89c025afeb040cbd245ce2ba9cce9fce.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/utils/libcxx/header_information.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index bccae353b0c6bd..e2165d6ab80b01 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"]
 ]


        


More information about the libcxx-commits mailing list