Marshall Clow | 4c2acbc | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 1 | //===------------------------ cxa_aux_runtime.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 | // |
Howard Hinnant | 25f1807 | 2011-06-07 19:56:49 +0000 | [diff] [blame] | 8 | // |
| 9 | // This file implements the "Auxiliary Runtime APIs" |
Jonathan Roelofs | c82e02d | 2014-02-12 04:49:09 +0000 | [diff] [blame] | 10 | // http://mentorembedded.github.io/cxx-abi/abi-eh.html#cxx-aux |
Marshall Clow | 4c2acbc | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "cxxabi.h" |
Aaron Ballman | 68fcfa1 | 2014-09-11 17:26:43 +0000 | [diff] [blame] | 14 | #include <new> |
Marshall Clow | 4c2acbc | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 15 | #include <typeinfo> |
| 16 | |
Saleem Abdulrasool | 77a304b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 17 | namespace __cxxabiv1 { |
| 18 | extern "C" { |
Eric Fiselier | 9e2169e | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 19 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) { |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 20 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | b4ec579 | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 21 | throw std::bad_cast(); |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 22 | #else |
| 23 | std::terminate(); |
| 24 | #endif |
Saleem Abdulrasool | b4ec579 | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 25 | } |
Marshall Clow | 4c2acbc | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 26 | |
Eric Fiselier | 9e2169e | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 27 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 28 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | b4ec579 | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 29 | throw std::bad_typeid(); |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 30 | #else |
| 31 | std::terminate(); |
| 32 | #endif |
Saleem Abdulrasool | b4ec579 | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 33 | } |
Marshall Clow | 4c2acbc | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 34 | |
Eric Fiselier | 9e2169e | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 35 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void |
Saleem Abdulrasool | b4ec579 | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 36 | __cxa_throw_bad_array_new_length(void) { |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 37 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | 77a304b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 38 | throw std::bad_array_new_length(); |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 39 | #else |
| 40 | std::terminate(); |
| 41 | #endif |
Aaron Ballman | 68fcfa1 | 2014-09-11 17:26:43 +0000 | [diff] [blame] | 42 | } |
Saleem Abdulrasool | 77a304b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 43 | } // extern "C" |
| 44 | } // abi |