LCOV - code coverage report
Current view: top level - include/llvm/Support - Errno.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 4 4 100.0 %
Date: 2017-09-14 15:23:50 Functions: 11 16 68.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/Support/Errno.h - Portable+convenient errno handling -*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file declares some portable and convenient functions to deal with errno.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_SUPPORT_ERRNO_H
      15             : #define LLVM_SUPPORT_ERRNO_H
      16             : 
      17             : #include <cerrno>
      18             : #include <string>
      19             : #include <type_traits>
      20             : 
      21             : namespace llvm {
      22             : namespace sys {
      23             : 
      24             : /// Returns a string representation of the errno value, using whatever
      25             : /// thread-safe variant of strerror() is available.  Be sure to call this
      26             : /// immediately after the function that set errno, or errno may have been
      27             : /// overwritten by an intervening call.
      28             : std::string StrError();
      29             : 
      30             : /// Like the no-argument version above, but uses \p errnum instead of errno.
      31             : std::string StrError(int errnum);
      32             : 
      33             : template <typename FailT, typename Fun, typename... Args>
      34    11626374 : inline auto RetryAfterSignal(const FailT &Fail, const Fun &F,
      35             :                              const Args &... As) -> decltype(F(As...)) {
      36             :   decltype(F(As...)) Res;
      37             :   do
      38    11626381 :     Res = F(As...);
      39    11626375 :   while (Res == Fail && errno == EINTR);
      40    11626374 :   return Res;
      41             : }
      42             : 
      43             : }  // namespace sys
      44             : }  // namespace llvm
      45             : 
      46             : #endif  // LLVM_SYSTEM_ERRNO_H

Generated by: LCOV version 1.13