iostream.cpp (0b57cec536236d46e3dba9bd041533462f33dbb7) iostream.cpp (e40139ff33b48b56a24c808b166b04b8ee6f5b21)
1//===------------------------ iostream.cpp --------------------------------===//
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

--- 83 unchanged lines hidden (view full) ---

92 }
93 freelocale(loc);
94 return true;
95 }();
96 ((void)once);
97#endif
98}
99
1//===------------------------ iostream.cpp --------------------------------===//
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

--- 83 unchanged lines hidden (view full) ---

92 }
93 freelocale(loc);
94 return true;
95 }();
96 ((void)once);
97#endif
98}
99
100ios_base::Init::Init()
100class DoIOSInit {
101public:
102 DoIOSInit();
103 ~DoIOSInit();
104};
105
106DoIOSInit::DoIOSInit()
101{
102 force_locale_initialization();
103
104#ifndef _LIBCPP_HAS_NO_STDIN
105 istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin));
106 wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
107#endif
108#ifndef _LIBCPP_HAS_NO_STDOUT

--- 12 unchanged lines hidden (view full) ---

121 _VSTD::unitbuf(*cerr_ptr);
122 _VSTD::unitbuf(*wcerr_ptr);
123#ifndef _LIBCPP_HAS_NO_STDOUT
124 cerr_ptr->tie(cout_ptr);
125 wcerr_ptr->tie(wcout_ptr);
126#endif
127}
128
107{
108 force_locale_initialization();
109
110#ifndef _LIBCPP_HAS_NO_STDIN
111 istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin));
112 wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
113#endif
114#ifndef _LIBCPP_HAS_NO_STDOUT

--- 12 unchanged lines hidden (view full) ---

127 _VSTD::unitbuf(*cerr_ptr);
128 _VSTD::unitbuf(*wcerr_ptr);
129#ifndef _LIBCPP_HAS_NO_STDOUT
130 cerr_ptr->tie(cout_ptr);
131 wcerr_ptr->tie(wcout_ptr);
132#endif
133}
134
129ios_base::Init::~Init()
135DoIOSInit::~DoIOSInit()
130{
131#ifndef _LIBCPP_HAS_NO_STDOUT
132 ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
133 wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
134 cout_ptr->flush();
135 wcout_ptr->flush();
136#endif
137
138 ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
139 wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
140 clog_ptr->flush();
141 wclog_ptr->flush();
142}
143
136{
137#ifndef _LIBCPP_HAS_NO_STDOUT
138 ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
139 wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
140 cout_ptr->flush();
141 wcout_ptr->flush();
142#endif
143
144 ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
145 wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
146 clog_ptr->flush();
147 wclog_ptr->flush();
148}
149
150ios_base::Init::Init()
151{
152 static DoIOSInit init_the_streams; // gets initialized once
153}
154
155ios_base::Init::~Init()
156{
157}
158
144_LIBCPP_END_NAMESPACE_STD
159_LIBCPP_END_NAMESPACE_STD