Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 1 | //===------------------------ cxa_aux_runtime.cpp -------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 6 | // |
Howard Hinnant | 575498b | 2011-06-07 19:56:49 +0000 | [diff] [blame] | 7 | // |
| 8 | // This file implements the "Auxiliary Runtime APIs" |
Jonathan Roelofs | c5f7e6f | 2014-02-12 04:49:09 +0000 | [diff] [blame] | 9 | // http://mentorembedded.github.io/cxx-abi/abi-eh.html#cxx-aux |
Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | #include "cxxabi.h" |
Aaron Ballman | eb7c1a6 | 2014-09-11 17:26:43 +0000 | [diff] [blame] | 13 | #include <new> |
Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 14 | #include <typeinfo> |
| 15 | |
Saleem Abdulrasool | 242d67b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 16 | namespace __cxxabiv1 { |
| 17 | extern "C" { |
Eric Fiselier | 71e3292 | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 18 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) { |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 19 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | 12315ed | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 20 | throw std::bad_cast(); |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 21 | #else |
| 22 | std::terminate(); |
| 23 | #endif |
Saleem Abdulrasool | 12315ed | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 24 | } |
Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 25 | |
Eric Fiselier | 71e3292 | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 26 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 27 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | 12315ed | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 28 | throw std::bad_typeid(); |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 29 | #else |
| 30 | std::terminate(); |
| 31 | #endif |
Saleem Abdulrasool | 12315ed | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 32 | } |
Marshall Clow | ad3dea0 | 2011-06-03 02:04:41 +0000 | [diff] [blame] | 33 | |
Eric Fiselier | 71e3292 | 2017-03-01 02:23:54 +0000 | [diff] [blame] | 34 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void |
Saleem Abdulrasool | 12315ed | 2015-12-04 02:14:58 +0000 | [diff] [blame] | 35 | __cxa_throw_bad_array_new_length(void) { |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 36 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
Saleem Abdulrasool | 242d67b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 37 | throw std::bad_array_new_length(); |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 38 | #else |
| 39 | std::terminate(); |
| 40 | #endif |
Aaron Ballman | eb7c1a6 | 2014-09-11 17:26:43 +0000 | [diff] [blame] | 41 | } |
Saleem Abdulrasool | 242d67b | 2015-12-04 02:14:41 +0000 | [diff] [blame] | 42 | } // extern "C" |
| 43 | } // abi |