[libc-commits] [libc] [libc][hdrgen] Fix `includes` sorting in JSON emission (PR #165460)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 28 11:56:59 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Roland McGrath (frobtech)

<details>
<summary>Changes</summary>

The JSON output support in hdrgen had a bug that tripped when
used with headers that use special-case headers like <stdint.h>
to supply some times, as well as llvm-libc-types/*.h headers.


---
Full diff: https://github.com/llvm/llvm-project/pull/165460.diff


1 Files Affected:

- (modified) libc/utils/hdrgen/hdrgen/header.py (+3-3) 


``````````diff
diff --git a/libc/utils/hdrgen/hdrgen/header.py b/libc/utils/hdrgen/hdrgen/header.py
index 2118db6e5fb75..967aa1fac5f22 100644
--- a/libc/utils/hdrgen/hdrgen/header.py
+++ b/libc/utils/hdrgen/hdrgen/header.py
@@ -241,7 +241,7 @@ def json_data(self):
         return {
             "name": self.name,
             "standards": self.standards,
-            "includes": [
-                str(file) for file in sorted({COMMON_HEADER} | self.includes())
-            ],
+            "includes": sorted(
+                str(file) for file in {COMMON_HEADER} | self.includes()
+            ),
         }

``````````

</details>


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


More information about the libc-commits mailing list