xref: /aosp_15_r20/external/libcxxabi/src/cxa_noexception.cpp (revision c05d8e5dc3e10f6ce4317e8bc22cc4a25f55fa94)
1*c05d8e5dSAndroid Build Coastguard Worker //===------------------------- cxa_exception.cpp --------------------------===//
2*c05d8e5dSAndroid Build Coastguard Worker //
3*c05d8e5dSAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*c05d8e5dSAndroid Build Coastguard Worker //
5*c05d8e5dSAndroid Build Coastguard Worker // This file is dual licensed under the MIT and the University of Illinois Open
6*c05d8e5dSAndroid Build Coastguard Worker // Source Licenses. See LICENSE.TXT for details.
7*c05d8e5dSAndroid Build Coastguard Worker //
8*c05d8e5dSAndroid Build Coastguard Worker //
9*c05d8e5dSAndroid Build Coastguard Worker //  This file implements the "Exception Handling APIs"
10*c05d8e5dSAndroid Build Coastguard Worker //  http://mentorembedded.github.io/cxx-abi/abi-eh.html
11*c05d8e5dSAndroid Build Coastguard Worker //
12*c05d8e5dSAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*c05d8e5dSAndroid Build Coastguard Worker 
14*c05d8e5dSAndroid Build Coastguard Worker // Support functions for the no-exceptions libc++ library
15*c05d8e5dSAndroid Build Coastguard Worker 
16*c05d8e5dSAndroid Build Coastguard Worker #include "cxxabi.h"
17*c05d8e5dSAndroid Build Coastguard Worker 
18*c05d8e5dSAndroid Build Coastguard Worker #include <exception>        // for std::terminate
19*c05d8e5dSAndroid Build Coastguard Worker #include "cxa_exception.hpp"
20*c05d8e5dSAndroid Build Coastguard Worker #include "cxa_handlers.hpp"
21*c05d8e5dSAndroid Build Coastguard Worker 
22*c05d8e5dSAndroid Build Coastguard Worker namespace __cxxabiv1 {
23*c05d8e5dSAndroid Build Coastguard Worker 
24*c05d8e5dSAndroid Build Coastguard Worker extern "C" {
25*c05d8e5dSAndroid Build Coastguard Worker 
26*c05d8e5dSAndroid Build Coastguard Worker void
__cxa_increment_exception_refcount(void * thrown_object)27*c05d8e5dSAndroid Build Coastguard Worker __cxa_increment_exception_refcount(void *thrown_object) throw() {
28*c05d8e5dSAndroid Build Coastguard Worker     if (thrown_object != nullptr)
29*c05d8e5dSAndroid Build Coastguard Worker         std::terminate();
30*c05d8e5dSAndroid Build Coastguard Worker }
31*c05d8e5dSAndroid Build Coastguard Worker 
32*c05d8e5dSAndroid Build Coastguard Worker void
__cxa_decrement_exception_refcount(void * thrown_object)33*c05d8e5dSAndroid Build Coastguard Worker __cxa_decrement_exception_refcount(void *thrown_object) throw() {
34*c05d8e5dSAndroid Build Coastguard Worker     if (thrown_object != nullptr)
35*c05d8e5dSAndroid Build Coastguard Worker       std::terminate();
36*c05d8e5dSAndroid Build Coastguard Worker }
37*c05d8e5dSAndroid Build Coastguard Worker 
38*c05d8e5dSAndroid Build Coastguard Worker 
__cxa_current_primary_exception()39*c05d8e5dSAndroid Build Coastguard Worker void *__cxa_current_primary_exception() throw() { return nullptr; }
40*c05d8e5dSAndroid Build Coastguard Worker 
41*c05d8e5dSAndroid Build Coastguard Worker void
__cxa_rethrow_primary_exception(void * thrown_object)42*c05d8e5dSAndroid Build Coastguard Worker __cxa_rethrow_primary_exception(void* thrown_object) {
43*c05d8e5dSAndroid Build Coastguard Worker     if (thrown_object != nullptr)
44*c05d8e5dSAndroid Build Coastguard Worker       std::terminate();
45*c05d8e5dSAndroid Build Coastguard Worker }
46*c05d8e5dSAndroid Build Coastguard Worker 
47*c05d8e5dSAndroid Build Coastguard Worker bool
__cxa_uncaught_exception()48*c05d8e5dSAndroid Build Coastguard Worker __cxa_uncaught_exception() throw() { return false; }
49*c05d8e5dSAndroid Build Coastguard Worker 
50*c05d8e5dSAndroid Build Coastguard Worker unsigned int
__cxa_uncaught_exceptions()51*c05d8e5dSAndroid Build Coastguard Worker __cxa_uncaught_exceptions() throw() { return 0; }
52*c05d8e5dSAndroid Build Coastguard Worker 
53*c05d8e5dSAndroid Build Coastguard Worker }  // extern "C"
54*c05d8e5dSAndroid Build Coastguard Worker 
55*c05d8e5dSAndroid Build Coastguard Worker // provide dummy implementations for the 'no exceptions' case.
__getExceptionClass(const _Unwind_Exception *)56*c05d8e5dSAndroid Build Coastguard Worker uint64_t __getExceptionClass  (const _Unwind_Exception*)           { return 0; }
__setExceptionClass(_Unwind_Exception *,uint64_t)57*c05d8e5dSAndroid Build Coastguard Worker void     __setExceptionClass  (      _Unwind_Exception*, uint64_t) {}
__isOurExceptionClass(const _Unwind_Exception *)58*c05d8e5dSAndroid Build Coastguard Worker bool     __isOurExceptionClass(const _Unwind_Exception*)           { return false; }
59*c05d8e5dSAndroid Build Coastguard Worker 
60*c05d8e5dSAndroid Build Coastguard Worker }  // abi
61