summaryrefslogtreecommitdiff
path: root/src/ios.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ios.cpp')
-rw-r--r--src/ios.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/ios.cpp b/src/ios.cpp
index 0f1d88e378f5..2dc84be82873 100644
--- a/src/ios.cpp
+++ b/src/ios.cpp
@@ -1,9 +1,8 @@
//===-------------------------- ios.cpp -----------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -267,10 +266,9 @@ ios_base::clear(iostate state)
__rdstate_ = state;
else
__rdstate_ = state | badbit;
-#ifndef _LIBCPP_NO_EXCEPTIONS
+
if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
- throw failure("ios_base::clear");
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_failure("ios_base::clear");
}
// init
@@ -310,35 +308,27 @@ ios_base::copyfmt(const ios_base& rhs)
{
size_t newesize = sizeof(event_callback) * rhs.__event_size_;
new_callbacks.reset(static_cast<event_callback*>(malloc(newesize)));
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_callbacks)
- throw bad_alloc();
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_bad_alloc();
size_t newisize = sizeof(int) * rhs.__event_size_;
new_ints.reset(static_cast<int *>(malloc(newisize)));
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_ints)
- throw bad_alloc();
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_bad_alloc();
}
if (__iarray_cap_ < rhs.__iarray_size_)
{
size_t newsize = sizeof(long) * rhs.__iarray_size_;
new_longs.reset(static_cast<long*>(malloc(newsize)));
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_longs)
- throw bad_alloc();
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_bad_alloc();
}
if (__parray_cap_ < rhs.__parray_size_)
{
size_t newsize = sizeof(void*) * rhs.__parray_size_;
new_pointers.reset(static_cast<void**>(malloc(newsize)));
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_pointers)
- throw bad_alloc();
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_bad_alloc();
}
// Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
__fmtflags_ = rhs.__fmtflags_;