[libc-commits] [libc] [libc][docs] Fix docgen macro lookup for underscored headers (PR #194367)
via libc-commits
libc-commits at lists.llvm.org
Mon Apr 27 06:32:11 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Petter Berntsson (petbernt)
<details>
<summary>Changes</summary>
While adding implementation status for nl_types.h, I noticed docgen resolves it to nl-types.h instead of nl_types.h. As a result, headers with underscores are not matched correctly and their implementation status is not marked.
This patch fixes the handling of underscored header names in docgen so they are processed consistently.
---
Full diff: https://github.com/llvm/llvm-project/pull/194367.diff
1 Files Affected:
- (modified) libc/utils/docgen/header.py (+3-1)
``````````diff
diff --git a/libc/utils/docgen/header.py b/libc/utils/docgen/header.py
index 8885db42f0a5b..d43831eb48af8 100644
--- a/libc/utils/docgen/header.py
+++ b/libc/utils/docgen/header.py
@@ -112,5 +112,7 @@ def __get_macro_files(self) -> Generator[Path, None, None]:
instead use a hyphen in the name.
libc/include/llvm-libc-macros/sys-mman-macros.h
"""
- stem = self.stem.replace("/", "-")
+ # Some POSIX headers use underscores in the header name but hyphens in
+ # the macro file name, e.g. nl_types.h -> nl-types-macros.h.
+ stem = self.stem.replace("/", "-").replace("_", "-")
return self.macros_dir.glob(f"**/{stem}-macros.h")
``````````
</details>
https://github.com/llvm/llvm-project/pull/194367
More information about the libc-commits
mailing list