1//===------------------------ cxa_aux_runtime.cpp -------------------------===//
2//
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
6//
7//
8// This file implements the "Auxiliary Runtime APIs"
9// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#cxx-aux
10//===----------------------------------------------------------------------===//
11
12#include "cxxabi.h"
13#include <new>
14#include <typeinfo>
15
16namespace __cxxabiv1 {
17extern "C" {
18_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
19#ifndef _LIBCXXABI_NO_EXCEPTIONS
20 throw std::bad_cast();
21#else
22 std::terminate();
23#endif
24}
25
26_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
27#ifndef _LIBCXXABI_NO_EXCEPTIONS
28 throw std::bad_typeid();
29#else
30 std::terminate();
31#endif
32}
33
34_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
35__cxa_throw_bad_array_new_length(void) {
36#ifndef _LIBCXXABI_NO_EXCEPTIONS
37 throw std::bad_array_new_length();
38#else
39 std::terminate();
40#endif
41}
42} // extern "C"
43} // abi
44