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

source code of libcxxabi/src/cxa_noexception.cpp