Skip to content

Commit 5bcb781

Browse files
authored
[libc++] Remove <locale> includes from <format> (#85478)
This reduces the include time from 767ms to 691ms.
1 parent 12978b3 commit 5bcb781

File tree

11 files changed

+65
-8
lines changed

11 files changed

+65
-8
lines changed

libcxx/include/__format/format_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <cstddef>
2828

2929
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
30-
# include <locale>
30+
# include <__locale>
3131
# include <optional>
3232
#endif
3333

libcxx/include/__format/format_functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <string_view>
4242

4343
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
44-
# include <locale>
44+
# include <__locale>
4545
#endif
4646

4747
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

libcxx/include/__format/formatter_floating_point.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <cstddef>
4040

4141
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
42-
# include <locale>
42+
# include <__locale>
4343
#endif
4444

4545
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

libcxx/include/format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,8 @@ namespace std {
221221
# pragma GCC system_header
222222
#endif
223223

224+
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
225+
# include <locale>
226+
#endif
227+
224228
#endif // _LIBCPP_FORMAT

libcxx/test/libcxx/transitive_includes/cxx03.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,14 @@ filesystem system_error
266266
filesystem type_traits
267267
filesystem version
268268
format array
269+
format cctype
270+
format clocale
269271
format cmath
270272
format cstddef
271273
format cstdint
274+
format cstdlib
275+
format cstring
276+
format cwchar
272277
format initializer_list
273278
format limits
274279
format locale

libcxx/test/libcxx/transitive_includes/cxx11.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,14 @@ filesystem system_error
267267
filesystem type_traits
268268
filesystem version
269269
format array
270+
format cctype
271+
format clocale
270272
format cmath
271273
format cstddef
272274
format cstdint
275+
format cstdlib
276+
format cstring
277+
format cwchar
273278
format initializer_list
274279
format limits
275280
format locale

libcxx/test/libcxx/transitive_includes/cxx14.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,14 @@ filesystem system_error
269269
filesystem type_traits
270270
filesystem version
271271
format array
272+
format cctype
273+
format clocale
272274
format cmath
273275
format cstddef
274276
format cstdint
277+
format cstdlib
278+
format cstring
279+
format cwchar
275280
format initializer_list
276281
format limits
277282
format locale

libcxx/test/libcxx/transitive_includes/cxx17.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,14 @@ filesystem system_error
269269
filesystem type_traits
270270
filesystem version
271271
format array
272+
format cctype
273+
format clocale
272274
format cmath
273275
format cstddef
274276
format cstdint
277+
format cstdlib
278+
format cstring
279+
format cwchar
275280
format initializer_list
276281
format limits
277282
format locale

libcxx/test/libcxx/transitive_includes/cxx20.csv

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,21 @@ charconv type_traits
113113
charconv version
114114
chrono array
115115
chrono bit
116+
chrono cctype
117+
chrono cerrno
116118
chrono charconv
119+
chrono clocale
117120
chrono cmath
118121
chrono compare
119122
chrono concepts
120123
chrono cstddef
121124
chrono cstdint
125+
chrono cstdlib
122126
chrono cstring
123127
chrono ctime
128+
chrono cwchar
124129
chrono forward_list
125130
chrono limits
126-
chrono locale
127131
chrono optional
128132
chrono ostream
129133
chrono ratio
@@ -275,9 +279,14 @@ filesystem system_error
275279
filesystem type_traits
276280
filesystem version
277281
format array
282+
format cctype
283+
format clocale
278284
format cmath
279285
format cstddef
280286
format cstdint
287+
format cstdlib
288+
format cstring
289+
format cwchar
281290
format initializer_list
282291
format limits
283292
format locale

libcxx/test/libcxx/transitive_includes/cxx23.csv

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,20 @@ charconv limits
6868
charconv new
6969
charconv version
7070
chrono array
71+
chrono cctype
72+
chrono cerrno
73+
chrono clocale
7174
chrono cmath
7275
chrono compare
7376
chrono cstddef
7477
chrono cstdint
78+
chrono cstdlib
79+
chrono cstring
7580
chrono ctime
81+
chrono cwchar
7682
chrono forward_list
7783
chrono initializer_list
7884
chrono limits
79-
chrono locale
8085
chrono new
8186
chrono optional
8287
chrono ostream
@@ -85,6 +90,8 @@ chrono sstream
8590
chrono stdexcept
8691
chrono string
8792
chrono string_view
93+
chrono tuple
94+
chrono typeinfo
8895
chrono vector
8996
chrono version
9097
cinttypes cstdint
@@ -184,12 +191,16 @@ filesystem string
184191
filesystem string_view
185192
filesystem version
186193
format array
194+
format cctype
195+
format clocale
187196
format cmath
188197
format cstddef
189198
format cstdint
199+
format cstdlib
200+
format cstring
201+
format cwchar
190202
format initializer_list
191203
format limits
192-
format locale
193204
format new
194205
format optional
195206
format queue
@@ -198,6 +209,7 @@ format stdexcept
198209
format string
199210
format string_view
200211
format tuple
212+
format typeinfo
201213
format version
202214
forward_list compare
203215
forward_list cstddef

libcxx/test/libcxx/transitive_includes/cxx26.csv

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,20 @@ charconv limits
6868
charconv new
6969
charconv version
7070
chrono array
71+
chrono cctype
72+
chrono cerrno
73+
chrono clocale
7174
chrono cmath
7275
chrono compare
7376
chrono cstddef
7477
chrono cstdint
78+
chrono cstdlib
79+
chrono cstring
7580
chrono ctime
81+
chrono cwchar
7682
chrono forward_list
7783
chrono initializer_list
7884
chrono limits
79-
chrono locale
8085
chrono new
8186
chrono optional
8287
chrono ostream
@@ -85,6 +90,8 @@ chrono sstream
8590
chrono stdexcept
8691
chrono string
8792
chrono string_view
93+
chrono tuple
94+
chrono typeinfo
8895
chrono vector
8996
chrono version
9097
cinttypes cstdint
@@ -184,12 +191,16 @@ filesystem string
184191
filesystem string_view
185192
filesystem version
186193
format array
194+
format cctype
195+
format clocale
187196
format cmath
188197
format cstddef
189198
format cstdint
199+
format cstdlib
200+
format cstring
201+
format cwchar
190202
format initializer_list
191203
format limits
192-
format locale
193204
format new
194205
format optional
195206
format queue
@@ -198,6 +209,7 @@ format stdexcept
198209
format string
199210
format string_view
200211
format tuple
212+
format typeinfo
201213
format version
202214
forward_list compare
203215
forward_list cstddef

0 commit comments

Comments
 (0)