1*4bdff4beSrobert//===----------------------------------------------------------------------===// 246035553Spatrick// 346035553Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 446035553Spatrick// See https://llvm.org/LICENSE.txt for license information. 546035553Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 646035553Spatrick// 746035553Spatrick//===----------------------------------------------------------------------===// 846035553Spatrick 946035553Spatrick#include "../../include/refstring.h" 1046035553Spatrick 1146035553Spatrick/* For _LIBCPPABI_VERSION */ 1246035553Spatrick#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \ 1346035553Spatrick (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT)) 1446035553Spatrick#include <cxxabi.h> 1546035553Spatrick#endif 1646035553Spatrick 1746035553Spatrickstatic_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), ""); 1846035553Spatrick 1946035553Spatricknamespace std // purposefully not using versioning namespace 2046035553Spatrick{ 2146035553Spatrick 2246035553Spatricklogic_error::logic_error(const string& msg) : __imp_(msg.c_str()) {} 2346035553Spatrick 2446035553Spatricklogic_error::logic_error(const char* msg) : __imp_(msg) {} 2546035553Spatrick 2676d0caaeSpatricklogic_error::logic_error(const logic_error& le) noexcept : __imp_(le.__imp_) {} 2746035553Spatrick 2876d0caaeSpatricklogic_error& logic_error::operator=(const logic_error& le) noexcept { 2946035553Spatrick __imp_ = le.__imp_; 3046035553Spatrick return *this; 3146035553Spatrick} 3246035553Spatrick 3346035553Spatrickruntime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {} 3446035553Spatrick 3546035553Spatrickruntime_error::runtime_error(const char* msg) : __imp_(msg) {} 3646035553Spatrick 3776d0caaeSpatrickruntime_error::runtime_error(const runtime_error& re) noexcept 3846035553Spatrick : __imp_(re.__imp_) {} 3946035553Spatrick 4076d0caaeSpatrickruntime_error& runtime_error::operator=(const runtime_error& re) noexcept { 4146035553Spatrick __imp_ = re.__imp_; 4246035553Spatrick return *this; 4346035553Spatrick} 4446035553Spatrick 4546035553Spatrick#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) 4646035553Spatrick 4776d0caaeSpatrickconst char* logic_error::what() const noexcept { return __imp_.c_str(); } 4846035553Spatrick 4976d0caaeSpatrickconst char* runtime_error::what() const noexcept { return __imp_.c_str(); } 5046035553Spatrick 5176d0caaeSpatricklogic_error::~logic_error() noexcept {} 5276d0caaeSpatrickdomain_error::~domain_error() noexcept {} 5376d0caaeSpatrickinvalid_argument::~invalid_argument() noexcept {} 5476d0caaeSpatricklength_error::~length_error() noexcept {} 5576d0caaeSpatrickout_of_range::~out_of_range() noexcept {} 5646035553Spatrick 5776d0caaeSpatrickruntime_error::~runtime_error() noexcept {} 5876d0caaeSpatrickrange_error::~range_error() noexcept {} 5976d0caaeSpatrickoverflow_error::~overflow_error() noexcept {} 6076d0caaeSpatrickunderflow_error::~underflow_error() noexcept {} 6146035553Spatrick 6246035553Spatrick#endif 6346035553Spatrick 6446035553Spatrick} // namespace std 65