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

Roland McGrath via libc-commits libc-commits at lists.llvm.org
Tue Oct 28 11:55:45 PDT 2025


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

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.


>From ecd74b45bd209aba00bd2560d016b9244e303ae3 Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Tue, 28 Oct 2025 11:53:44 -0700
Subject: [PATCH] [libc][hdrgen] Fix `includes` sorting in JSON emission

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.
---
 libc/utils/hdrgen/hdrgen/header.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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()
+            ),
         }



More information about the libc-commits mailing list