45 lines · cpp
1//===----------------------------------------------------------------------===//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-exception6//7//8// This file implements the "Auxiliary Runtime APIs"9// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#cxx-aux10//===----------------------------------------------------------------------===//11 12#include "cxxabi.h"13#include <exception>14#include <new>15#include <typeinfo>16 17namespace __cxxabiv1 {18extern "C" {19_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {20#ifndef _LIBCXXABI_NO_EXCEPTIONS21 throw std::bad_cast();22#else23 std::terminate();24#endif25}26 27_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {28#ifndef _LIBCXXABI_NO_EXCEPTIONS29 throw std::bad_typeid();30#else31 std::terminate();32#endif33}34 35_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void36__cxa_throw_bad_array_new_length(void) {37#ifndef _LIBCXXABI_NO_EXCEPTIONS38 throw std::bad_array_new_length();39#else40 std::terminate();41#endif42}43} // extern "C"44} // abi45