[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 12:10:57 PDT 2025
https://github.com/frobtech updated https://github.com/llvm/llvm-project/pull/165460
>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 1/2] [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()
+ ),
}
>From 25a6ef6cee66edca3abdc8b987963950c6ded8a5 Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Tue, 28 Oct 2025 12:10:16 -0700
Subject: [PATCH 2/2] reformatted
---
libc/utils/hdrgen/hdrgen/header.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libc/utils/hdrgen/hdrgen/header.py b/libc/utils/hdrgen/hdrgen/header.py
index 967aa1fac5f22..715d4b7c9b7ed 100644
--- a/libc/utils/hdrgen/hdrgen/header.py
+++ b/libc/utils/hdrgen/hdrgen/header.py
@@ -241,7 +241,5 @@ def json_data(self):
return {
"name": self.name,
"standards": self.standards,
- "includes": sorted(
- str(file) for file in {COMMON_HEADER} | self.includes()
- ),
+ "includes": sorted(str(file) for file in {COMMON_HEADER} | self.includes()),
}
More information about the libc-commits
mailing list