Coverage Report

Created: 2022-05-14 11:35

/Users/buildslave/jenkins/workspace/coverage/llvm-project/libcxx/src/random_shuffle.cpp
Line
Count
Source (jump to first uncovered line)
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
9
#include <algorithm>
10
#include <random>
11
12
#ifndef _LIBCPP_HAS_NO_THREADS
13
#  include <mutex>
14
#  if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
15
#    pragma comment(lib, "pthread")
16
#  endif
17
#endif
18
19
_LIBCPP_BEGIN_NAMESPACE_STD
20
21
#ifndef _LIBCPP_HAS_NO_THREADS
22
static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER;
23
#endif
24
unsigned __rs_default::__c_ = 0;
25
26
__rs_default::__rs_default()
27
0
{
28
0
#ifndef _LIBCPP_HAS_NO_THREADS
29
0
    __libcpp_mutex_lock(&__rs_mut);
30
0
#endif
31
0
    __c_ = 1;
32
0
}
33
34
__rs_default::__rs_default(const __rs_default&)
35
0
{
36
0
    ++__c_;
37
0
}
38
39
__rs_default::~__rs_default()
40
0
{
41
0
#ifndef _LIBCPP_HAS_NO_THREADS
42
0
    if (--__c_ == 0)
43
0
       __libcpp_mutex_unlock(&__rs_mut);
44
#else
45
    --__c_;
46
#endif
47
0
}
48
49
__rs_default::result_type
50
__rs_default::operator()()
51
0
{
52
0
    static mt19937 __rs_g;
53
0
    return __rs_g();
54
0
}
55
56
__rs_default
57
__rs_get()
58
0
{
59
0
    return __rs_default();
60
0
}
61
62
_LIBCPP_END_NAMESPACE_STD