Coverage Report

Created: 2020-10-24 06:27

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