Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 1 | //===------------------------- cxa_exception.cpp --------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 6 | // |
| 7 | // |
| 8 | // This file implements the "Exception Handling APIs" |
| 9 | // http://mentorembedded.github.io/cxx-abi/abi-eh.html |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | // Support functions for the no-exceptions libc++ library |
| 14 | |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 15 | #include "cxxabi.h" |
| 16 | |
| 17 | #include <exception> // for std::terminate |
| 18 | #include "cxa_exception.hpp" |
| 19 | #include "cxa_handlers.hpp" |
| 20 | |
| 21 | namespace __cxxabiv1 { |
| 22 | |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 23 | extern "C" { |
| 24 | |
| 25 | void |
| 26 | __cxa_increment_exception_refcount(void *thrown_object) throw() { |
| 27 | if (thrown_object != nullptr) |
| 28 | std::terminate(); |
| 29 | } |
| 30 | |
| 31 | void |
| 32 | __cxa_decrement_exception_refcount(void *thrown_object) throw() { |
| 33 | if (thrown_object != nullptr) |
| 34 | std::terminate(); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | void *__cxa_current_primary_exception() throw() { return nullptr; } |
| 39 | |
| 40 | void |
| 41 | __cxa_rethrow_primary_exception(void* thrown_object) { |
| 42 | if (thrown_object != nullptr) |
| 43 | std::terminate(); |
| 44 | } |
| 45 | |
| 46 | bool |
| 47 | __cxa_uncaught_exception() throw() { return false; } |
| 48 | |
| 49 | unsigned int |
| 50 | __cxa_uncaught_exceptions() throw() { return 0; } |
| 51 | |
| 52 | } // extern "C" |
| 53 | |
Marshall Clow | 8a39827 | 2018-10-10 17:12:54 +0000 | [diff] [blame] | 54 | // provide dummy implementations for the 'no exceptions' case. |
| 55 | uint64_t __getExceptionClass (const _Unwind_Exception*) { return 0; } |
| 56 | void __setExceptionClass ( _Unwind_Exception*, uint64_t) {} |
| 57 | bool __isOurExceptionClass(const _Unwind_Exception*) { return false; } |
| 58 | |
Asiri Rathnayake | 57e446d | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 59 | } // abi |