1//===--------------------- stdexcept_default.ipp --------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "../../include/refstring.h"
10
11/* For _LIBCPPABI_VERSION */
12#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
13 (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
14#include <cxxabi.h>
15#endif
16
17static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
18
19namespace std // purposefully not using versioning namespace
20{
21
22logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {}
23
24logic_error::logic_error(const char* msg) : __imp_(msg) {}
25
26logic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_) {}
27
28logic_error& logic_error::operator=(const logic_error& le) _NOEXCEPT {
29 __imp_ = le.__imp_;
30 return *this;
31}
32
33runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
34
35runtime_error::runtime_error(const char* msg) : __imp_(msg) {}
36
37runtime_error::runtime_error(const runtime_error& re) _NOEXCEPT
38 : __imp_(re.__imp_) {}
39
40runtime_error& runtime_error::operator=(const runtime_error& re) _NOEXCEPT {
41 __imp_ = re.__imp_;
42 return *this;
43}
44
45#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
46
47const char* logic_error::what() const _NOEXCEPT { return __imp_.c_str(); }
48
49const char* runtime_error::what() const _NOEXCEPT { return __imp_.c_str(); }
50
51logic_error::~logic_error() _NOEXCEPT {}
52domain_error::~domain_error() _NOEXCEPT {}
53invalid_argument::~invalid_argument() _NOEXCEPT {}
54length_error::~length_error() _NOEXCEPT {}
55out_of_range::~out_of_range() _NOEXCEPT {}
56
57runtime_error::~runtime_error() _NOEXCEPT {}
58range_error::~range_error() _NOEXCEPT {}
59overflow_error::~overflow_error() _NOEXCEPT {}
60underflow_error::~underflow_error() _NOEXCEPT {}
61
62#endif
63
64} // namespace std
65