Coverage Report

Created: 2020-06-26 05:44

/home/arjun/llvm-project/llvm/include/llvm/Support/Errno.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/Support/Errno.h - Portable+convenient errno handling -*- C++ -*-===//
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
// This file declares some portable and convenient functions to deal with errno.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_SUPPORT_ERRNO_H
14
#define LLVM_SUPPORT_ERRNO_H
15
16
#include <cerrno>
17
#include <string>
18
#include <type_traits>
19
20
namespace llvm {
21
namespace sys {
22
23
/// Returns a string representation of the errno value, using whatever
24
/// thread-safe variant of strerror() is available.  Be sure to call this
25
/// immediately after the function that set errno, or errno may have been
26
/// overwritten by an intervening call.
27
std::string StrError();
28
29
/// Like the no-argument version above, but uses \p errnum instead of errno.
30
std::string StrError(int errnum);
31
32
template <typename FailT, typename Fun, typename... Args>
33
inline decltype(auto) RetryAfterSignal(const FailT &Fail, const Fun &F,
34
0
                                       const Args &... As) {
35
0
  decltype(F(As...)) Res;
36
0
  do {
37
0
    errno = 0;
38
0
    Res = F(As...);
39
0
  } while (Res == Fail && errno == EINTR);
40
0
  return Res;
41
0
}
Unexecuted instantiation: Path.cpp:_ZN4llvm3sys16RetryAfterSignalIiZNS0_2fs8openFileERKNS_5TwineERiNS2_19CreationDispositionENS2_10FileAccessENS2_9OpenFlagsEjE3$_0JEEEDcRKT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm3sys16RetryAfterSignalIiFliPvmEJiPcmEEEDcRKT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm3sys16RetryAfterSignalIiFliPvmlEJiPcmmEEEDcRKT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm3sys16RetryAfterSignalIiFiiP4statEJiS3_EEEDcRKT_RKT0_DpRKT1_
Unexecuted instantiation: Process.cpp:_ZN4llvm3sys16RetryAfterSignalIiZNS0_7Process28FixupStandardFileDescriptorsEvE3$_1JEEEDcRKT_RKT0_DpRKT1_
42
43
}  // namespace sys
44
}  // namespace llvm
45
46
#endif  // LLVM_SYSTEM_ERRNO_H