File tree 20 files changed +194
-10
lines changed 20 files changed +194
-10
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ add_proxy_header_library(
81
81
libc.include .signal
82
82
)
83
83
84
+ add_header_library(stdlib_overlay HDRS stdlib_overlay.h)
85
+
84
86
add_proxy_header_library(
85
87
stdlib_macros
86
88
HDRS
@@ -193,3 +195,4 @@ add_proxy_header_library(
193
195
)
194
196
195
197
add_subdirectory (types)
198
+ add_subdirectory (func)
Original file line number Diff line number Diff line change
1
+ add_proxy_header_library(
2
+ aligned_alloc
3
+ HDRS
4
+ aligned_alloc.h
5
+ DEPENDS
6
+ libc.hdr.stdlib_overlay
7
+ FULL_BUILD_DEPENDS
8
+ libc.include .stdlib
9
+ libc.hdr.types.size_t
10
+ )
11
+
12
+ add_proxy_header_library(
13
+ malloc
14
+ HDRS
15
+ malloc.h
16
+ DEPENDS
17
+ libc.hdr.stdlib_overlay
18
+ FULL_BUILD_DEPENDS
19
+ libc.include .stdlib
20
+ libc.hdr.types.size_t
21
+ )
22
+
23
+ add_proxy_header_library(
24
+ realloc
25
+ HDRS
26
+ realloc.h
27
+ DEPENDS
28
+ libc.hdr.stdlib_overlay
29
+ FULL_BUILD_DEPENDS
30
+ libc.include .stdlib
31
+ libc.hdr.types.size_t
32
+ )
33
+
34
+ add_proxy_header_library(
35
+ free
36
+ HDRS
37
+ free.h
38
+ DEPENDS
39
+ libc.hdr.stdlib_overlay
40
+ FULL_BUILD_DEPENDS
41
+ libc.include .stdlib
42
+ )
43
+
44
+ add_proxy_header_library(
45
+ _Exit
46
+ HDRS
47
+ _Exit.h
48
+ DEPENDS
49
+ libc.hdr.stdlib_overlay
50
+ FULL_BUILD_DEPENDS
51
+ libc.include .stdlib
52
+ )
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the _Exit proxy -------------------------------------===//
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_FUNC_EXIT_H
10
+ #define LLVM_LIBC_HDR_FUNC_EXIT_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ extern "C" void _Exit (int );
14
+
15
+ #else // Overlay mode
16
+
17
+ #include "hdr/stdlib_overlay.h"
18
+
19
+ #endif
20
+
21
+ #endif // LLVM_LIBC_HDR_EXIT_H
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the aligned_alloc.h proxy ---------------------------===//
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_FUNC_ALIGNED_ALLOC_H
10
+ #define LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ #include "hdr/types/size_t.h"
14
+ extern "C" void * aligned_alloc (size_t , size_t );
15
+
16
+ #else // Overlay mode
17
+
18
+ #include "hdr/stdlib_overlay.h"
19
+
20
+ #endif
21
+
22
+ #endif
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the free.h proxy ------------------------------------===//
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_FUNC_FREE_H
10
+ #define LLVM_LIBC_HDR_FUNC_FREE_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ extern "C" void free (void * );
14
+
15
+ #else // Overlay mode
16
+
17
+ #include "hdr/stdlib_overlay.h"
18
+
19
+ #endif
20
+
21
+ #endif
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the malloc.h proxy ----------------------------------===//
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_FUNC_MALLOC_H
10
+ #define LLVM_LIBC_HDR_FUNC_MALLOC_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ #include "hdr/types/size_t.h"
14
+ extern "C" void * malloc (size_t );
15
+
16
+ #else // Overlay mode
17
+
18
+ #include "hdr/stdlib_overlay.h"
19
+
20
+ #endif
21
+
22
+ #endif
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the realloc.h proxy ---------------------------------===//
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_FUNC_REALLOC_H
10
+ #define LLVM_LIBC_HDR_FUNC_REALLOC_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ #include "hdr/types/size_t.h"
14
+ extern "C" void * realloc (void * ptr , size_t new_size );
15
+
16
+ #else // Overlay mode
17
+
18
+ #include "hdr/stdlib_overlay.h"
19
+
20
+ #endif
21
+
22
+ #endif
Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ add_header_library(
242
242
HDRS
243
243
char_vector.h
244
244
DEPENDS
245
+ libc.hdr.func.free
246
+ libc.hdr.func.malloc
247
+ libc.hdr.func.realloc
245
248
libc.src.__support.common
246
249
)
247
250
Original file line number Diff line number Diff line change @@ -80,8 +80,10 @@ add_header_library(
80
80
HDRS
81
81
string .h
82
82
DEPENDS
83
- libc.include .stdlib
84
83
.string_view
84
+ libc.hdr.func.free
85
+ libc.hdr.func.malloc
86
+ libc.hdr.func.realloc
85
87
libc.src.__support.common
86
88
libc.src.__support.integer_to_string
87
89
libc.src.string .memory_utils.inline_memcpy
@@ -199,7 +201,9 @@ add_object_library(
199
201
HDRS
200
202
new.h
201
203
DEPENDS
202
- libc.include .stdlib
204
+ libc.hdr.func.free
205
+ libc.hdr.func.malloc
206
+ libc.hdr.func.aligned_alloc
203
207
libc.src.__support.common
204
208
libc.src.__support.macros .properties.os
205
209
)
Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " new.h"
10
- #include < stdlib.h > // For free, etc
10
+ #include " hdr/func/ free.h "
11
11
12
12
void operator delete (void *mem) noexcept { ::free (mem); }
13
13
Original file line number Diff line number Diff line change 9
9
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_NEW_H
10
10
#define LLVM_LIBC_SRC___SUPPORT_CPP_NEW_H
11
11
12
+ #include " hdr/func/aligned_alloc.h"
13
+ #include " hdr/func/free.h"
14
+ #include " hdr/func/malloc.h"
12
15
#include " src/__support/common.h"
13
16
#include " src/__support/macros/config.h"
14
17
#include " src/__support/macros/properties/os.h"
15
18
16
19
#include < stddef.h> // For size_t
17
- #include < stdlib.h> // For malloc, free etc.
18
20
19
21
// Defining members in the std namespace is not preferred. But, we do it here
20
22
// so that we can use it to define the operator new which takes std::align_val_t
Original file line number Diff line number Diff line change 9
9
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H
10
10
#define LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H
11
11
12
+ #include " hdr/func/free.h"
13
+ #include " hdr/func/malloc.h"
14
+ #include " hdr/func/realloc.h"
12
15
#include " src/__support/CPP/string_view.h"
13
16
#include " src/__support/integer_to_string.h" // IntegerToString
14
17
#include " src/__support/macros/config.h"
17
20
#include " src/string/string_utils.h" // string_length
18
21
19
22
#include < stddef.h> // size_t
20
- #include < stdlib.h> // malloc, free
21
23
22
24
namespace LIBC_NAMESPACE_DECL {
23
25
namespace cpp {
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ add_object_library(
18
18
libc.src.__support.error_or
19
19
libc.hdr.types.off_t
20
20
libc.hdr.stdio_macros
21
+ libc.hdr.func.realloc
21
22
)
22
23
23
24
add_object_library(
Original file line number Diff line number Diff line change 8
8
9
9
#include " file.h"
10
10
11
+ #include " hdr/func/realloc.h"
11
12
#include " hdr/stdio_macros.h"
12
13
#include " hdr/types/off_t.h"
13
14
#include " src/__support/CPP/new.h"
Original file line number Diff line number Diff line change 9
9
#ifndef LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
10
10
#define LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
11
11
12
+ #include " hdr/func/free.h"
13
+ #include " hdr/func/malloc.h"
14
+ #include " hdr/func/realloc.h"
12
15
#include " src/__support/common.h" // LIBC_INLINE
13
16
#include " src/__support/macros/config.h"
14
17
15
18
#include < stddef.h> // size_t
16
- #include < stdlib.h> // malloc, realloc, free
17
19
18
20
namespace LIBC_NAMESPACE_DECL {
19
21
Original file line number Diff line number Diff line change @@ -129,11 +129,12 @@ add_header_library(
129
129
HDRS
130
130
vasprintf_internal.h
131
131
DEPENDS
132
+ libc.hdr.func.malloc
133
+ libc.hdr.func.free
134
+ libc.hdr.func.realloc
132
135
libc.src.__support.arg_list
133
136
libc.src.stdio.printf_core.printf_main
134
137
libc.src.stdio.printf_core.writer
135
- libc.src.stdlib.malloc
136
- libc.src.stdlib.realloc
137
138
)
138
139
139
140
if (NOT (TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD)
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
+ #include " hdr/func/free.h"
10
+ #include " hdr/func/malloc.h"
11
+ #include " hdr/func/realloc.h"
9
12
#include " src/__support/arg_list.h"
10
13
#include " src/stdio/printf.h"
11
14
#include " src/stdio/printf_core/core_structs.h"
12
15
#include " src/stdio/printf_core/printf_main.h"
13
16
#include " src/stdio/printf_core/writer.h"
14
- #include < stdlib.h> // malloc, realloc, free
15
17
16
18
namespace LIBC_NAMESPACE_DECL {
17
19
namespace printf_core {
Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ if(LLVM_LIBC_FULL_BUILD)
382
382
SRCS
383
383
atexit_test.cpp
384
384
DEPENDS
385
- libc.include .stdlib
385
+ libc.hdr.func._Exit
386
386
libc.src.stdlib._Exit
387
387
libc.src.stdlib.exit
388
388
libc.src.stdlib.atexit
@@ -398,6 +398,7 @@ if(LLVM_LIBC_FULL_BUILD)
398
398
SRCS
399
399
at_quick_exit_test.cpp
400
400
DEPENDS
401
+ libc.hdr.func._Exit
401
402
libc.src.stdlib.quick_exit
402
403
libc.src.stdlib.at_quick_exit
403
404
libc.src.__support.CPP.array
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
+ #include " hdr/func/_Exit.h"
9
10
#include " src/__support/CPP/array.h"
10
11
#include " src/__support/CPP/utility.h"
11
12
#include " src/stdlib/at_quick_exit.h"
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
+ #include " hdr/func/_Exit.h"
9
10
#include " src/__support/CPP/array.h"
10
11
#include " src/__support/CPP/utility.h"
11
12
#include " src/stdlib/atexit.h"
You can’t perform that action at this time.
0 commit comments