17a984708SDavid Chisnall //===------------------------ stdexcept.cpp -------------------------------===// 27a984708SDavid Chisnall // 37a984708SDavid Chisnall // The LLVM Compiler Infrastructure 47a984708SDavid Chisnall // 57a984708SDavid Chisnall // This file is dual licensed under the MIT and the University of Illinois Open 67a984708SDavid Chisnall // Source Licenses. See LICENSE.TXT for details. 77a984708SDavid Chisnall // 87a984708SDavid Chisnall //===----------------------------------------------------------------------===// 97a984708SDavid Chisnall 107a984708SDavid Chisnall #include "stdexcept" 117a984708SDavid Chisnall #include "new" 127a984708SDavid Chisnall #include "string" 137a984708SDavid Chisnall #include "system_error" 14*c4394386SDimitry Andric #include "include/refstring.h" 15b03f91a8SDavid Chisnall 16d72607e9SDimitry Andric /* For _LIBCPPABI_VERSION */ 17aed8d94eSDimitry Andric #if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \ 18aed8d94eSDimitry Andric (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE__) || defined(LIBCXXRT)) 1994e3ee44SDavid Chisnall #include <cxxabi.h> 20b03f91a8SDavid Chisnall #endif 217a984708SDavid Chisnall 22d72607e9SDimitry Andric static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), ""); 237a984708SDavid Chisnall 24aed8d94eSDimitry Andric 257a984708SDavid Chisnall namespace std // purposefully not using versioning namespace 267a984708SDavid Chisnall { 277a984708SDavid Chisnall logic_error(const string & msg)28d72607e9SDimitry Andriclogic_error::logic_error(const string& msg) : __imp_(msg.c_str()) 297a984708SDavid Chisnall { 307a984708SDavid Chisnall } 317a984708SDavid Chisnall logic_error(const char * msg)32d72607e9SDimitry Andriclogic_error::logic_error(const char* msg) : __imp_(msg) 337a984708SDavid Chisnall { 347a984708SDavid Chisnall } 357a984708SDavid Chisnall logic_error(const logic_error & le)36d72607e9SDimitry Andriclogic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_) 377a984708SDavid Chisnall { 387a984708SDavid Chisnall } 397a984708SDavid Chisnall 407a984708SDavid Chisnall logic_error& operator =(const logic_error & le)417a984708SDavid Chisnalllogic_error::operator=(const logic_error& le) _NOEXCEPT 427a984708SDavid Chisnall { 43d72607e9SDimitry Andric __imp_ = le.__imp_; 447a984708SDavid Chisnall return *this; 457a984708SDavid Chisnall } 467a984708SDavid Chisnall 474f7ab58eSDimitry Andric #if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) 4894e3ee44SDavid Chisnall ~logic_error()497a984708SDavid Chisnalllogic_error::~logic_error() _NOEXCEPT 507a984708SDavid Chisnall { 517a984708SDavid Chisnall } 527a984708SDavid Chisnall 537a984708SDavid Chisnall const char* what() const547a984708SDavid Chisnalllogic_error::what() const _NOEXCEPT 557a984708SDavid Chisnall { 56d72607e9SDimitry Andric return __imp_.c_str(); 577a984708SDavid Chisnall } 587a984708SDavid Chisnall 5994e3ee44SDavid Chisnall #endif 6094e3ee44SDavid Chisnall runtime_error(const string & msg)61d72607e9SDimitry Andricruntime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) 627a984708SDavid Chisnall { 637a984708SDavid Chisnall } 647a984708SDavid Chisnall runtime_error(const char * msg)65d72607e9SDimitry Andricruntime_error::runtime_error(const char* msg) : __imp_(msg) 667a984708SDavid Chisnall { 677a984708SDavid Chisnall } 687a984708SDavid Chisnall runtime_error(const runtime_error & le)697a984708SDavid Chisnallruntime_error::runtime_error(const runtime_error& le) _NOEXCEPT 70d72607e9SDimitry Andric : __imp_(le.__imp_) 717a984708SDavid Chisnall { 727a984708SDavid Chisnall } 737a984708SDavid Chisnall 747a984708SDavid Chisnall runtime_error& operator =(const runtime_error & le)757a984708SDavid Chisnallruntime_error::operator=(const runtime_error& le) _NOEXCEPT 767a984708SDavid Chisnall { 77d72607e9SDimitry Andric __imp_ = le.__imp_; 787a984708SDavid Chisnall return *this; 797a984708SDavid Chisnall } 807a984708SDavid Chisnall 814f7ab58eSDimitry Andric #if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) 8294e3ee44SDavid Chisnall ~runtime_error()837a984708SDavid Chisnallruntime_error::~runtime_error() _NOEXCEPT 847a984708SDavid Chisnall { 857a984708SDavid Chisnall } 867a984708SDavid Chisnall 877a984708SDavid Chisnall const char* what() const887a984708SDavid Chisnallruntime_error::what() const _NOEXCEPT 897a984708SDavid Chisnall { 90d72607e9SDimitry Andric return __imp_.c_str(); 917a984708SDavid Chisnall } 927a984708SDavid Chisnall ~domain_error()937a984708SDavid Chisnalldomain_error::~domain_error() _NOEXCEPT {} ~invalid_argument()947a984708SDavid Chisnallinvalid_argument::~invalid_argument() _NOEXCEPT {} ~length_error()957a984708SDavid Chisnalllength_error::~length_error() _NOEXCEPT {} ~out_of_range()967a984708SDavid Chisnallout_of_range::~out_of_range() _NOEXCEPT {} 977a984708SDavid Chisnall ~range_error()987a984708SDavid Chisnallrange_error::~range_error() _NOEXCEPT {} ~overflow_error()997a984708SDavid Chisnalloverflow_error::~overflow_error() _NOEXCEPT {} ~underflow_error()1007a984708SDavid Chisnallunderflow_error::~underflow_error() _NOEXCEPT {} 1017a984708SDavid Chisnall 10294e3ee44SDavid Chisnall #endif 10394e3ee44SDavid Chisnall 1047a984708SDavid Chisnall } // std 105