Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/Errno.h
Line
Count
Source
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 auto RetryAfterSignal(const FailT &Fail, const Fun &F,
34
1.91M
                             const Args &... As) -> decltype(F(As...)) {
35
1.91M
  decltype(F(As...)) Res;
36
1.91M
  do {
37
1.91M
    errno = 0;
38
1.91M
    Res = F(As...);
39
1.91M
  } while (Res == Fail && errno
== EINTR520k
);
40
1.91M
  return Res;
41
1.91M
}
Path.cpp:decltype(fp0(fp1...)) llvm::sys::RetryAfterSignal<int, llvm::sys::fs::openFile(llvm::Twine const&, int&, llvm::sys::fs::CreationDisposition, llvm::sys::fs::FileAccess, llvm::sys::fs::OpenFlags, unsigned int)::$_0>(int const&, llvm::sys::fs::openFile(llvm::Twine const&, int&, llvm::sys::fs::CreationDisposition, llvm::sys::fs::FileAccess, llvm::sys::fs::OpenFlags, unsigned int)::$_0 const&)
Line
Count
Source
34
1.14M
                             const Args &... As) -> decltype(F(As...)) {
35
1.14M
  decltype(F(As...)) Res;
36
1.14M
  do {
37
1.14M
    errno = 0;
38
1.14M
    Res = F(As...);
39
1.14M
  } while (Res == Fail && errno
== EINTR520k
);
40
1.14M
  return Res;
41
1.14M
}
decltype(fp0(fp1...)) llvm::sys::RetryAfterSignal<int, long (int, void*, unsigned long), int, char*, unsigned long>(int const&, long  const(&)(int, void*, unsigned long), int const&, char* const&, unsigned long const&)
Line
Count
Source
34
111k
                             const Args &... As) -> decltype(F(As...)) {
35
111k
  decltype(F(As...)) Res;
36
111k
  do {
37
111k
    errno = 0;
38
111k
    Res = F(As...);
39
111k
  } while (Res == Fail && errno
== EINTR0
);
40
111k
  return Res;
41
111k
}
decltype(fp0(fp1...)) llvm::sys::RetryAfterSignal<int, long (int, void*, unsigned long, long long), int, char*, unsigned long, unsigned long>(int const&, long  const(&)(int, void*, unsigned long, long long), int const&, char* const&, unsigned long const&, unsigned long const&)
Line
Count
Source
34
482k
                             const Args &... As) -> decltype(F(As...)) {
35
482k
  decltype(F(As...)) Res;
36
482k
  do {
37
482k
    errno = 0;
38
482k
    Res = F(As...);
39
482k
  } while (Res == Fail && errno
== EINTR0
);
40
482k
  return Res;
41
482k
}
decltype(fp0(fp1...)) llvm::sys::RetryAfterSignal<int, int (int, stat*), int, stat*>(int const&, int  const(&)(int, stat*), int const&, stat* const&)
Line
Count
Source
34
180k
                             const Args &... As) -> decltype(F(As...)) {
35
180k
  decltype(F(As...)) Res;
36
180k
  do {
37
180k
    errno = 0;
38
180k
    Res = F(As...);
39
180k
  } while (Res == Fail && errno
== EINTR0
);
40
180k
  return Res;
41
180k
}
Unexecuted instantiation: Process.cpp:decltype(fp0(fp1...)) llvm::sys::RetryAfterSignal<int, llvm::sys::Process::FixupStandardFileDescriptors()::$_1>(int const&, llvm::sys::Process::FixupStandardFileDescriptors()::$_1 const&)
42
43
}  // namespace sys
44
}  // namespace llvm
45
46
#endif  // LLVM_SYSTEM_ERRNO_H