1 //===------------------------- typeinfo.cpp -------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #include <stdlib.h> 10 11 #if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \ 12 (defined(__APPLE__) || defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)) 13 #include <cxxabi.h> 14 #endif 15 16 #include "typeinfo" 17 18 #if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) 19 std::type_info::~type_info() 20 { 21 } 22 #endif 23 24 #if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) 25 26 std::bad_cast::bad_cast() _NOEXCEPT 27 { 28 } 29 30 std::bad_typeid::bad_typeid() _NOEXCEPT 31 { 32 } 33 34 #ifndef __GLIBCXX__ 35 36 std::bad_cast::~bad_cast() _NOEXCEPT 37 { 38 } 39 40 const char* 41 std::bad_cast::what() const _NOEXCEPT 42 { 43 return "std::bad_cast"; 44 } 45 46 std::bad_typeid::~bad_typeid() _NOEXCEPT 47 { 48 } 49 50 const char* 51 std::bad_typeid::what() const _NOEXCEPT 52 { 53 return "std::bad_typeid"; 54 } 55 56 #if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) 57 // On Darwin, the cxa_bad_* functions cannot be in the lower level library 58 // because bad_cast and bad_typeid are defined in his higher level library 59 void __cxxabiv1::__cxa_bad_typeid() 60 { 61 #ifndef _LIBCPP_NO_EXCEPTIONS 62 throw std::bad_typeid(); 63 #else 64 _VSTD::abort(); 65 #endif 66 } 67 void __cxxabiv1::__cxa_bad_cast() 68 { 69 #ifndef _LIBCPP_NO_EXCEPTIONS 70 throw std::bad_cast(); 71 #else 72 _VSTD::abort(); 73 #endif 74 } 75 #endif 76 77 #endif // !__GLIBCXX__ 78 #endif // !LIBCXXRT && !_LIBCPPABI_VERSION 79