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