1227825Stheraven//===------------------------ stdexcept.cpp -------------------------------===// 2227825Stheraven// 3227825Stheraven// The LLVM Compiler Infrastructure 4227825Stheraven// 5227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 6227825Stheraven// Source Licenses. See LICENSE.TXT for details. 7227825Stheraven// 8227825Stheraven//===----------------------------------------------------------------------===// 9227825Stheraven 10278724Sdim#include "__refstring" 11227825Stheraven#include "stdexcept" 12227825Stheraven#include "new" 13227825Stheraven#include "string" 14227825Stheraven#include "system_error" 15234976Stheraven 16241903Sdim#ifndef __has_include 17241903Sdim#define __has_include(inc) 0 18241903Sdim#endif 19241903Sdim 20278724Sdim/* For _LIBCPPABI_VERSION */ 21278724Sdim#if __has_include(<cxxabi.h>) || defined(__APPLE_) || defined(LIBCXXRT) 22232950Stheraven#include <cxxabi.h> 23234976Stheraven#endif 24227825Stheraven 25278724Sdimstatic_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), ""); 26227825Stheraven 27227825Stheravennamespace std // purposefully not using versioning namespace 28227825Stheraven{ 29227825Stheraven 30278724Sdimlogic_error::logic_error(const string& msg) : __imp_(msg.c_str()) 31227825Stheraven{ 32227825Stheraven} 33227825Stheraven 34278724Sdimlogic_error::logic_error(const char* msg) : __imp_(msg) 35227825Stheraven{ 36227825Stheraven} 37227825Stheraven 38278724Sdimlogic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_) 39227825Stheraven{ 40227825Stheraven} 41227825Stheraven 42227825Stheravenlogic_error& 43227825Stheravenlogic_error::operator=(const logic_error& le) _NOEXCEPT 44227825Stheraven{ 45278724Sdim __imp_ = le.__imp_; 46227825Stheraven return *this; 47227825Stheraven} 48227825Stheraven 49262801Sdim#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) 50232950Stheraven 51227825Stheravenlogic_error::~logic_error() _NOEXCEPT 52227825Stheraven{ 53227825Stheraven} 54227825Stheraven 55227825Stheravenconst char* 56227825Stheravenlogic_error::what() const _NOEXCEPT 57227825Stheraven{ 58278724Sdim return __imp_.c_str(); 59227825Stheraven} 60227825Stheraven 61232950Stheraven#endif 62232950Stheraven 63278724Sdimruntime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) 64227825Stheraven{ 65227825Stheraven} 66227825Stheraven 67278724Sdimruntime_error::runtime_error(const char* msg) : __imp_(msg) 68227825Stheraven{ 69227825Stheraven} 70227825Stheraven 71227825Stheravenruntime_error::runtime_error(const runtime_error& le) _NOEXCEPT 72278724Sdim : __imp_(le.__imp_) 73227825Stheraven{ 74227825Stheraven} 75227825Stheraven 76227825Stheravenruntime_error& 77227825Stheravenruntime_error::operator=(const runtime_error& le) _NOEXCEPT 78227825Stheraven{ 79278724Sdim __imp_ = le.__imp_; 80227825Stheraven return *this; 81227825Stheraven} 82227825Stheraven 83262801Sdim#if !defined(_LIBCPPABI_VERSION) && !defined(LIBSTDCXX) 84232950Stheraven 85227825Stheravenruntime_error::~runtime_error() _NOEXCEPT 86227825Stheraven{ 87227825Stheraven} 88227825Stheraven 89227825Stheravenconst char* 90227825Stheravenruntime_error::what() const _NOEXCEPT 91227825Stheraven{ 92278724Sdim return __imp_.c_str(); 93227825Stheraven} 94227825Stheraven 95227825Stheravendomain_error::~domain_error() _NOEXCEPT {} 96227825Stheraveninvalid_argument::~invalid_argument() _NOEXCEPT {} 97227825Stheravenlength_error::~length_error() _NOEXCEPT {} 98227825Stheravenout_of_range::~out_of_range() _NOEXCEPT {} 99227825Stheraven 100227825Stheravenrange_error::~range_error() _NOEXCEPT {} 101227825Stheravenoverflow_error::~overflow_error() _NOEXCEPT {} 102227825Stheravenunderflow_error::~underflow_error() _NOEXCEPT {} 103227825Stheraven 104232950Stheraven#endif 105232950Stheraven 106227825Stheraven} // std 107