blob: 878d3bd034ddfff976cbba920bd0d2710780dd9d [file] [log] [blame]
Marshall Clowad3dea02011-06-03 02:04:41 +00001//===------------------------ 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 Hinnant575498b2011-06-07 19:56:49 +00008//
9// This file implements the "Auxiliary Runtime APIs"
Jonathan Roelofsc5f7e6f2014-02-12 04:49:09 +000010// http://mentorembedded.github.io/cxx-abi/abi-eh.html#cxx-aux
Marshall Clowad3dea02011-06-03 02:04:41 +000011//===----------------------------------------------------------------------===//
12
13#include "cxxabi.h"
Aaron Ballmaneb7c1a62014-09-11 17:26:43 +000014#include <new>
Marshall Clowad3dea02011-06-03 02:04:41 +000015#include <typeinfo>
16
Saleem Abdulrasool242d67b2015-12-04 02:14:41 +000017namespace __cxxabiv1 {
18extern "C" {
Eric Fiselier71e32922017-03-01 02:23:54 +000019_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000020#ifndef _LIBCXXABI_NO_EXCEPTIONS
Saleem Abdulrasool12315ed2015-12-04 02:14:58 +000021 throw std::bad_cast();
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000022#else
23 std::terminate();
24#endif
Saleem Abdulrasool12315ed2015-12-04 02:14:58 +000025}
Marshall Clowad3dea02011-06-03 02:04:41 +000026
Eric Fiselier71e32922017-03-01 02:23:54 +000027_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000028#ifndef _LIBCXXABI_NO_EXCEPTIONS
Saleem Abdulrasool12315ed2015-12-04 02:14:58 +000029 throw std::bad_typeid();
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000030#else
31 std::terminate();
32#endif
Saleem Abdulrasool12315ed2015-12-04 02:14:58 +000033}
Marshall Clowad3dea02011-06-03 02:04:41 +000034
Eric Fiselier71e32922017-03-01 02:23:54 +000035_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
Saleem Abdulrasool12315ed2015-12-04 02:14:58 +000036__cxa_throw_bad_array_new_length(void) {
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000037#ifndef _LIBCXXABI_NO_EXCEPTIONS
Saleem Abdulrasool242d67b2015-12-04 02:14:41 +000038 throw std::bad_array_new_length();
Asiri Rathnayake57e446d2016-05-31 12:01:32 +000039#else
40 std::terminate();
41#endif
Aaron Ballmaneb7c1a62014-09-11 17:26:43 +000042}
Saleem Abdulrasool242d67b2015-12-04 02:14:41 +000043} // extern "C"
44} // abi