Skip to content

Commit c6eaa14

Browse files
committed
[libc++] Split off iostreams explicit instantiations into its own source file
This makes it cleaner to add more instantiations without cluttering the actual implementation of ios.
1 parent 1695c84 commit c6eaa14

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

libcxx/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ endif()
6464
if (LIBCXX_ENABLE_LOCALIZATION)
6565
list(APPEND LIBCXX_SOURCES
6666
ios.cpp
67+
ios.instantiations.cpp
6768
iostream.cpp
6869
locale.cpp
6970
regex.cpp

libcxx/src/ios.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,14 @@
1515
#include "__locale"
1616
#include "algorithm"
1717
#include "include/config_elast.h"
18-
#include "istream"
1918
#include "limits"
2019
#include "memory"
2120
#include "new"
22-
#include "streambuf"
2321
#include "string"
2422
#include "__undef_macros"
2523

2624
_LIBCPP_BEGIN_NAMESPACE_STD
2725

28-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
29-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
30-
31-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
32-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
33-
34-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
35-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
36-
37-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
38-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
39-
40-
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
41-
4226
class _LIBCPP_HIDDEN __iostream_category
4327
: public __do_message
4428
{

libcxx/src/ios.instantiations.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//===----------------------------------------------------------------------===//
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+
#include "__config"
10+
#include "ios"
11+
#include "istream"
12+
#include "ostream"
13+
#include "streambuf"
14+
15+
16+
_LIBCPP_BEGIN_NAMESPACE_STD
17+
18+
// Original explicit instantiations provided in the library
19+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
20+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
21+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
22+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
23+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
24+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
25+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
26+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
27+
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
28+
29+
// Add more here if needed...
30+
31+
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)