1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "../../include/refstring.h"
11 /* For _LIBCPPABI_VERSION */
12 #if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
16 static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
18 namespace std // purposefully not using versioning namespace
21 logic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {}
23 logic_error::logic_error(const char* msg) : __imp_(msg) {}
25 logic_error::logic_error(const logic_error& le) noexcept : __imp_(le.__imp_) {}
27 logic_error& logic_error::operator=(const logic_error& le) noexcept {
32 runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
34 runtime_error::runtime_error(const char* msg) : __imp_(msg) {}
36 runtime_error::runtime_error(const runtime_error& re) noexcept : __imp_(re.__imp_) {}
38 runtime_error& runtime_error::operator=(const runtime_error& re) noexcept {
43 #if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX)
45 const char* logic_error::what() const noexcept { return __imp_.c_str(); }
47 const char* runtime_error::what() const noexcept { return __imp_.c_str(); }
49 logic_error::~logic_error() noexcept {}
50 domain_error::~domain_error() noexcept {}
51 invalid_argument::~invalid_argument() noexcept {}
52 length_error::~length_error() noexcept {}
53 out_of_range::~out_of_range() noexcept {}
55 runtime_error::~runtime_error() noexcept {}
56 range_error::~range_error() noexcept {}
57 overflow_error::~overflow_error() noexcept {}
58 underflow_error::~underflow_error() noexcept {}