Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/lld/COFF/Error.h
Line
Count
Source (jump to first uncovered line)
1
//===- Error.h --------------------------------------------------*- C++ -*-===//
2
//
3
//                             The LLVM Linker
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLD_COFF_ERROR_H
11
#define LLD_COFF_ERROR_H
12
13
#include "lld/Core/LLVM.h"
14
#include "llvm/Support/Error.h"
15
16
namespace lld {
17
namespace coff {
18
19
extern uint64_t ErrorCount;
20
extern llvm::raw_ostream *ErrorOS;
21
22
void log(const Twine &Msg);
23
void message(const Twine &Msg);
24
void warn(const Twine &Msg);
25
void error(const Twine &Msg);
26
LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg);
27
LLVM_ATTRIBUTE_NORETURN void fatal(std::error_code EC, const Twine &Prefix);
28
LLVM_ATTRIBUTE_NORETURN void fatal(llvm::Error &Err, const Twine &Prefix);
29
30
280
template <class T> T check(ErrorOr<T> V, const Twine &Prefix) {
31
280
  if (auto EC = V.getError())
32
0
    fatal(EC, Prefix);
33
280
  return std::move(*V);
34
280
}
std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> > lld::coff::check<std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> > >(llvm::ErrorOr<std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> > >, llvm::Twine const&)
Line
Count
Source
30
21
template <class T> T check(ErrorOr<T> V, const Twine &Prefix) {
31
21
  if (auto EC = V.getError())
32
0
    fatal(EC, Prefix);
33
21
  return std::move(*V);
34
21
}
llvm::object::Archive::Child lld::coff::check<llvm::object::Archive::Child>(llvm::ErrorOr<llvm::object::Archive::Child>, llvm::Twine const&)
Line
Count
Source
30
2
template <class T> T check(ErrorOr<T> V, const Twine &Prefix) {
31
2
  if (auto EC = V.getError())
32
0
    fatal(EC, Prefix);
33
2
  return std::move(*V);
34
2
}
std::__1::unique_ptr<llvm::FileOutputBuffer, std::__1::default_delete<llvm::FileOutputBuffer> > lld::coff::check<std::__1::unique_ptr<llvm::FileOutputBuffer, std::__1::default_delete<llvm::FileOutputBuffer> > >(llvm::ErrorOr<std::__1::unique_ptr<llvm::FileOutputBuffer, std::__1::default_delete<llvm::FileOutputBuffer> > >, llvm::Twine const&)
Line
Count
Source
30
257
template <class T> T check(ErrorOr<T> V, const Twine &Prefix) {
31
257
  if (auto EC = V.getError())
32
0
    fatal(EC, Prefix);
33
257
  return std::move(*V);
34
257
}
35
36
552
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
552
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
552
  return std::move(*E);
40
552
}
std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > lld::coff::check<std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > >(llvm::Expected<std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > >, llvm::Twine const&)
Line
Count
Source
36
318
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
318
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
318
  return std::move(*E);
40
318
}
llvm::MemoryBufferRef lld::coff::check<llvm::MemoryBufferRef>(llvm::Expected<llvm::MemoryBufferRef>, llvm::Twine const&)
Line
Count
Source
36
89
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
89
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
89
  return std::move(*E);
40
89
}
llvm::object::Archive::Child lld::coff::check<llvm::object::Archive::Child>(llvm::Expected<llvm::object::Archive::Child>, llvm::Twine const&)
Line
Count
Source
36
87
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
87
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
87
  return std::move(*E);
40
87
}
llvm::CachePruningPolicy lld::coff::check<llvm::CachePruningPolicy>(llvm::Expected<llvm::CachePruningPolicy>, llvm::Twine const&)
Line
Count
Source
36
1
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
1
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
1
  return std::move(*E);
