1*4684ddb6SLionel Sambuc// -*- C++ -*- 2*4684ddb6SLionel Sambuc//===--------------------------- stdexcept --------------------------------===// 3*4684ddb6SLionel Sambuc// 4*4684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 5*4684ddb6SLionel Sambuc// 6*4684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 7*4684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 8*4684ddb6SLionel Sambuc// 9*4684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 10*4684ddb6SLionel Sambuc 11*4684ddb6SLionel Sambuc#ifndef _LIBCPP_STDEXCEPT 12*4684ddb6SLionel Sambuc#define _LIBCPP_STDEXCEPT 13*4684ddb6SLionel Sambuc 14*4684ddb6SLionel Sambuc/* 15*4684ddb6SLionel Sambuc stdexcept synopsis 16*4684ddb6SLionel Sambuc 17*4684ddb6SLionel Sambucnamespace std 18*4684ddb6SLionel Sambuc{ 19*4684ddb6SLionel Sambuc 20*4684ddb6SLionel Sambucclass logic_error; 21*4684ddb6SLionel Sambuc class domain_error; 22*4684ddb6SLionel Sambuc class invalid_argument; 23*4684ddb6SLionel Sambuc class length_error; 24*4684ddb6SLionel Sambuc class out_of_range; 25*4684ddb6SLionel Sambucclass runtime_error; 26*4684ddb6SLionel Sambuc class range_error; 27*4684ddb6SLionel Sambuc class overflow_error; 28*4684ddb6SLionel Sambuc class underflow_error; 29*4684ddb6SLionel Sambuc 30*4684ddb6SLionel Sambucfor each class xxx_error: 31*4684ddb6SLionel Sambuc 32*4684ddb6SLionel Sambucclass xxx_error : public exception // at least indirectly 33*4684ddb6SLionel Sambuc{ 34*4684ddb6SLionel Sambucpublic: 35*4684ddb6SLionel Sambuc explicit xxx_error(const string& what_arg); 36*4684ddb6SLionel Sambuc explicit xxx_error(const char* what_arg); 37*4684ddb6SLionel Sambuc 38*4684ddb6SLionel Sambuc virtual const char* what() const noexcept // returns what_arg 39*4684ddb6SLionel Sambuc}; 40*4684ddb6SLionel Sambuc 41*4684ddb6SLionel Sambuc} // std 42*4684ddb6SLionel Sambuc 43*4684ddb6SLionel Sambuc*/ 44*4684ddb6SLionel Sambuc 45*4684ddb6SLionel Sambuc#include <__config> 46*4684ddb6SLionel Sambuc#include <exception> 47*4684ddb6SLionel Sambuc#include <iosfwd> // for string forward decl 48*4684ddb6SLionel Sambuc 49*4684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 50*4684ddb6SLionel Sambuc#pragma GCC system_header 51*4684ddb6SLionel Sambuc#endif 52*4684ddb6SLionel Sambuc 53*4684ddb6SLionel Sambucnamespace std // purposefully not using versioning namespace 54*4684ddb6SLionel Sambuc{ 55*4684ddb6SLionel Sambuc 56*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI logic_error 57*4684ddb6SLionel Sambuc : public exception 58*4684ddb6SLionel Sambuc{ 59*4684ddb6SLionel Sambucprivate: 60*4684ddb6SLionel Sambuc void* __imp_; 61*4684ddb6SLionel Sambucpublic: 62*4684ddb6SLionel Sambuc explicit logic_error(const string&); 63*4684ddb6SLionel Sambuc explicit logic_error(const char*); 64*4684ddb6SLionel Sambuc 65*4684ddb6SLionel Sambuc logic_error(const logic_error&) _NOEXCEPT; 66*4684ddb6SLionel Sambuc logic_error& operator=(const logic_error&) _NOEXCEPT; 67*4684ddb6SLionel Sambuc 68*4684ddb6SLionel Sambuc virtual ~logic_error() _NOEXCEPT; 69*4684ddb6SLionel Sambuc 70*4684ddb6SLionel Sambuc virtual const char* what() const _NOEXCEPT; 71*4684ddb6SLionel Sambuc}; 72*4684ddb6SLionel Sambuc 73*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI runtime_error 74*4684ddb6SLionel Sambuc : public exception 75*4684ddb6SLionel Sambuc{ 76*4684ddb6SLionel Sambucprivate: 77*4684ddb6SLionel Sambuc void* __imp_; 78*4684ddb6SLionel Sambucpublic: 79*4684ddb6SLionel Sambuc explicit runtime_error(const string&); 80*4684ddb6SLionel Sambuc explicit runtime_error(const char*); 81*4684ddb6SLionel Sambuc 82*4684ddb6SLionel Sambuc runtime_error(const runtime_error&) _NOEXCEPT; 83*4684ddb6SLionel Sambuc runtime_error& operator=(const runtime_error&) _NOEXCEPT; 84*4684ddb6SLionel Sambuc 85*4684ddb6SLionel Sambuc virtual ~runtime_error() _NOEXCEPT; 86*4684ddb6SLionel Sambuc 87*4684ddb6SLionel Sambuc virtual const char* what() const _NOEXCEPT; 88*4684ddb6SLionel Sambuc}; 89*4684ddb6SLionel Sambuc 90*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI domain_error 91*4684ddb6SLionel Sambuc : public logic_error 92*4684ddb6SLionel Sambuc{ 93*4684ddb6SLionel Sambucpublic: 94*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} 95*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {} 96*4684ddb6SLionel Sambuc 97*4684ddb6SLionel Sambuc virtual ~domain_error() _NOEXCEPT; 98*4684ddb6SLionel Sambuc}; 99*4684ddb6SLionel Sambuc 100*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI invalid_argument 101*4684ddb6SLionel Sambuc : public logic_error 102*4684ddb6SLionel Sambuc{ 103*4684ddb6SLionel Sambucpublic: 104*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} 105*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {} 106*4684ddb6SLionel Sambuc 107*4684ddb6SLionel Sambuc virtual ~invalid_argument() _NOEXCEPT; 108*4684ddb6SLionel Sambuc}; 109*4684ddb6SLionel Sambuc 110*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI length_error 111*4684ddb6SLionel Sambuc : public logic_error 112*4684ddb6SLionel Sambuc{ 113*4684ddb6SLionel Sambucpublic: 114*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} 115*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} 116*4684ddb6SLionel Sambuc 117*4684ddb6SLionel Sambuc virtual ~length_error() _NOEXCEPT; 118*4684ddb6SLionel Sambuc}; 119*4684ddb6SLionel Sambuc 120*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI out_of_range 121*4684ddb6SLionel Sambuc : public logic_error 122*4684ddb6SLionel Sambuc{ 123*4684ddb6SLionel Sambucpublic: 124*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} 125*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {} 126*4684ddb6SLionel Sambuc 127*4684ddb6SLionel Sambuc virtual ~out_of_range() _NOEXCEPT; 128*4684ddb6SLionel Sambuc}; 129*4684ddb6SLionel Sambuc 130*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI range_error 131*4684ddb6SLionel Sambuc : public runtime_error 132*4684ddb6SLionel Sambuc{ 133*4684ddb6SLionel Sambucpublic: 134*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} 135*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {} 136*4684ddb6SLionel Sambuc 137*4684ddb6SLionel Sambuc virtual ~range_error() _NOEXCEPT; 138*4684ddb6SLionel Sambuc}; 139*4684ddb6SLionel Sambuc 140*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI overflow_error 141*4684ddb6SLionel Sambuc : public runtime_error 142*4684ddb6SLionel Sambuc{ 143*4684ddb6SLionel Sambucpublic: 144*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} 145*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {} 146*4684ddb6SLionel Sambuc 147*4684ddb6SLionel Sambuc virtual ~overflow_error() _NOEXCEPT; 148*4684ddb6SLionel Sambuc}; 149*4684ddb6SLionel Sambuc 150*4684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI underflow_error 151*4684ddb6SLionel Sambuc : public runtime_error 152*4684ddb6SLionel Sambuc{ 153*4684ddb6SLionel Sambucpublic: 154*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {} 155*4684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {} 156*4684ddb6SLionel Sambuc 157*4684ddb6SLionel Sambuc virtual ~underflow_error() _NOEXCEPT; 158*4684ddb6SLionel Sambuc}; 159*4684ddb6SLionel Sambuc 160*4684ddb6SLionel Sambuc} // std 161*4684ddb6SLionel Sambuc 162*4684ddb6SLionel Sambuc#endif // _LIBCPP_STDEXCEPT 163