1*c05d8e5dSAndroid Build Coastguard Worker //===------------------------ cxa_aux_runtime.cpp -------------------------===// 2*c05d8e5dSAndroid Build Coastguard Worker // 3*c05d8e5dSAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*c05d8e5dSAndroid Build Coastguard Worker // 5*c05d8e5dSAndroid Build Coastguard Worker // This file is dual licensed under the MIT and the University of Illinois Open 6*c05d8e5dSAndroid Build Coastguard Worker // Source Licenses. See LICENSE.TXT for details. 7*c05d8e5dSAndroid Build Coastguard Worker // 8*c05d8e5dSAndroid Build Coastguard Worker // 9*c05d8e5dSAndroid Build Coastguard Worker // This file implements the "Auxiliary Runtime APIs" 10*c05d8e5dSAndroid Build Coastguard Worker // http://mentorembedded.github.io/cxx-abi/abi-eh.html#cxx-aux 11*c05d8e5dSAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 12*c05d8e5dSAndroid Build Coastguard Worker 13*c05d8e5dSAndroid Build Coastguard Worker #include "cxxabi.h" 14*c05d8e5dSAndroid Build Coastguard Worker #include <new> 15*c05d8e5dSAndroid Build Coastguard Worker #include <typeinfo> 16*c05d8e5dSAndroid Build Coastguard Worker 17*c05d8e5dSAndroid Build Coastguard Worker namespace __cxxabiv1 { 18*c05d8e5dSAndroid Build Coastguard Worker extern "C" { __cxa_bad_cast(void)19*c05d8e5dSAndroid Build Coastguard Worker_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) { 20*c05d8e5dSAndroid Build Coastguard Worker #ifndef _LIBCXXABI_NO_EXCEPTIONS 21*c05d8e5dSAndroid Build Coastguard Worker throw std::bad_cast(); 22*c05d8e5dSAndroid Build Coastguard Worker #else 23*c05d8e5dSAndroid Build Coastguard Worker std::terminate(); 24*c05d8e5dSAndroid Build Coastguard Worker #endif 25*c05d8e5dSAndroid Build Coastguard Worker } 26*c05d8e5dSAndroid Build Coastguard Worker __cxa_bad_typeid(void)27*c05d8e5dSAndroid Build Coastguard Worker_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { 28*c05d8e5dSAndroid Build Coastguard Worker #ifndef _LIBCXXABI_NO_EXCEPTIONS 29*c05d8e5dSAndroid Build Coastguard Worker throw std::bad_typeid(); 30*c05d8e5dSAndroid Build Coastguard Worker #else 31*c05d8e5dSAndroid Build Coastguard Worker std::terminate(); 32*c05d8e5dSAndroid Build Coastguard Worker #endif 33*c05d8e5dSAndroid Build Coastguard Worker } 34*c05d8e5dSAndroid Build Coastguard Worker 35*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw_bad_array_new_length(void)36*c05d8e5dSAndroid Build Coastguard Worker__cxa_throw_bad_array_new_length(void) { 37*c05d8e5dSAndroid Build Coastguard Worker #ifndef _LIBCXXABI_NO_EXCEPTIONS 38*c05d8e5dSAndroid Build Coastguard Worker throw std::bad_array_new_length(); 39*c05d8e5dSAndroid Build Coastguard Worker #else 40*c05d8e5dSAndroid Build Coastguard Worker std::terminate(); 41*c05d8e5dSAndroid Build Coastguard Worker #endif 42*c05d8e5dSAndroid Build Coastguard Worker } 43*c05d8e5dSAndroid Build Coastguard Worker } // extern "C" 44*c05d8e5dSAndroid Build Coastguard Worker } // abi 45