40
1
}
std::__1::unique_ptr<llvm::object::Archive, std::__1::default_delete<llvm::object::Archive> > lld::coff::check<std::__1::unique_ptr<llvm::object::Archive, std::__1::default_delete<llvm::object::Archive> > >(llvm::Expected<std::__1::unique_ptr<llvm::object::Archive, std::__1::default_delete<llvm::object::Archive> > >, llvm::Twine const&)
Line
Count
Source
36
57
template <class T> T check(Expected<T> E, const Twine &Prefix) {
37
57
  if (llvm::Error Err = E.takeError())
38
0
    fatal(Err, Prefix);
39
57
  return std::move(*E);
40
57
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > lld::coff::check<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::Twine const&)
41
42
0
template <class T> T check(ErrorOr<T> EO) {
43
0
  if (!EO)
44
0
    fatal(EO.getError().message());
45
0
  return std::move(*EO);
46
0
}
47
48
75
template <class T> T check(Expected<T> E) {
49
75
  if (
!E75
) {
50
0
    std::string Buf;
51
0
    llvm::raw_string_ostream OS(Buf);
52
0
    logAllUnhandledErrors(E.takeError(), OS, "");
53
0
    OS.flush();
54
0
    fatal(Buf);
55
0
  }
56
75
  return std::move(*E);
57
75
}
std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > lld::coff::check<std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > >(llvm::Expected<std::__1::unique_ptr<llvm::object::Binary, std::__1::default_delete<llvm::object::Binary> > >)
Line
Count
Source
48
4
template <class T> T check(Expected<T> E) {
49
4
  if (
!E4
) {
50
0
    std::string Buf;
51
0
    llvm::raw_string_ostream OS(Buf);
52
0
    logAllUnhandledErrors(E.takeError(), OS, "");
53
0
    OS.flush();
54
0
    fatal(Buf);
55
0
  }
56
4
  return std::move(*E);
57
4
}
llvm::object::COFFModuleDefinition lld::coff::check<llvm::object::COFFModuleDefinition>(llvm::Expected<llvm::object::COFFModuleDefinition>)
Line
Count
Source
48
21
template <class T> T check(Expected<T> E) {
49
21
  if (
!E21
) {
50
0
    std::string Buf;
51
0
    llvm::raw_string_ostream OS(Buf);
52
0
    logAllUnhandledErrors(E.takeError(), OS, "");
53
0
    OS.flush();
54
0
    fatal(Buf);
55
0
  }
56
21
  return std::move(*E);
57
21
}
std::__1::unique_ptr<llvm::lto::InputFile, std::__1::default_delete<llvm::lto::InputFile> > lld::coff::check<std::__1::unique_ptr<llvm::lto::InputFile, std::__1::default_delete<llvm::lto::InputFile> > >(llvm::Expected<std::__1::unique_ptr<llvm::lto::InputFile, std::__1::default_delete<llvm::lto::InputFile> > >)
Line
Count
Source
48
49
template <class T> T check(Expected<T> E) {
49
49
  if (
!E49
) {
50
0
    std::string Buf;
51
0
    llvm::raw_string_ostream OS(Buf);
52
0
    logAllUnhandledErrors(E.takeError(), OS, "");
53
0
    OS.flush();
54
0
    fatal(Buf);
55
0
  }
56
49
  return std::move(*E);
57
49
}
std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)> (unsigned int, llvm::StringRef)> lld::coff::check<std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)> (unsigned int, llvm::StringRef)> >(llvm::Expected<std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)> (unsigned int, llvm::StringRef)> >)
Line
Count
Source
48
1
template <class T> T check(Expected<T> E) {
49
1
  if (
!E1
) {
50
0
    std::string Buf;
51
0
    llvm::raw_string_ostream OS(Buf);
52
0
    logAllUnhandledErrors(E.takeError(), OS, "");
53
0
    OS.flush();
54
0
    fatal(Buf);
55
0
  }
56
1
  return std::move(*E);
57
1
}
58
59
} // namespace coff
60
} // namespace lld
61
62
#endif