Skip to content

Commit e581f1c

Browse files
authored
[libc] Add proxy header for ENTRY type. (#139746)
#139561
1 parent d9380ec commit e581f1c

File tree

9 files changed

+41
-7
lines changed

9 files changed

+41
-7
lines changed

libc/fuzzing/__support/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ add_libc_fuzzer(
1919
SRCS
2020
hashtable_fuzz.cpp
2121
DEPENDS
22+
libc.hdr.types.ENTRY
2223
libc.src.__support.HashTable.table
2324
COMPILE_OPTIONS
2425
-D__LIBC_EXPLICIT_SIMD_OPT

libc/fuzzing/__support/hashtable_fuzz.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// Fuzzing test for llvm-libc hashtable implementations.
1010
///
1111
//===----------------------------------------------------------------------===//
12-
#include "include/llvm-libc-types/ENTRY.h"
12+
#include "hdr/types/ENTRY.h"
1313
#include "src/__support/CPP/bit.h"
1414
#include "src/__support/CPP/string_view.h"
1515
#include "src/__support/HashTable/table.h"

libc/hdr/types/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,12 @@ add_proxy_header_library(
374374
FULL_BUILD_DEPENDS
375375
libc.include.llvm-libc-types.cpu_set_t
376376
)
377+
378+
add_proxy_header_library(
379+
ENTRY
380+
HDRS
381+
ENTRY.h
382+
FULL_BUILD_DEPENDS
383+
libc.include.llvm-libc-types.ENTRY
384+
libc.include.search
385+
)

libc/hdr/types/ENTRY.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Proxy header for ENTRY --------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_HDR_TYPES_ENTRY_H
10+
#define LLVM_LIBC_HDR_TYPES_ENTRY_H
11+
12+
#ifdef LIBC_FULL_BUILD
13+
14+
#include "include/llvm-libc-types/ENTRY.h"
15+
16+
#else // Overlay mode
17+
18+
#include <search.h>
19+
20+
#endif // LLVM_LIBC_FULL_BUILD
21+
22+
#endif // LLVM_LIBC_HDR_TYPES_ENTRY_H

libc/src/__support/HashTable/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add_header_library(
2525
table.h
2626
DEPENDS
2727
.bitmask
28-
libc.include.llvm-libc-types.ENTRY
28+
libc.hdr.types.ENTRY
2929
libc.src.__support.CPP.bit
3030
libc.src.__support.CPP.new
3131
libc.src.__support.hash

libc/src/__support/HashTable/table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_HASHTABLE_TABLE_H
1010
#define LLVM_LIBC_SRC___SUPPORT_HASHTABLE_TABLE_H
1111

12-
#include "include/llvm-libc-types/ENTRY.h"
12+
#include "hdr/types/ENTRY.h"
1313
#include "src/__support/CPP/bit.h" // bit_ceil
1414
#include "src/__support/CPP/new.h"
1515
#include "src/__support/HashTable/bitmask.h"

libc/src/search/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ add_entrypoint_object(
3434
HDRS
3535
hsearch.h
3636
DEPENDS
37+
libc.hdr.types.ENTRY
3738
libc.src.search.hsearch.global
3839
libc.src.__support.HashTable.table
3940
libc.src.__support.HashTable.randomness
4041
libc.src.errno.errno
41-
libc.include.search
4242
)
4343

4444
add_entrypoint_object(
@@ -48,9 +48,9 @@ add_entrypoint_object(
4848
HDRS
4949
hsearch_r.h
5050
DEPENDS
51+
libc.hdr.types.ENTRY
5152
libc.src.__support.HashTable.table
5253
libc.src.errno.errno
53-
libc.include.search
5454
)
5555

5656
add_entrypoint_object(

libc/src/search/hsearch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
#ifndef LLVM_LIBC_SRC_SEARCH_HSEARCH_H
1010
#define LLVM_LIBC_SRC_SEARCH_HSEARCH_H
1111

12+
#include "hdr/types/ENTRY.h"
1213
#include "src/__support/macros/config.h"
13-
#include <search.h> // ENTRY, ACTION
14+
#include <search.h> // ACTION
1415

1516
namespace LIBC_NAMESPACE_DECL {
1617
ENTRY *hsearch(ENTRY item, ACTION action);

libc/src/search/hsearch_r.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
#ifndef LLVM_LIBC_SRC_SEARCH_HSEARCH_R_H
1010
#define LLVM_LIBC_SRC_SEARCH_HSEARCH_R_H
1111

12+
#include "hdr/types/ENTRY.h"
1213
#include "src/__support/macros/config.h"
13-
#include <search.h> // ENTRY, ACTION
14+
#include <search.h> // ACTION
1415

1516
namespace LIBC_NAMESPACE_DECL {
1617
int hsearch_r(ENTRY item, ACTION action, ENTRY **retval,

0 commit comments

Comments
 (0)