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