Skip to content

Commit bf0ded8

Browse files
[libc][NFC] split standalone_cpp into single headers
Previously, the entire support/CPP folder was in one header library, which meant that a lot of headers were included where they shouldn't be. This patch splits each header into its own target, as well as adjusting each place they were included to only include what is used. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D121237
1 parent 3f66882 commit bf0ded8

File tree

14 files changed

+78
-27
lines changed

14 files changed

+78
-27
lines changed

libc/fuzzing/math/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ add_libc_fuzzer(
4646
libc.src.math.truncf
4747
libc.src.math.truncl
4848
libc.src.__support.FPUtil.fputil
49-
libc.src.__support.CPP.standalone_cpp
49+
libc.src.__support.CPP.type_traits
5050
)
5151

5252
add_libc_fuzzer(

libc/src/__support/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ add_header_library(
2323
.ctype_utils
2424
libc.include.errno
2525
libc.src.errno.errno
26-
libc.src.__support.CPP.standalone_cpp
26+
libc.src.__support.CPP.limits
2727
)
2828

2929
add_header_library(
@@ -44,7 +44,7 @@ add_header_library(
4444
.high_precision_decimal
4545
libc.include.errno
4646
libc.src.errno.errno
47-
libc.src.__support.CPP.standalone_cpp
47+
libc.src.__support.CPP.limits
4848
libc.src.__support.FPUtil.fputil
4949
)
5050

libc/src/__support/CPP/CMakeLists.txt

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,56 @@
1-
# TODO(michaelrj): separate the standalone_cpp library into individual targets.
21
add_header_library(
3-
standalone_cpp
2+
array
43
HDRS
54
Array.h
5+
)
6+
7+
add_header_library(
8+
array_ref
9+
HDRS
610
ArrayRef.h
11+
)
12+
13+
14+
add_header_library(
15+
bit
16+
HDRS
717
Bit.h
18+
)
19+
20+
21+
add_header_library(
22+
bitset
23+
HDRS
824
Bitset.h
25+
)
26+
27+
add_header_library(
28+
functional
29+
HDRS
930
Functional.h
31+
)
32+
33+
add_header_library(
34+
limits
35+
HDRS
1036
Limits.h
37+
)
38+
39+
add_header_library(
40+
string_view
41+
HDRS
1142
StringView.h
43+
)
44+
45+
add_header_library(
46+
type_traits
47+
HDRS
1248
TypeTraits.h
49+
)
50+
51+
add_header_library(
52+
utility
53+
HDRS
1354
Utility.h
1455
)
1556

libc/src/__support/FPUtil/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#TODO(michaelrj): separate the fputil library into individual targets.
12
add_header_library(
23
fputil
34
HDRS
@@ -19,7 +20,8 @@ add_header_library(
1920
libc.include.errno
2021
libc.include.fenv
2122
libc.src.__support.common
22-
libc.src.__support.CPP.standalone_cpp
23+
libc.src.__support.CPP.type_traits
24+
libc.src.__support.CPP.bit
2325
libc.src.errno.errno
2426
)
2527

libc/src/string/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_header_library(
55
HDRS
66
string_utils.h
77
DEPENDS
8-
libc.src.__support.CPP.standalone_cpp
8+
libc.src.__support.CPP.bitset
99
)
1010

1111
add_entrypoint_object(
@@ -210,7 +210,7 @@ add_entrypoint_object(
210210
HDRS
211211
strspn.h
212212
DEPENDS
213-
libc.src.__support.CPP.standalone_cpp
213+
libc.src.__support.CPP.bitset
214214
)
215215

216216
add_entrypoint_object(

libc/src/string/memory_utils/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#TODO(michaelrj): split out the implementations from memory_utils
12
add_header_library(
23
memory_utils
34
HDRS
@@ -8,7 +9,7 @@ add_header_library(
89
memcpy_implementations.h
910
memset_implementations.h
1011
DEPS
11-
standalone_cpp
12+
libc.src.__support.CPP.bit
1213
)
1314

1415
add_header_library(

libc/test/src/__support/CPP/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_libc_unittest(
77
SRCS
88
bitset_test.cpp
99
DEPENDS
10-
libc.src.__support.CPP.standalone_cpp
10+
libc.src.__support.CPP.bitset
1111
)
1212

1313
add_libc_unittest(
@@ -17,7 +17,7 @@ add_libc_unittest(
1717
SRCS
1818
stringview_test.cpp
1919
DEPENDS
20-
libc.src.__support.CPP.standalone_cpp
20+
libc.src.__support.CPP.string_view
2121
)
2222

2323
add_libc_unittest(
@@ -27,7 +27,7 @@ add_libc_unittest(
2727
SRCS
2828
limits_test.cpp
2929
DEPENDS
30-
libc.src.__support.CPP.standalone_cpp
30+
libc.src.__support.CPP.limits
3131
)
3232

3333
add_libc_unittest(
@@ -37,7 +37,7 @@ add_libc_unittest(
3737
SRCS
3838
arrayref_test.cpp
3939
DEPENDS
40-
libc.src.__support.CPP.standalone_cpp
40+
libc.src.__support.CPP.array_ref
4141
)
4242

4343
add_libc_unittest(
@@ -57,7 +57,7 @@ add_libc_unittest(
5757
SRCS
5858
integer_sequence_test.cpp
5959
DEPENDS
60-
libc.src.__support.CPP.standalone_cpp
60+
libc.src.__support.CPP.utility
6161
)
6262

6363
add_libc_unittest(

libc/test/src/math/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_fp_unittest(
1212
DEPENDS
1313
libc.include.errno
1414
libc.src.math.cosf
15-
libc.src.__support.CPP.standalone_cpp
15+
libc.src.__support.CPP.array
1616
libc.src.__support.FPUtil.fputil
1717
)
1818

@@ -40,7 +40,7 @@ add_fp_unittest(
4040
DEPENDS
4141
libc.include.errno
4242
libc.src.math.sinf
43-
libc.src.__support.CPP.standalone_cpp
43+
libc.src.__support.CPP.array
4444
libc.src.__support.FPUtil.fputil
4545
)
4646

@@ -68,7 +68,7 @@ add_fp_unittest(
6868
DEPENDS
6969
libc.include.errno
7070
libc.src.math.sincosf
71-
libc.src.__support.CPP.standalone_cpp
71+
libc.src.__support.CPP.array
7272
libc.src.__support.FPUtil.fputil
7373
)
7474

libc/test/src/math/exhaustive/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ add_object_library(
66
exhaustive_test.h
77
SRCS
88
exhaustive_test.cpp
9-
DEPENDS
10-
libc.src.__support.CPP.standalone_cpp
119
)
1210

1311
add_fp_unittest(

libc/test/src/stdlib/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ if(LLVM_LIBC_FULL_BUILD)
226226
libc.src.stdlib._Exit
227227
libc.src.stdlib.exit
228228
libc.src.stdlib.atexit
229-
libc.src.__support.CPP.standalone_cpp
229+
libc.src.__support.CPP.array
230+
libc.src.__support.CPP.utility
230231
)
231232

232233
# add_libc_unittest(

0 commit comments

Comments
 (0)