[libc-commits] [libc] beea516 - [libc] Add proxy header for hsearch_data (#241000)
via libc-commits
libc-commits at lists.llvm.org
Thu Nov 12 03:06:04 PST 2026
Author: Sachin 🗲
Date: 2026-11-12T12:05:59+01:00
New Revision: beea516f9ef0dd9ccc2deabd6ea678146b83d3f2
URL: https://github.com/llvm/llvm-project/commit/beea516f9ef0dd9ccc2deabd6ea678146b83d3f2
DIFF: https://github.com/llvm/llvm-project/commit/beea516f9ef0dd9ccc2deabd6ea678146b83d3f2.diff
LOG: [libc] Add proxy header for hsearch_data (#241000)
adds proxy header for hsearch_data
#139561
Added:
libc/hdr/types/struct_hsearch_data.h
Modified:
libc/hdr/types/CMakeLists.txt
libc/src/search/CMakeLists.txt
libc/src/search/hcreate_r.h
libc/src/search/hdestroy_r.h
libc/src/search/hsearch_r.h
Removed:
################################################################################
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index f038bcfb380004..ce0cc303979f2b 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -1318,6 +1318,14 @@ add_proxy_header_library(
libc.include.llvm-libc-types.VISIT
)
+add_proxy_header_library(
+ struct_hsearch_data
+ HDRS
+ struct_hsearch_data.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.struct_hsearch_data
+)
+
add_proxy_header_library(
glob_t
HDRS
diff --git a/libc/hdr/types/struct_hsearch_data.h b/libc/hdr/types/struct_hsearch_data.h
new file mode 100644
index 00000000000000..72b7aa7f77f375
--- /dev/null
+++ b/libc/hdr/types/struct_hsearch_data.h
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Proxy header for hsearch_data.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_HSEARCH_DATA_H
+#define LLVM_LIBC_HDR_TYPES_HSEARCH_DATA_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/struct_hsearch_data.h"
+
+#else // Overlay mode
+
+#include <search.h>
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_HSEARCH_DATA_H
diff --git a/libc/src/search/CMakeLists.txt b/libc/src/search/CMakeLists.txt
index a872515b9af45f..714cab04c7066f 100644
--- a/libc/src/search/CMakeLists.txt
+++ b/libc/src/search/CMakeLists.txt
@@ -24,7 +24,7 @@ add_entrypoint_object(
libc.src.__support.HashTable.table
libc.src.__support.HashTable.randomness
libc.src.errno.errno
- libc.include.search
+ libc.hdr.types.struct_hsearch_data
)
add_entrypoint_object(
@@ -51,7 +51,7 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.ACTION
libc.hdr.types.ENTRY
- libc.include.llvm-libc-types.struct_hsearch_data
+ libc.hdr.types.struct_hsearch_data
libc.src.__support.HashTable.table
libc.src.errno.errno
)
@@ -77,7 +77,7 @@ add_entrypoint_object(
DEPENDS
libc.src.errno.errno
libc.src.__support.HashTable.table
- libc.include.search
+ libc.hdr.types.struct_hsearch_data
)
add_entrypoint_object(
diff --git a/libc/src/search/hcreate_r.h b/libc/src/search/hcreate_r.h
index 9606077b3e8304..939fa3a09ad030 100644
--- a/libc/src/search/hcreate_r.h
+++ b/libc/src/search/hcreate_r.h
@@ -9,8 +9,9 @@
#ifndef LLVM_LIBC_SRC_SEARCH_HCREATE_R_H
#define LLVM_LIBC_SRC_SEARCH_HCREATE_R_H
+#include "hdr/types/size_t.h"
+#include "hdr/types/struct_hsearch_data.h"
#include "src/__support/macros/config.h"
-#include <search.h>
namespace LIBC_NAMESPACE_DECL {
int hcreate_r(size_t capacity, struct hsearch_data *htab);
diff --git a/libc/src/search/hdestroy_r.h b/libc/src/search/hdestroy_r.h
index c9a4ddf018f386..32eae0a4d89484 100644
--- a/libc/src/search/hdestroy_r.h
+++ b/libc/src/search/hdestroy_r.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_SEARCH_HDESTROY_R_H
#define LLVM_LIBC_SRC_SEARCH_HDESTROY_R_H
+#include "hdr/types/struct_hsearch_data.h"
#include "src/__support/macros/config.h"
-#include <search.h>
namespace LIBC_NAMESPACE_DECL {
void hdestroy_r(struct hsearch_data *htab);
diff --git a/libc/src/search/hsearch_r.h b/libc/src/search/hsearch_r.h
index 692bc3cb5f370a..28eec31e5fe656 100644
--- a/libc/src/search/hsearch_r.h
+++ b/libc/src/search/hsearch_r.h
@@ -11,7 +11,7 @@
#include "hdr/types/ACTION.h"
#include "hdr/types/ENTRY.h"
-#include "include/llvm-libc-types/struct_hsearch_data.h"
+#include "hdr/types/struct_hsearch_data.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
More information about the libc-commits
mailing list