xref: /freebsd/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp (revision cb14a3fe5122c879eae1fb480ed7ce82a699ddb6)
1349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric#include "../../include/refstring.h"
100b57cec5SDimitry Andric
110b57cec5SDimitry Andric/* For _LIBCPPABI_VERSION */
12*cb14a3feSDimitry Andric#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
130b57cec5SDimitry Andric#  include <cxxabi.h>
140b57cec5SDimitry Andric#endif
150b57cec5SDimitry Andric
160b57cec5SDimitry Andricstatic_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
170b57cec5SDimitry Andric
180b57cec5SDimitry Andricnamespace std // purposefully not using versioning namespace
190b57cec5SDimitry Andric{
200b57cec5SDimitry Andric
210b57cec5SDimitry Andriclogic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {}
220b57cec5SDimitry Andric
230b57cec5SDimitry Andriclogic_error::logic_error(const char* msg) : __imp_(msg) {}
240b57cec5SDimitry Andric
25fe6060f1SDimitry Andriclogic_error::logic_error(const logic_error& le) noexcept : __imp_(le.__imp_) {}
260b57cec5SDimitry Andric
27fe6060f1SDimitry Andriclogic_error& logic_error::operator=(const logic_error& le) noexcept {
280b57cec5SDimitry Andric  __imp_ = le.__imp_;
290b57cec5SDimitry Andric  return *this;
300b57cec5SDimitry Andric}
310b57cec5SDimitry Andric
320b57cec5SDimitry Andricruntime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
330b57cec5SDimitry Andric
340b57cec5SDimitry Andricruntime_error::runtime_error(const char* msg) : __imp_(msg) {}
350b57cec5SDimitry Andric
36*cb14a3feSDimitry Andricruntime_error::runtime_error(const runtime_error& re) noexcept : __imp_(re.__imp_) {}
370b57cec5SDimitry Andric
38fe6060f1SDimitry Andricruntime_error& runtime_error::operator=(const runtime_error& re) noexcept {
390b57cec5SDimitry Andric  __imp_ = re.__imp_;
400b57cec5SDimitry Andric  return *this;
410b57cec5SDimitry Andric}
420b57cec5SDimitry Andric
430b57cec5SDimitry Andric#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
440b57cec5SDimitry Andric
45fe6060f1SDimitry Andricconst char* logic_error::what() const noexcept { return __imp_.c_str(); }
460b57cec5SDimitry Andric
47fe6060f1SDimitry Andricconst char* runtime_error::what() const noexcept { return __imp_.c_str(); }
480b57cec5SDimitry Andric
49fe6060f1SDimitry Andriclogic_error::~logic_error() noexcept {}
50fe6060f1SDimitry Andricdomain_error::~domain_error() noexcept {}
51fe6060f1SDimitry Andricinvalid_argument::~invalid_argument() noexcept {}
52fe6060f1SDimitry Andriclength_error::~length_error() noexcept {}
53fe6060f1SDimitry Andricout_of_range::~out_of_range() noexcept {}
540b57cec5SDimitry Andric
55fe6060f1SDimitry Andricruntime_error::~runtime_error() noexcept {}
56fe6060f1SDimitry Andricrange_error::~range_error() noexcept {}
57fe6060f1SDimitry Andricoverflow_error::~overflow_error() noexcept {}
58fe6060f1SDimitry Andricunderflow_error::~underflow_error() noexcept {}
590b57cec5SDimitry Andric
600b57cec5SDimitry Andric#endif
610b57cec5SDimitry Andric
620b57cec5SDimitry Andric} // namespace std
63