[libcxx-commits] [libcxx] c6eaa14 - [libc++] Split off iostreams explicit instantiations into its own source file
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 2 07:36:43 PST 2020
Author: Louis Dionne
Date: 2020-11-02T10:36:34-05:00
New Revision: c6eaa14e110b0298bc5714b228781ef69e05249b
URL: https://github.com/llvm/llvm-project/commit/c6eaa14e110b0298bc5714b228781ef69e05249b
DIFF: https://github.com/llvm/llvm-project/commit/c6eaa14e110b0298bc5714b228781ef69e05249b.diff
LOG: [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.
Added:
libcxx/src/ios.instantiations.cpp
Modified:
libcxx/src/CMakeLists.txt
libcxx/src/ios.cpp
Removed:
################################################################################
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index d0e7255f5f60..181aa95bf870 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -64,6 +64,7 @@ endif()
if (LIBCXX_ENABLE_LOCALIZATION)
list(APPEND LIBCXX_SOURCES
ios.cpp
+ ios.instantiations.cpp
iostream.cpp
locale.cpp
regex.cpp
diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp
index 2dc84be82873..3a9296465777 100644
--- a/libcxx/src/ios.cpp
+++ b/libcxx/src/ios.cpp
@@ -15,30 +15,14 @@
#include "__locale"
#include "algorithm"
#include "include/config_elast.h"
-#include "istream"
#include "limits"
#include "memory"
#include "new"
-#include "streambuf"
#include "string"
#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
-
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
-
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
-
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
-
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
-
class _LIBCPP_HIDDEN __iostream_category
: public __do_message
{
diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp
new file mode 100644
index 000000000000..92704c6caf72
--- /dev/null
+++ b/libcxx/src/ios.instantiations.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "__config"
+#include "ios"
+#include "istream"
+#include "ostream"
+#include "streambuf"
+
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// Original explicit instantiations provided in the library
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
+
+// Add more here if needed...
+
+_LIBCPP_END_NAMESPACE_STD
More information about the libcxx-commits
mailing list