1//===----------------------------------------------------------------------===//
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) && (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
13# include <cxxabi.h>
14#endif
15
16static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
17
18namespace std // purposefully not using versioning namespace
19{
20
21logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {}
22
23logic_error::logic_error(const char* msg) : __imp_(msg) {}
24
25logic_error::logic_error(const logic_error& le) noexcept : __imp_(le.__imp_) {}
26
27logic_error& logic_error::operator=(const logic_error& le) noexcept {
28 __imp_ = le.__imp_;
29 return *this;
30}
31
32runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
33
34runtime_error::runtime_error(const char* msg) : __imp_(msg) {}
35
36runtime_error::runtime_error(const runtime_error& re) noexcept : __imp_(re.__imp_) {}
37
38runtime_error& runtime_error::operator=(const runtime_error& re) noexcept {
39 __imp_ = re.__imp_;
40 return *this;
41}
42
43#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
44
45const char* logic_error::what() const noexcept { return __imp_.c_str(); }
46
47const char* runtime_error::what() const noexcept { return __imp_.c_str(); }
48
49logic_error::~logic_error() noexcept {}
50domain_error::~domain_error() noexcept {}
51invalid_argument::~invalid_argument() noexcept {}
52length_error::~length_error() noexcept {}
53out_of_range::~out_of_range() noexcept {}
54
55runtime_error::~runtime_error() noexcept {}
56range_error::~range_error() noexcept {}
57overflow_error::~overflow_error() noexcept {}
58underflow_error::~underflow_error() noexcept {}
59
60#endif
61
62} // namespace std
63

source code of libcxx/src/support/runtime/stdexcept_default.ipp