Skip to content

[NFC][libc++] Moves ios_base's forward declaration. #88027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

mordante
Copy link
Member

@mordante mordante commented Apr 8, 2024

According to our synopsis it belonged to ios_fwd. This is not true in the C++11 version of the Standard, I did not validate against C++98.

Moving this to ios's forward where it's declared in the standard allows removing a module quirk. An earlier removal of std::vectors forward declaration allows to remove all quirks for the iosfwd module part.

Since iosfwd includes __fwd/ios.h this does not change the required includes.

According to our synopsis it belonged to ios_fwd. This is not true in
the C++11 version of the Standard, I did not validate against C++98.

Moving this to ios's forward where it's declared in the standard allows
removing a module quirk. An earlier removal of std::vectors forward
declaration allows to remove all quirks for the iosfwd module part.

Since iosfwd includes __fwd/ios.h this does not change the required
includes.
@mordante mordante requested a review from a team as a code owner April 8, 2024 18:15
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 8, 2024

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

According to our synopsis it belonged to ios_fwd. This is not true in the C++11 version of the Standard, I did not validate against C++98.

Moving this to ios's forward where it's declared in the standard allows removing a module quirk. An earlier removal of std::vectors forward declaration allows to remove all quirks for the iosfwd module part.

Since iosfwd includes __fwd/ios.h this does not change the required includes.


Full diff: https://github.com/llvm/llvm-project/pull/88027.diff

3 Files Affected:

  • (modified) libcxx/include/__fwd/ios.h (+2)
  • (modified) libcxx/include/iosfwd (-3)
  • (modified) libcxx/utils/libcxx/test/modules.py (-2)
diff --git a/libcxx/include/__fwd/ios.h b/libcxx/include/__fwd/ios.h
index 82c865d58cc751..48350709d4ce25 100644
--- a/libcxx/include/__fwd/ios.h
+++ b/libcxx/include/__fwd/ios.h
@@ -18,6 +18,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+class _LIBCPP_EXPORTED_FROM_ABI ios_base;
+
 template <class _CharT, class _Traits = char_traits<_CharT> >
 class _LIBCPP_TEMPLATE_VIS basic_ios;
 
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 9af5e05031850d..2481667dd972cf 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -25,7 +25,6 @@ template<>            struct char_traits<wchar_t>;
 
 template<class T>     class allocator;
 
-class ios_base;
 template <class charT, class traits = char_traits<charT> > class basic_ios;
 
 template <class charT, class traits = char_traits<charT> > class basic_streambuf;
@@ -124,8 +123,6 @@ using wosyncstream = basic_osyncstream<wchar_t>;  // C++20
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-class _LIBCPP_EXPORTED_FROM_ABI ios_base;
-
 template <class _CharT, class _Traits = char_traits<_CharT> >
 class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
 template <class _CharT, class _Traits = char_traits<_CharT> >
diff --git a/libcxx/utils/libcxx/test/modules.py b/libcxx/utils/libcxx/test/modules.py
index 3f3c7999a1a21d..44c6292ff1140f 100644
--- a/libcxx/utils/libcxx/test/modules.py
+++ b/libcxx/utils/libcxx/test/modules.py
@@ -26,8 +26,6 @@
 # The operators are added for private types like __iom_t10.
 SkipDeclarations["iomanip"] = ["std::operator<<", "std::operator>>"]
 
-SkipDeclarations["iosfwd"] = ["std::ios_base", "std::vector"]
-
 # This header also provides declarations in the namespace that might be
 # an error.
 SkipDeclarations["filesystem"] = [

@mordante mordante merged commit a75c9d0 into llvm:main Apr 16, 2024
@mordante mordante deleted the review/moves_ios_base_forward_declaration branch April 16, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants