Kaido Kert | 788710a | 2023-06-05 07:50:22 -0700 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 2 | // |
Kaido Kert | 788710a | 2023-06-05 07:50:22 -0700 | [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 |
Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 6 | // |
| 7 | // |
| 8 | // This file implements the "Auxiliary Runtime APIs" |
Kaido Kert | 788710a | 2023-06-05 07:50:22 -0700 | [diff] [blame] | 9 | // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#cxx-aux |
Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | #include "cxxabi.h" |
Kaido Kert | 56d7c4e | 2024-04-13 12:59:27 -0700 | [diff] [blame] | 13 | #include <exception> |
Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 14 | #include <new> |
| 15 | #include <typeinfo> |
| 16 | |
| 17 | namespace __cxxabiv1 { |
| 18 | extern "C" { |
| 19 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) { |
| 20 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
| 21 | throw std::bad_cast(); |
| 22 | #else |
| 23 | std::terminate(); |
| 24 | #endif |
| 25 | } |
| 26 | |
| 27 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { |
| 28 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
| 29 | throw std::bad_typeid(); |
| 30 | #else |
| 31 | std::terminate(); |
| 32 | #endif |
| 33 | } |
| 34 | |
| 35 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void |
| 36 | __cxa_throw_bad_array_new_length(void) { |
| 37 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
| 38 | throw std::bad_array_new_length(); |
| 39 | #else |
| 40 | std::terminate(); |
| 41 | #endif |
| 42 | } |
| 43 | } // extern "C" |
| 44 | } // abi |