Coverage Report

Created: 2020-09-15 12:33

/Users/buildslave/jenkins/workspace/coverage/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
Line
Count
Source (jump to first uncovered line)
1
// -*- C++ -*-
2
//===----------------------------------------------------------------------===//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef HAVE_DEPENDENT_EH_ABI
11
#error this header may only be used with libc++abi or libcxxrt
12
#endif
13
14
namespace std {
15
16
332
exception_ptr::~exception_ptr() _NOEXCEPT {
17
332
  __cxa_decrement_exception_refcount(__ptr_);
18
332
}
19
20
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
21
    : __ptr_(other.__ptr_)
22
0
{
23
0
    __cxa_increment_exception_refcount(__ptr_);
24
0
}
25
26
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
27
0
{
28
0
    if (__ptr_ != other.__ptr_)
29
0
    {
30
0
        __cxa_increment_exception_refcount(other.__ptr_);
31
0
        __cxa_decrement_exception_refcount(__ptr_);
32
0
        __ptr_ = other.__ptr_;
33
0
    }
34
0
    return *this;
35
0
}
36
37
nested_exception::nested_exception() _NOEXCEPT
38
    : __ptr_(current_exception())
39
0
{
40
0
}
41
42
nested_exception::~nested_exception() _NOEXCEPT
43
0
{
44
0
}
45
46
_LIBCPP_NORETURN
47
void
48
nested_exception::rethrow_nested() const
49
0
{
50
0
    if (__ptr_ == nullptr)
51
0
        terminate();
52
0
    rethrow_exception(__ptr_);
53
0
}
54
55
exception_ptr current_exception() _NOEXCEPT
56
0
{
57
    // be nicer if there was a constructor that took a ptr, then
58
    // this whole function would be just:
59
    //    return exception_ptr(__cxa_current_primary_exception());
60
0
    exception_ptr ptr;
61
0
    ptr.__ptr_ = __cxa_current_primary_exception();
62
0
    return ptr;
63
0
}
64
65
_LIBCPP_NORETURN
66
void rethrow_exception(exception_ptr p)
67
0
{
68
0
    __cxa_rethrow_primary_exception(p.__ptr_);
69
    // if p.__ptr_ is NULL, above returns so we terminate
70
0
    terminate();
71
0
}
72
73
} // namespace std