[CodeGenPrepare] Drop nsw flags in `optimizeLoadExt` (#118180)
[llvm-project.git] / libcxx / include / __system_error / system_error.h
blob918effb6917cb4ac89c6fa549ad127dd50c9b18d
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 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
11 #define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
13 #include <__config>
14 #include <__system_error/error_category.h>
15 #include <__system_error/error_code.h>
16 #include <__verbose_abort>
17 #include <stdexcept>
18 #include <string>
20 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21 # pragma GCC system_header
22 #endif
24 _LIBCPP_BEGIN_NAMESPACE_STD
26 class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
27 error_code __ec_;
29 public:
30 system_error(error_code __ec, const string& __what_arg);
31 system_error(error_code __ec, const char* __what_arg);
32 system_error(error_code __ec);
33 system_error(int __ev, const error_category& __ecat, const string& __what_arg);
34 system_error(int __ev, const error_category& __ecat, const char* __what_arg);
35 system_error(int __ev, const error_category& __ecat);
36 _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
37 ~system_error() _NOEXCEPT override;
39 _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
42 [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
43 #if _LIBCPP_HAS_EXCEPTIONS
44 throw system_error(__ec, __what_arg);
45 #else
46 _LIBCPP_VERBOSE_ABORT(
47 "system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", __ec.value(), __what_arg);
48 #endif
51 _LIBCPP_END_NAMESPACE_STD
53 #endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H