[libcxx-commits] [libcxx] [libc++] Test existence of generated headers in the modulemap (PR #209312)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 21 05:43:13 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
The __config_site and __assertion_handler headers were previously excluded from the modulemap test, but since we now include them in the modulemap despite being generated, we can test it.
---
Full diff: https://github.com/llvm/llvm-project/pull/209312.diff
2 Files Affected:
- (modified) libcxx/test/libcxx/headers_in_modulemap.sh.py (+5-3)
- (modified) libcxx/utils/libcxx/header_information.py (+1-8)
``````````diff
diff --git a/libcxx/test/libcxx/headers_in_modulemap.sh.py b/libcxx/test/libcxx/headers_in_modulemap.sh.py
index d4a18a20c8926..f7670365bc521 100644
--- a/libcxx/test/libcxx/headers_in_modulemap.sh.py
+++ b/libcxx/test/libcxx/headers_in_modulemap.sh.py
@@ -1,10 +1,12 @@
-# RUN: %{python} %s %{libcxx-dir}/utils
+# RUN: %{python} %s %{libcxx-dir}/utils %{include-dir}
+import pathlib
import sys
sys.path.append(sys.argv[1])
-from libcxx.header_information import all_headers, libcxx_include
+from libcxx.header_information import all_headers
-with open(libcxx_include / "module.modulemap.in") as f:
+include = pathlib.Path(sys.argv[2])
+with open(include / "module.modulemap") as f:
modulemap = f.read()
isHeaderMissing = False
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index dbb1d9e040a33..841e1149d464e 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -9,7 +9,6 @@
import pathlib, functools
libcxx_root = pathlib.Path(__file__).resolve().parent.parent.parent
-libcxx_include = libcxx_root / "include"
assert libcxx_root.exists()
def _is_header_file(file):
@@ -102,13 +101,6 @@ def is_cxx03_frozen_header(self) -> bool:
def is_in_modulemap(self) -> bool:
"""Returns whether a header should be listed in the modulemap."""
- # TODO: Should `__config_site` be in the modulemap?
- if self._name == "__config_site":
- return False
-
- if self._name == "__assertion_handler":
- return False
-
# exclude libc++abi files
if self._name in ["cxxabi.h", "__cxxabi_config.h"]:
return False
@@ -151,6 +143,7 @@ def __hash__(self) -> int:
# Commonly-used sets of headers
+libcxx_include = libcxx_root / "include"
all_headers = [Header(p.relative_to(libcxx_include).as_posix()) for p in libcxx_include.rglob("[_a-z]*") if _is_header_file(p)]
all_headers += [Header("__config_site"), Header("__assertion_handler")] # Headers generated during the build process
public_headers = [h for h in all_headers if h.is_public()]
``````````
</details>
https://github.com/llvm/llvm-project/pull/209312
More information about the libcxx-commits
mailing list