brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 0b2372e Raw
106 lines · plain
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP_EXCEPTION11#define _LIBCPP_EXCEPTION12 13/*14    exception synopsis15 16namespace std17{18 19class exception20{21public: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 29class bad_exception30    : public exception31{32public: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 40typedef void (*unexpected_handler)();41unexpected_handler set_unexpected(unexpected_handler  f ) noexcept;42unexpected_handler get_unexpected() noexcept;43[[noreturn]] void unexpected();44 45typedef void (*terminate_handler)();46terminate_handler set_terminate(terminate_handler  f ) noexcept;47terminate_handler get_terminate() noexcept;48[[noreturn]] void terminate() noexcept;49 50bool uncaught_exception()  noexcept;  // deprecated in C++17, removed in C++2051int  uncaught_exceptions() noexcept;  // C++1752 53typedef unspecified exception_ptr;54 55exception_ptr current_exception() noexcept;56void rethrow_exception [[noreturn]] (exception_ptr p);57template<class E> exception_ptr make_exception_ptr(E e) noexcept;58 59class nested_exception60{61public: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 functions68    [[noreturn]] void rethrow_nested() const;69    exception_ptr nested_ptr() const noexcept;70};71 72template <class T> [[noreturn]] void throw_with_nested(T&& t);73template <class E> void rethrow_if_nested(const E& e);74 75}  // std76 77*/78 79#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)80#  include <__cxx03/exception>81#else82#  include <__config>83#  include <__exception/exception.h>84#  include <__exception/exception_ptr.h>85#  include <__exception/nested_exception.h>86#  include <__exception/operations.h>87#  include <__exception/terminate.h>88#  include <version>89 90#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)91#    pragma GCC system_header92#  endif93 94#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 2095#    include <cstddef>96#    include <new>97#    include <type_traits>98#  endif99 100#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23101#    include <cstdlib>102#  endif103#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)104 105#endif // _LIBCPP_EXCEPTION106