| 1 |
// -*- C++ -*- |
| 2 |
//===----------------------------------------------------------------------===// |
| 3 |
// |
| 4 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
|
| 10 |
#ifndef _LIBCPP___CXX03_EXCEPTION |
| 11 |
#define _LIBCPP___CXX03_EXCEPTION |
| 12 |
|
| 13 |
/* |
| 14 |
exception synopsis |
| 15 |
|
| 16 |
namespace std |
| 17 |
{ |
| 18 |
|
| 19 |
class exception |
| 20 |
{ |
| 21 |
public: |
| 22 |
exception() noexcept; |
| 23 |
exception(const exception&) noexcept; |
| 24 |
exception& operator=(const exception&) noexcept; |
| 25 |
virtual ~exception() noexcept; |
| 26 |
virtual const char* what() const noexcept; |
| 27 |
}; |
| 28 |
|
| 29 |
class bad_exception |
| 30 |
: public exception |
| 31 |
{ |
| 32 |
public: |
| 33 |
bad_exception() noexcept; |
| 34 |
bad_exception(const bad_exception&) noexcept; |
| 35 |
bad_exception& operator=(const bad_exception&) noexcept; |
| 36 |
virtual ~bad_exception() noexcept; |
| 37 |
virtual const char* what() const noexcept; |
| 38 |
}; |
| 39 |
|
| 40 |
typedef void (*unexpected_handler)(); |
| 41 |
unexpected_handler set_unexpected(unexpected_handler f ) noexcept; |
| 42 |
unexpected_handler get_unexpected() noexcept; |
| 43 |
[[noreturn]] void unexpected(); |
| 44 |
|
| 45 |
typedef void (*terminate_handler)(); |
| 46 |
terminate_handler set_terminate(terminate_handler f ) noexcept; |
| 47 |
terminate_handler get_terminate() noexcept; |
| 48 |
[[noreturn]] void terminate() noexcept; |
| 49 |
|
| 50 |
bool uncaught_exception() noexcept; |
| 51 |
int uncaught_exceptions() noexcept; // C++17 |
| 52 |
|
| 53 |
typedef unspecified exception_ptr; |
| 54 |
|
| 55 |
exception_ptr current_exception() noexcept; |
| 56 |
void rethrow_exception [[noreturn]] (exception_ptr p); |
| 57 |
template<class E> exception_ptr make_exception_ptr(E e) noexcept; |
| 58 |
|
| 59 |
class nested_exception |
| 60 |
{ |
| 61 |
public: |
| 62 |
nested_exception() noexcept; |
| 63 |
nested_exception(const nested_exception&) noexcept = default; |
| 64 |
nested_exception& operator=(const nested_exception&) noexcept = default; |
| 65 |
virtual ~nested_exception() = default; |
| 66 |
|
| 67 |
// access functions |
| 68 |
[[noreturn]] void rethrow_nested() const; |
| 69 |
exception_ptr nested_ptr() const noexcept; |
| 70 |
}; |
| 71 |
|
| 72 |
template <class T> [[noreturn]] void throw_with_nested(T&& t); |
| 73 |
template <class E> void rethrow_if_nested(const E& e); |
| 74 |
|
| 75 |
} // std |
| 76 |
|
| 77 |
*/ |
| 78 |
|
| 79 |
#include <__cxx03/__config> |
| 80 |
#include <__cxx03/__exception/exception.h> |
| 81 |
#include <__cxx03/__exception/exception_ptr.h> |
| 82 |
#include <__cxx03/__exception/nested_exception.h> |
| 83 |
#include <__cxx03/__exception/operations.h> |
| 84 |
#include <__cxx03/__exception/terminate.h> |
| 85 |
#include <__cxx03/version> |
| 86 |
|
| 87 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 88 |
# pragma GCC system_header |
| 89 |
#endif |
| 90 |
|
| 91 |
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) |
| 92 |
# include <__cxx03/cstdlib> |
| 93 |
# include <__cxx03/type_traits> |
| 94 |
#endif |
| 95 |
|
| 96 |
#endif // _LIBCPP___CXX03_EXCEPTION |