Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:04

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
0011 #define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
0012 
0013 #include <__config>
0014 #include <__system_error/error_category.h>
0015 #include <__system_error/error_code.h>
0016 #include <__verbose_abort>
0017 #include <stdexcept>
0018 #include <string>
0019 
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 #  pragma GCC system_header
0022 #endif
0023 
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025 
0026 class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
0027   error_code __ec_;
0028 
0029 public:
0030   system_error(error_code __ec, const string& __what_arg);
0031   system_error(error_code __ec, const char* __what_arg);
0032   system_error(error_code __ec);
0033   system_error(int __ev, const error_category& __ecat, const string& __what_arg);
0034   system_error(int __ev, const error_category& __ecat, const char* __what_arg);
0035   system_error(int __ev, const error_category& __ecat);
0036   _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
0037   ~system_error() _NOEXCEPT override;
0038 
0039   _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
0040 };
0041 
0042 // __ev is expected to be an error in the generic_category domain (e.g. from
0043 // errno, or std::errc::*), not system_category (e.g. from windows syscalls).
0044 [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
0045 
0046 [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
0047 #if _LIBCPP_HAS_EXCEPTIONS
0048   throw system_error(__ec, __what_arg);
0049 #else
0050   _LIBCPP_VERBOSE_ABORT(
0051       "system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", __ec.value(), __what_arg);
0052 #endif
0053 }
0054 
0055 _LIBCPP_END_NAMESPACE_STD
0056 
0057 #endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H