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___SYSTEM_ERROR_SYSTEM_ERROR_H
11 #define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
12 
13 #include <__config>
14 #include <__system_error/error_category.h>
15 #include <__system_error/error_code.h>
16 #include <stdexcept>
17 #include <string>
18 
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 #  pragma GCC system_header
21 #endif
22 
23 _LIBCPP_BEGIN_NAMESPACE_STD
24 
25 class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
26   error_code __ec_;
27 
28 public:
29   system_error(error_code __ec, const string& __what_arg);
30   system_error(error_code __ec, const char* __what_arg);
31   system_error(error_code __ec);
32   system_error(int __ev, const error_category& __ecat, const string& __what_arg);
33   system_error(int __ev, const error_category& __ecat, const char* __what_arg);
34   system_error(int __ev, const error_category& __ecat);
35   _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
36   ~system_error() _NOEXCEPT override;
37 
38   _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
39 
40 private:
41   static string __init(const error_code&, string);
42 };
43 
44 _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
45 
46 _LIBCPP_END_NAMESPACE_STD
47 
48 #endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
49