[libcxx-commits] [libcxx] 9d16cbc - [libc++] Adds more forward declaration headers.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 27 08:07:19 PDT 2023
Author: Mark de Wever
Date: 2023-04-27T17:07:10+02:00
New Revision: 9d16cbc5c8bdf976287cc97c7d95d115496e3077
URL: https://github.com/llvm/llvm-project/commit/9d16cbc5c8bdf976287cc97c7d95d115496e3077
DIFF: https://github.com/llvm/llvm-project/commit/9d16cbc5c8bdf976287cc97c7d95d115496e3077.diff
LOG: [libc++] Adds more forward declaration headers.
The module validation script of D144994 validate whether the contents of
an include match its module. An include is the set of files matching the
pattern:
- foo
- foo/*.
- __fwd/foo.h
Several declarations of the stream headers are in the header iosfwd.
This gives issue using the validation script. Adding iosfwd to the set
of matching files gives too many declarations. For example when
validating the fstream header it will pull in declarations of the
istream header. Instead if writing a set of filters the headers are
granularized into smaller headers containing the expected declarations.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D148927
Added:
libcxx/include/__fwd/fstream.h
libcxx/include/__fwd/ios.h
libcxx/include/__fwd/istream.h
libcxx/include/__fwd/ostream.h
libcxx/include/__fwd/sstream.h
libcxx/include/__fwd/streambuf.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/fstream
libcxx/include/ios
libcxx/include/iosfwd
libcxx/include/istream
libcxx/include/module.modulemap.in
libcxx/include/ostream
libcxx/include/sstream
libcxx/include/streambuf
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/utils/data/ignore_format.txt
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index fa7ff67394ec1..d74f9dc1d69e7 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -385,11 +385,17 @@ set(files
__functional/unwrap_ref.h
__functional/weak_result_type.h
__fwd/array.h
+ __fwd/fstream.h
__fwd/get.h
__fwd/hash.h
+ __fwd/ios.h
+ __fwd/istream.h
__fwd/memory_resource.h
+ __fwd/ostream.h
__fwd/pair.h
__fwd/span.h
+ __fwd/sstream.h
+ __fwd/streambuf.h
__fwd/string.h
__fwd/string_view.h
__fwd/subrange.h
diff --git a/libcxx/include/__fwd/fstream.h b/libcxx/include/__fwd/fstream.h
new file mode 100644
index 0000000000000..62fd57374462d
--- /dev/null
+++ b/libcxx/include/__fwd/fstream.h
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_FSTREAM_H
+#define _LIBCPP___FWD_FSTREAM_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_filebuf;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_ifstream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_ofstream;
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_fstream;
+
+typedef basic_filebuf<char> filebuf;
+typedef basic_ifstream<char> ifstream;
+typedef basic_ofstream<char> ofstream;
+typedef basic_fstream<char> fstream;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_filebuf<wchar_t> wfilebuf;
+typedef basic_ifstream<wchar_t> wifstream;
+typedef basic_ofstream<wchar_t> wofstream;
+typedef basic_fstream<wchar_t> wfstream;
+#endif
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfilebuf)) basic_filebuf;
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wifstream)) basic_ifstream;
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wofstream)) basic_ofstream;
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfstream)) basic_fstream;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_FSTREAM_H
diff --git a/libcxx/include/__fwd/ios.h b/libcxx/include/__fwd/ios.h
new file mode 100644
index 0000000000000..214dcf340da0c
--- /dev/null
+++ b/libcxx/include/__fwd/ios.h
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_IOS_H
+#define _LIBCPP___FWD_IOS_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_ios;
+
+typedef basic_ios<char> ios;
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_ios<wchar_t> wios;
+#endif
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
+
+#if defined(_NEWLIB_VERSION)
+// On newlib, off_t is 'long int'
+typedef long int streamoff; // for char_traits in <string>
+#else
+typedef long long streamoff; // for char_traits in <string>
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_IOS_H
diff --git a/libcxx/include/__fwd/istream.h b/libcxx/include/__fwd/istream.h
new file mode 100644
index 0000000000000..c0a3cdeeb14de
--- /dev/null
+++ b/libcxx/include/__fwd/istream.h
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_ISTREAM_H
+#define _LIBCPP___FWD_ISTREAM_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_istream;
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_iostream;
+
+typedef basic_istream<char> istream;
+typedef basic_iostream<char> iostream;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_istream<wchar_t> wistream;
+typedef basic_iostream<wchar_t> wiostream;
+#endif
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistream)) basic_istream;
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wiostream)) basic_iostream;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_ISTREAM_H
diff --git a/libcxx/include/__fwd/ostream.h b/libcxx/include/__fwd/ostream.h
new file mode 100644
index 0000000000000..249d865a0e3e6
--- /dev/null
+++ b/libcxx/include/__fwd/ostream.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_OSTREAM_H
+#define _LIBCPP___FWD_OSTREAM_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_ostream;
+
+typedef basic_ostream<char> ostream;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_ostream<wchar_t> wostream;
+#endif
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostream)) basic_ostream;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_OSTREAM_H
diff --git a/libcxx/include/__fwd/sstream.h b/libcxx/include/__fwd/sstream.h
new file mode 100644
index 0000000000000..836c004215cae
--- /dev/null
+++ b/libcxx/include/__fwd/sstream.h
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_SSTREAM_H
+#define _LIBCPP___FWD_SSTREAM_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT>,
+ class _Allocator = allocator<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_stringbuf;
+
+template <class _CharT, class _Traits = char_traits<_CharT>,
+ class _Allocator = allocator<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_istringstream;
+template <class _CharT, class _Traits = char_traits<_CharT>,
+ class _Allocator = allocator<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_ostringstream;
+template <class _CharT, class _Traits = char_traits<_CharT>,
+ class _Allocator = allocator<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_stringstream;
+
+typedef basic_stringbuf<char> stringbuf;
+typedef basic_istringstream<char> istringstream;
+typedef basic_ostringstream<char> ostringstream;
+typedef basic_stringstream<char> stringstream;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_stringbuf<wchar_t> wstringbuf;
+typedef basic_istringstream<wchar_t> wistringstream;
+typedef basic_ostringstream<wchar_t> wostringstream;
+typedef basic_stringstream<wchar_t> wstringstream;
+#endif
+
+template <class _CharT, class _Traits, class _Allocator>
+ class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringbuf)) basic_stringbuf;
+template <class _CharT, class _Traits, class _Allocator>
+ class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistringstream)) basic_istringstream;
+template <class _CharT, class _Traits, class _Allocator>
+ class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostringstream)) basic_ostringstream;
+template <class _CharT, class _Traits, class _Allocator>
+ class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringstream)) basic_stringstream;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_SSTREAM_H
diff --git a/libcxx/include/__fwd/streambuf.h b/libcxx/include/__fwd/streambuf.h
new file mode 100644
index 0000000000000..f3390b32cace7
--- /dev/null
+++ b/libcxx/include/__fwd/streambuf.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FWD_STREAMBUF_H
+#define _LIBCPP___FWD_STREAMBUF_H
+
+#include <__config>
+#include <__fwd/string.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits = char_traits<_CharT> >
+ class _LIBCPP_TEMPLATE_VIS basic_streambuf;
+
+typedef basic_streambuf<char> streambuf;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_streambuf<wchar_t> wstreambuf;
+#endif
+
+template <class _CharT, class _Traits>
+ class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstreambuf)) basic_streambuf;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_STREAMBUF_H
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index a312d18c49383..1aa5414152a85 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -183,6 +183,7 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__config>
+#include <__fwd/fstream.h>
#include <__locale>
#include <__utility/move.h>
#include <__utility/swap.h>
diff --git a/libcxx/include/ios b/libcxx/include/ios
index c97daac1ee548..f811343f0324d 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -217,6 +217,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#endif
#include <__assert> // all public C++ headers provide the assertion handler
+#include <__fwd/ios.h>
#include <__ios/fpos.h>
#include <__locale>
#include <__system_error/error_category.h>
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 7948606e6453e..0af7df30d8fd7 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -96,6 +96,12 @@ using u32streampos = fpos<char_traits<char32_t>::state_type>;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__fwd/fstream.h>
+#include <__fwd/ios.h>
+#include <__fwd/istream.h>
+#include <__fwd/ostream.h>
+#include <__fwd/sstream.h>
+#include <__fwd/streambuf.h>
#include <__fwd/string.h>
#include <__mbstate_t.h>
#include <version>
@@ -108,112 +114,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS ios_base;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_ios;
-
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_streambuf;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_istream;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_ostream;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_iostream;
-
-template <class _CharT, class _Traits = char_traits<_CharT>,
- class _Allocator = allocator<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_stringbuf;
-template <class _CharT, class _Traits = char_traits<_CharT>,
- class _Allocator = allocator<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_istringstream;
-template <class _CharT, class _Traits = char_traits<_CharT>,
- class _Allocator = allocator<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_ostringstream;
-template <class _CharT, class _Traits = char_traits<_CharT>,
- class _Allocator = allocator<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_stringstream;
-
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_filebuf;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_ifstream;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_ofstream;
-template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_fstream;
-
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
-typedef basic_ios<char> ios;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef basic_ios<wchar_t> wios;
-#endif
-
-typedef basic_streambuf<char> streambuf;
-typedef basic_istream<char> istream;
-typedef basic_ostream<char> ostream;
-typedef basic_iostream<char> iostream;
-
-typedef basic_stringbuf<char> stringbuf;
-typedef basic_istringstream<char> istringstream;
-typedef basic_ostringstream<char> ostringstream;
-typedef basic_stringstream<char> stringstream;
-
-typedef basic_filebuf<char> filebuf;
-typedef basic_ifstream<char> ifstream;
-typedef basic_ofstream<char> ofstream;
-typedef basic_fstream<char> fstream;
-
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef basic_streambuf<wchar_t> wstreambuf;
-typedef basic_istream<wchar_t> wistream;
-typedef basic_ostream<wchar_t> wostream;
-typedef basic_iostream<wchar_t> wiostream;
-
-typedef basic_stringbuf<wchar_t> wstringbuf;
-typedef basic_istringstream<wchar_t> wistringstream;
-typedef basic_ostringstream<wchar_t> wostringstream;
-typedef basic_stringstream<wchar_t> wstringstream;
-
-typedef basic_filebuf<wchar_t> wfilebuf;
-typedef basic_ifstream<wchar_t> wifstream;
-typedef basic_ofstream<wchar_t> wofstream;
-typedef basic_fstream<wchar_t> wfstream;
-#endif
-
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
-
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstreambuf)) basic_streambuf;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistream)) basic_istream;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostream)) basic_ostream;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wiostream)) basic_iostream;
-
-template <class _CharT, class _Traits, class _Allocator>
- class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringbuf)) basic_stringbuf;
-template <class _CharT, class _Traits, class _Allocator>
- class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistringstream)) basic_istringstream;
-template <class _CharT, class _Traits, class _Allocator>
- class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostringstream)) basic_ostringstream;
-template <class _CharT, class _Traits, class _Allocator>
- class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringstream)) basic_stringstream;
-
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfilebuf)) basic_filebuf;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wifstream)) basic_ifstream;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wofstream)) basic_ofstream;
-template <class _CharT, class _Traits>
- class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfstream)) basic_fstream;
-
template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
@@ -223,13 +128,6 @@ typedef fpos<mbstate_t> u8streampos;
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
-#if defined(_NEWLIB_VERSION)
-// On newlib, off_t is 'long int'
-typedef long int streamoff; // for char_traits in <string>
-#else
-typedef long long streamoff; // for char_traits in <string>
-#endif
-
// Include other forward declarations here
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TEMPLATE_VIS vector;
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 7350e11fe129d..8b440c036ddb2 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -160,6 +160,7 @@ template <class Stream, class T>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__fwd/istream.h>
#include <__iterator/istreambuf_iterator.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/enable_if.h>
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 8f8333692558e..2c5f8d3bd309b 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1012,6 +1012,14 @@ module std [system] {
module iosfwd {
header "iosfwd"
export *
+ module __iosfwd {
+ module fstream_fwd { private header "__fwd/fstream.h" }
+ module ios_fwd { private header "__fwd/ios.h" }
+ module istream_fwd { private header "__fwd/istream.h" }
+ module ostream_fwd { private header "__fwd/ostream.h" }
+ module sstream_fwd { private header "__fwd/sstream.h" }
+ module streambuf_fwd { private header "__fwd/streambuf.h" }
+ }
}
module iostream {
@requires_LIBCXX_ENABLE_LOCALIZATION@
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 610a283942044..168a75376bd94 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -166,6 +166,7 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__exception/operations.h>
+#include <__fwd/ostream.h>
#include <__memory/shared_ptr.h>
#include <__memory/unique_ptr.h>
#include <__system_error/error_code.h>
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index 389bbf6aae1e3..6af2cb8fa87ff 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -187,6 +187,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__fwd/sstream.h>
#include <__utility/swap.h>
#include <istream>
#include <ostream>
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index d473df103475c..f491a14659096 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -109,6 +109,7 @@ protected:
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__fwd/streambuf.h>
#include <cstdint>
#include <ios>
#include <iosfwd>
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp
index e511411985876..806a6c51eabd4 100644
--- a/libcxx/test/libcxx/private_headers.verify.cpp
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -427,11 +427,17 @@ END-SCRIPT
#include <__functional/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}}
#include <__functional/weak_result_type.h> // expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}}
#include <__fwd/array.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/array.h'}}
+#include <__fwd/fstream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/fstream.h'}}
#include <__fwd/get.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/get.h'}}
#include <__fwd/hash.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/hash.h'}}
+#include <__fwd/ios.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/ios.h'}}
+#include <__fwd/istream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/istream.h'}}
#include <__fwd/memory_resource.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/memory_resource.h'}}
+#include <__fwd/ostream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/ostream.h'}}
#include <__fwd/pair.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/pair.h'}}
#include <__fwd/span.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/span.h'}}
+#include <__fwd/sstream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/sstream.h'}}
+#include <__fwd/streambuf.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/streambuf.h'}}
#include <__fwd/string.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string.h'}}
#include <__fwd/string_view.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string_view.h'}}
#include <__fwd/subrange.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/subrange.h'}}
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index 044a395b352ce..0e710d596e5b1 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -398,8 +398,14 @@ libcxx/include/__functional/unary_negate.h
libcxx/include/__functional/unwrap_ref.h
libcxx/include/__functional/weak_result_type.h
libcxx/include/future
+libcxx/include/__fwd/fstream.h
libcxx/include/__fwd/get.h
+libcxx/include/__fwd/ios.h
+libcxx/include/__fwd/istream.h
+libcxx/include/__fwd/ostream.h
libcxx/include/__fwd/span.h
+libcxx/include/__fwd/sstream.h
+libcxx/include/__fwd/streambuf.h
libcxx/include/__fwd/string_view.h
libcxx/include/__fwd/subrange.h
libcxx/include/__hash_table
More information about the libcxx-commits
mailing list