| 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 | |
| 17 | static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "" ); |
| 18 | |
| 19 | namespace std // purposefully not using versioning namespace |
| 20 | { |
| 21 | |
| 22 | logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {} |
| 23 | |
| 24 | logic_error::logic_error(const char* msg) : __imp_(msg) {} |
| 25 | |
| 26 | logic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_) {} |
| 27 | |
| 28 | logic_error& logic_error::operator=(const logic_error& le) _NOEXCEPT { |
| 29 | __imp_ = le.__imp_; |
| 30 | return *this; |
| 31 | } |
| 32 | |
| 33 | runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {} |
| 34 | |
| 35 | runtime_error::runtime_error(const char* msg) : __imp_(msg) {} |
| 36 | |
| 37 | runtime_error::runtime_error(const runtime_error& re) _NOEXCEPT |
| 38 | : __imp_(re.__imp_) {} |
| 39 | |
| 40 | runtime_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 | |
| 47 | const char* logic_error::what() const _NOEXCEPT { return __imp_.c_str(); } |
| 48 | |
| 49 | const char* runtime_error::what() const _NOEXCEPT { return __imp_.c_str(); } |
| 50 | |
| 51 | logic_error::~logic_error() _NOEXCEPT {} |
| 52 | domain_error::~domain_error() _NOEXCEPT {} |
| 53 | invalid_argument::~invalid_argument() _NOEXCEPT {} |
| 54 | length_error::~length_error() _NOEXCEPT {} |
| 55 | out_of_range::~out_of_range() _NOEXCEPT {} |
| 56 | |
| 57 | runtime_error::~runtime_error() _NOEXCEPT {} |
| 58 | range_error::~range_error() _NOEXCEPT {} |
| 59 | overflow_error::~overflow_error() _NOEXCEPT {} |
| 60 | underflow_error::~underflow_error() _NOEXCEPT {} |
| 61 | |
| 62 | #endif |
| 63 | |
| 64 | } // namespace std |
| 65 | |